Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
gnss_utils
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
labrobotica
algorithms
gnss_utils
Commits
2dc541dc
Commit
2dc541dc
authored
5 years ago
by
Pep Martí Saumell
Browse files
Options
Downloads
Patches
Plain Diff
[improvement] Added template for printing arrays
parent
ac03ff9a
No related branches found
Branches containing commit
No related tags found
3 merge requests
!20
new tag
,
!19
new tag
,
!13
Resolve "Templatize prints from utils.h"
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
include/gnss_utils/utils/utils.h
+14
-4
14 additions, 4 deletions
include/gnss_utils/utils/utils.h
src/observations.cpp
+8
-8
8 additions, 8 deletions
src/observations.cpp
src/utils/utils.cpp
+0
-52
0 additions, 52 deletions
src/utils/utils.cpp
with
22 additions
and
64 deletions
include/gnss_utils/utils/utils.h
+
14
−
4
View file @
2dc541dc
...
@@ -17,10 +17,20 @@
...
@@ -17,10 +17,20 @@
namespace
GnssUtils
namespace
GnssUtils
{
{
void
print
(
std
::
string
&
_msg
);
void
print
(
std
::
string
&
_msg
);
void
printArray
(
std
::
string
_name
,
int
*
_array
,
int
size
);
void
printArray
(
std
::
string
_name
,
unsigned
char
*
_array
,
int
size
);
template
<
typename
T
,
size_t
size
>
void
printArray
(
std
::
string
_name
,
double
*
_array
,
int
size
);
void
printArray
(
std
::
string
name
,
T
(
&
array
)[
size
])
void
printArray
(
std
::
string
_name
,
float
*
_array
,
int
size
);
{
std
::
cout
<<
name
<<
": ["
;
for
(
int
ii
=
0
;
ii
<
size
;
++
ii
)
{
std
::
cout
<<
array
[
ii
];
if
(
ii
==
size
-
1
)
std
::
cout
<<
"]
\n
"
;
else
std
::
cout
<<
","
;
}
}
template
<
typename
T
>
template
<
typename
T
>
inline
bool
addToArray
(
const
T
&
new_element
,
T
*&
array
,
int
&
n
,
int
&
nmax
)
inline
bool
addToArray
(
const
T
&
new_element
,
T
*&
array
,
int
&
n
,
int
&
nmax
)
...
...
This diff is collapsed.
Click to expand it.
src/observations.cpp
+
8
−
8
View file @
2dc541dc
...
@@ -163,15 +163,15 @@ static void Observations::print(obsd_t& _obs)
...
@@ -163,15 +163,15 @@ static void Observations::print(obsd_t& _obs)
GnssUtils
::
print
(
msg
);
GnssUtils
::
print
(
msg
);
std
::
cout
<<
"Time [s]: "
<<
_obs
.
time
.
time
<<
" + "
<<
_obs
.
time
.
sec
<<
"
\n
"
;
std
::
cout
<<
"Time [s]: "
<<
_obs
.
time
.
time
<<
" + "
<<
_obs
.
time
.
sec
<<
"
\n
"
;
std
::
cout
<<
"Time valid: "
<<
_obs
.
timevalid
<<
std
::
endl
;
std
::
cout
<<
"Time valid: "
<<
_obs
.
timevalid
<<
std
::
endl
;
printArray
(
"SNR: "
,
_obs
.
SNR
,
ARRAY_SIZE
(
_obs
.
SNR
));
printArray
<
unsigned
char
,
ARRAY_SIZE
(
_obs
.
SNR
)
>
(
"SNR: "
,
_obs
.
SNR
);
printArray
(
"LLI: "
,
_obs
.
LLI
,
ARRAY_SIZE
(
_obs
.
LLI
));
printArray
<
unsigned
char
,
ARRAY_SIZE
(
_obs
.
LLI
)
>
(
"LLI: "
,
_obs
.
LLI
);
printArray
(
"code: "
,
_obs
.
code
,
ARRAY_SIZE
(
_obs
.
code
));
printArray
<
unsigned
char
,
ARRAY_SIZE
(
_obs
.
code
)
>
(
"code: "
,
_obs
.
code
);
printArray
(
"code: "
,
_obs
.
qualL
,
ARRAY_SIZE
(
_obs
.
qualL
));
printArray
<
unsigned
char
,
ARRAY_SIZE
(
_obs
.
qualL
)
>
(
"code: "
,
_obs
.
qualL
);
printArray
(
"code: "
,
_obs
.
qualP
,
ARRAY_SIZE
(
_obs
.
qualP
));
printArray
<
unsigned
char
,
ARRAY_SIZE
(
_obs
.
qualP
)
>
(
"code: "
,
_obs
.
qualP
);
printf
(
"Freq. channel: %uc
\n
"
,
_obs
.
freq
);
printf
(
"Freq. channel: %uc
\n
"
,
_obs
.
freq
);
printArray
(
"L: "
,
_obs
.
L
,
ARRAY_SIZE
(
_obs
.
L
));
printArray
<
double
,
ARRAY_SIZE
(
_obs
.
L
)
>
(
"L: "
,
_obs
.
L
);
printArray
(
"P: "
,
_obs
.
P
,
ARRAY_SIZE
(
_obs
.
P
));
printArray
<
double
,
ARRAY_SIZE
(
_obs
.
P
)
>
(
"P: "
,
_obs
.
P
);
printArray
(
"D: "
,
_obs
.
D
,
ARRAY_SIZE
(
_obs
.
D
));
printArray
<
float
,
ARRAY_SIZE
(
_obs
.
D
)
>
(
"D: "
,
_obs
.
D
);
}
}
void
Observations
::
printBySat
(
const
int
&
_sat_number
)
void
Observations
::
printBySat
(
const
int
&
_sat_number
)
...
...
This diff is collapsed.
Click to expand it.
src/utils/utils.cpp
+
0
−
52
View file @
2dc541dc
...
@@ -9,58 +9,6 @@ void print(std::string& _msg)
...
@@ -9,58 +9,6 @@ void print(std::string& _msg)
std
::
cout
<<
msg
<<
"
\n
"
;
std
::
cout
<<
msg
<<
"
\n
"
;
}
}
void
printArray
(
std
::
string
_name
,
int
*
_array
,
int
size
)
{
std
::
cout
<<
_name
<<
": ["
;
for
(
int
ii
=
0
;
ii
<
size
;
++
ii
)
{
std
::
cout
<<
_array
[
ii
];
if
(
ii
==
size
-
1
)
std
::
cout
<<
"]
\n
"
;
else
std
::
cout
<<
","
;
}
}
void
printArray
(
std
::
string
_name
,
unsigned
char
*
_array
,
int
size
)
{
std
::
cout
<<
_name
<<
": ["
;
for
(
int
ii
=
0
;
ii
<
size
;
++
ii
)
{
std
::
cout
<<
(
int
)(
_array
[
ii
]);
if
(
ii
==
size
-
1
)
std
::
cout
<<
"]
\n
"
;
else
std
::
cout
<<
","
;
}
}
void
printArray
(
std
::
string
_name
,
double
*
_array
,
int
size
)
{
std
::
cout
<<
_name
<<
": ["
;
for
(
int
ii
=
0
;
ii
<
size
;
++
ii
)
{
std
::
cout
<<
_array
[
ii
];
if
(
ii
==
size
-
1
)
std
::
cout
<<
"]
\n
"
;
else
std
::
cout
<<
","
;
}
}
void
printArray
(
std
::
string
_name
,
float
*
_array
,
int
size
)
{
std
::
cout
<<
_name
<<
": ["
;
for
(
int
ii
=
0
;
ii
<
size
;
++
ii
)
{
std
::
cout
<<
_array
[
ii
];
if
(
ii
==
size
-
1
)
std
::
cout
<<
"]
\n
"
;
else
std
::
cout
<<
","
;
}
}
}
// namespace GnssUtils
}
// namespace GnssUtils
bool
operator
==
(
const
gtime_t
&
time1
,
const
gtime_t
&
time2
)
bool
operator
==
(
const
gtime_t
&
time1
,
const
gtime_t
&
time2
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment