File tree Expand file tree Collapse file tree 2 files changed +38
-0
lines changed
include/behaviortree_cpp/decorators Expand file tree Collapse file tree 2 files changed +38
-0
lines changed Original file line number Diff line number Diff line change @@ -121,6 +121,30 @@ class LoopNode : public DecoratorNode
121121 }
122122};
123123
124+ template <> inline
125+ SharedQueue<int > convertFromString<SharedQueue<int >>(StringView str)
126+ {
127+ auto parts = splitString (str, ' ;' );
128+ SharedQueue<int > output = std::make_shared<std::deque<int >>();
129+ for (const StringView& part : parts)
130+ {
131+ output->push_back (convertFromString<int >(part));
132+ }
133+ return output;
134+ }
135+
136+ template <> inline
137+ SharedQueue<bool > convertFromString<SharedQueue<bool >>(StringView str)
138+ {
139+ auto parts = splitString (str, ' ;' );
140+ SharedQueue<bool > output = std::make_shared<std::deque<bool >>();
141+ for (const StringView& part : parts)
142+ {
143+ output->push_back (convertFromString<bool >(part));
144+ }
145+ return output;
146+ }
147+
124148template <> inline
125149SharedQueue<double > convertFromString<SharedQueue<double >>(StringView str)
126150{
@@ -133,5 +157,17 @@ SharedQueue<double> convertFromString<SharedQueue<double>>(StringView str)
133157 return output;
134158}
135159
160+ template <> inline
161+ SharedQueue<std::string> convertFromString<SharedQueue<std::string>>(StringView str)
162+ {
163+ auto parts = splitString (str, ' ;' );
164+ SharedQueue<std::string> output = std::make_shared<std::deque<std::string>>();
165+ for (const StringView& part : parts)
166+ {
167+ output->push_back (convertFromString<std::string>(part));
168+ }
169+ return output;
170+ }
171+
136172
137173} // namespace BT
Original file line number Diff line number Diff line change @@ -91,6 +91,8 @@ BehaviorTreeFactory::BehaviorTreeFactory():
9191 registerNodeType<SwitchNode<5 >>(" Switch5" );
9292 registerNodeType<SwitchNode<6 >>(" Switch6" );
9393
94+ registerNodeType<LoopNode<int >>(" LoopInt" );
95+ registerNodeType<LoopNode<bool >>(" LoopBool" );
9496 registerNodeType<LoopNode<double >>(" LoopDouble" );
9597 registerNodeType<LoopNode<std::string>>(" LoopString" );
9698
You can’t perform that action at this time.
0 commit comments