Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
wolf
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
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
mobile_robotics
wolf_projects
wolf_lib
wolf
Commits
e721fe6d
Commit
e721fe6d
authored
4 years ago
by
Joan Solà Ortega
Browse files
Options
Downloads
Patches
Plain Diff
Add structure comparator structcmp()
parent
90230197
No related branches found
No related tags found
1 merge request
!389
WIP: Resolve "VectorComposite::getStructure() sorted string"
Pipeline
#8614
passed
3 years ago
Stage: build
Changes
3
Pipelines
2
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
include/core/state_block/state_composite.h
+3
-0
3 additions, 0 deletions
include/core/state_block/state_composite.h
src/state_block/state_composite.cpp
+16
-0
16 additions, 0 deletions
src/state_block/state_composite.cpp
test/gtest_state_composite.cpp
+13
-0
13 additions, 0 deletions
test/gtest_state_composite.cpp
with
32 additions
and
0 deletions
include/core/state_block/state_composite.h
+
3
−
0
View file @
e721fe6d
...
...
@@ -25,6 +25,9 @@ typedef std::string StateStructure;
typedef
std
::
unordered_map
<
char
,
StateBlockPtr
>
StateBlockMap
;
typedef
StateBlockMap
::
const_iterator
StateBlockMapCIter
;
bool
structcmp
(
const
StateStructure
&
s1
,
const
StateStructure
&
s2
);
class
VectorComposite
:
public
std
::
unordered_map
<
char
,
Eigen
::
VectorXd
>
{
public:
...
...
This diff is collapsed.
Click to expand it.
src/state_block/state_composite.cpp
+
16
−
0
View file @
e721fe6d
...
...
@@ -6,6 +6,22 @@
namespace
wolf
{
////// STATE STRUCTURE //////////
bool
structcmp
(
const
StateStructure
&
s1
,
const
StateStructure
&
s2
)
{
if
(
s1
.
size
()
!=
s2
.
size
())
return
false
;
std
::
set
<
char
>
s1_chars
,
s2_chars
;
for
(
const
auto
&
c
:
s1
)
s1_chars
.
emplace
(
c
);
for
(
const
auto
&
c
:
s2
)
s2_chars
.
emplace
(
c
);
return
s1_chars
==
s2_chars
;
}
////// VECTOR COMPOSITE //////////
VectorComposite
::
VectorComposite
(
const
StateStructure
&
_structure
,
const
std
::
list
<
int
>&
_sizes
)
...
...
This diff is collapsed.
Click to expand it.
test/gtest_state_composite.cpp
+
13
−
0
View file @
e721fe6d
...
...
@@ -13,6 +13,19 @@
using
namespace
wolf
;
using
namespace
std
;
TEST
(
StateStructure
,
operator_equal
)
{
StateStructure
POV
(
"POV"
),
PVO
(
"PVO"
),
PO
(
"PO"
),
POVW
(
"POVW"
);
ASSERT_TRUE
(
structcmp
(
POV
,
PVO
)
);
ASSERT_FALSE
(
structcmp
(
POV
,
PO
)
);
ASSERT_FALSE
(
structcmp
(
PO
,
POV
)
);
ASSERT_FALSE
(
structcmp
(
PO
,
POVW
)
);
ASSERT_FALSE
(
structcmp
(
POVW
,
PO
)
);
ASSERT_TRUE
(
structcmp
(
POVW
,
"PVOW"
)
);
ASSERT_TRUE
(
structcmp
(
POVW
,
"WPOV"
)
);
}
class
StateBlockCompositeInit
:
public
testing
::
Test
{
...
...
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