Skip to content

Commit da37630

Browse files
committed
[occ] Update dummy-process example to use boost::property_tree
1 parent a971ae3 commit da37630

2 files changed

Lines changed: 9 additions & 5 deletions

File tree

occ/occlib/examples/dummy-process/ControlledStateMachine.cxx

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@
2525

2626
#include "ControlledStateMachine.h"
2727

28+
#include <boost/property_tree/json_parser.hpp>
29+
2830
#include <iostream>
2931

3032
#define LOG_SCOPE RaiiLogEntry obj ## __LINE__ (__FUNCTION__);
@@ -37,12 +39,14 @@ struct RaiiLogEntry
3739
};
3840

3941

40-
int ControlledStateMachine::executeConfigure(const PropertyMap& properties)
42+
int ControlledStateMachine::executeConfigure(const boost::property_tree::ptree& properties)
4143
{
4244
LOG_SCOPE
43-
for (auto const& item : properties) {
44-
printf("%s :\t %s\n", item.first.c_str(), item.second.c_str());
45-
}
45+
printf("received runtime configuration:\n");
46+
std::stringstream ss;
47+
boost::property_tree::json_parser::write_json(ss, properties);
48+
printf("%s\n", ss.str().c_str());
49+
4650
return RuntimeControlledObject::executeConfigure(properties);
4751
}
4852

occ/occlib/examples/dummy-process/ControlledStateMachine.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ class ControlledStateMachine : public RuntimeControlledObject
3333
public:
3434
explicit ControlledStateMachine() : RuntimeControlledObject("Dummy Process") {}
3535

36-
int executeConfigure(const PropertyMap& properties) override; // to go from standby to configured
36+
int executeConfigure(const boost::property_tree::ptree& properties) override; // to go from standby to configured
3737
int executeReset() override; // to go from configured to standby
3838
int executeRecover() override; // to go from error to standby
3939
int executeStart() override; // to go from configured to running

0 commit comments

Comments
 (0)