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
13ad32b9
Commit
13ad32b9
authored
5 years ago
by
Joaquim Casals Buñuel
Browse files
Options
Downloads
Patches
Plain Diff
Clean up Parser YAML
parent
6457bfef
No related branches found
No related tags found
No related merge requests found
Pipeline
#4685
passed
5 years ago
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
include/core/yaml/parser_yaml.hpp
+10
-19
10 additions, 19 deletions
include/core/yaml/parser_yaml.hpp
with
10 additions
and
19 deletions
include/core/yaml/parser_yaml.hpp
+
10
−
19
View file @
13ad32b9
...
@@ -193,7 +193,6 @@ class ParserYAML {
...
@@ -193,7 +193,6 @@ class ParserYAML {
std
::
vector
<
ParamsInitProcessor
>
_paramsProc
;
std
::
vector
<
ParamsInitProcessor
>
_paramsProc
;
std
::
stack
<
std
::
string
>
_parsing_file
;
std
::
stack
<
std
::
string
>
_parsing_file
;
std
::
string
_file
;
std
::
string
_file
;
bool
_relative_path
;
std
::
string
_path_root
;
std
::
string
_path_root
;
std
::
vector
<
SubscriberManager
>
_subscriber_managers
;
std
::
vector
<
SubscriberManager
>
_subscriber_managers
;
YAML
::
Node
problem
;
YAML
::
Node
problem
;
...
@@ -201,11 +200,7 @@ class ParserYAML {
...
@@ -201,11 +200,7 @@ class ParserYAML {
YAML
::
Node
loadYAML
(
std
::
string
);
YAML
::
Node
loadYAML
(
std
::
string
);
void
insert_register
(
std
::
string
,
std
::
string
);
void
insert_register
(
std
::
string
,
std
::
string
);
public
:
public
:
ParserYAML
(
bool
freely_parse
=
false
)
:
ParserYAML
(
""
,
""
,
freely_parse
){
ParserYAML
(
std
::
string
file
,
std
::
string
path_root
=
""
,
}
ParserYAML
(
std
::
string
file
,
bool
freely_parse
=
false
)
:
ParserYAML
(
file
,
""
,
freely_parse
)
{}
ParserYAML
(
std
::
string
file
,
std
::
string
path_root
,
bool
freely_parse
=
false
)
{
bool
freely_parse
=
false
)
{
_params
=
std
::
map
<
std
::
string
,
std
::
string
>
();
_params
=
std
::
map
<
std
::
string
,
std
::
string
>
();
_active_name
=
""
;
_active_name
=
""
;
...
@@ -215,19 +210,17 @@ public:
...
@@ -215,19 +210,17 @@ public:
_parsing_file
=
std
::
stack
<
std
::
string
>
();
_parsing_file
=
std
::
stack
<
std
::
string
>
();
_file
=
file
;
_file
=
file
;
if
(
path_root
!=
""
)
{
if
(
path_root
!=
""
)
{
std
::
regex
r
(
"
/
$"
);
std
::
regex
r
(
"
.*/ *
$"
);
if
(
not
std
::
regex_match
(
path_root
,
r
))
if
(
not
std
::
regex_match
(
path_root
,
r
))
_path_root
=
path_root
+
"/"
;
_path_root
=
path_root
+
"/"
;
else
else
_path_root
=
path_root
;
_path_root
=
path_root
;
_relative_path
=
true
;
}
else
{
_relative_path
=
false
;
}
}
if
(
not
freely_parse
)
this
->
parse
();
if
(
not
freely_parse
)
this
->
parse
();
else
this
->
parse_freely
();
else
this
->
parse_freely
();
}
}
~
ParserYAML
(){
~
ParserYAML
()
{
//
//
}
}
void
parse_freely
();
void
parse_freely
();
...
@@ -243,12 +236,12 @@ public:
...
@@ -243,12 +236,12 @@ public:
std
::
string
tagsToString
(
std
::
vector
<
std
::
string
>&
tags
);
std
::
string
tagsToString
(
std
::
vector
<
std
::
string
>&
tags
);
void
parse
();
void
parse
();
};
};
std
::
string
ParserYAML
::
generatePath
(
std
::
string
path
){
std
::
string
ParserYAML
::
generatePath
(
std
::
string
file
){
std
::
regex
r
(
"^/.*"
);
std
::
regex
r
(
"^/.*"
);
if
(
std
::
regex_match
(
path
,
r
)){
if
(
std
::
regex_match
(
file
,
r
)){
return
path
;
return
file
;
}
else
{
}
else
{
return
_path_root
+
path
;
return
_path_root
+
file
;
}
}
}
}
YAML
::
Node
ParserYAML
::
loadYAML
(
std
::
string
file
){
YAML
::
Node
ParserYAML
::
loadYAML
(
std
::
string
file
){
...
@@ -472,11 +465,10 @@ void ParserYAML::parse(){
...
@@ -472,11 +465,10 @@ void ParserYAML::parse(){
if
(
n
.
Type
()
==
YAML
::
NodeType
::
Map
)
if
(
n
.
Type
()
==
YAML
::
NodeType
::
Map
)
{
{
WOLF_INFO
(
"HELLO"
);
for
(
auto
it
:
n
)
for
(
auto
it
:
n
)
{
{
auto
node
=
it
.
second
;
auto
node
=
it
.
second
;
WOLF_INFO
(
"WUT "
,
it
.
first
);
//
WOLF_INFO("WUT ", it.first);
std
::
vector
<
std
::
string
>
tags
=
std
::
vector
<
std
::
string
>
();
std
::
vector
<
std
::
string
>
tags
=
std
::
vector
<
std
::
string
>
();
if
(
it
.
first
.
as
<
std
::
string
>
()
!=
"config"
)
if
(
it
.
first
.
as
<
std
::
string
>
()
!=
"config"
)
this
->
walkTreeR
(
node
,
tags
,
it
.
first
.
as
<
std
::
string
>
());
this
->
walkTreeR
(
node
,
tags
,
it
.
first
.
as
<
std
::
string
>
());
...
@@ -485,7 +477,7 @@ void ParserYAML::parse(){
...
@@ -485,7 +477,7 @@ void ParserYAML::parse(){
for
(
auto
itt
:
node
)
for
(
auto
itt
:
node
)
{
{
std
::
string
node_key
=
itt
.
first
.
as
<
std
::
string
>
();
std
::
string
node_key
=
itt
.
first
.
as
<
std
::
string
>
();
WOLF_INFO
(
"node_key "
,
node_key
);
//
WOLF_INFO("node_key ", node_key);
if
(
node_key
!=
"problem"
and
node_key
!=
"sensors"
and
node_key
!=
"processors"
and
if
(
node_key
!=
"problem"
and
node_key
!=
"sensors"
and
node_key
!=
"processors"
and
node_key
!=
"ROS subscriber managers"
)
node_key
!=
"ROS subscriber managers"
)
{
{
...
@@ -496,7 +488,6 @@ void ParserYAML::parse(){
...
@@ -496,7 +488,6 @@ void ParserYAML::parse(){
}
}
}
else
}
else
{
{
WOLF_INFO
(
"GETTING HERE?"
);
std
::
vector
<
std
::
string
>
tags
=
std
::
vector
<
std
::
string
>
();
std
::
vector
<
std
::
string
>
tags
=
std
::
vector
<
std
::
string
>
();
this
->
walkTreeR
(
n
,
tags
,
""
);
this
->
walkTreeR
(
n
,
tags
,
""
);
}
}
...
...
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