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
121
121
}
122
122
};
123
123
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
+
124
148
template <> inline
125
149
SharedQueue<double > convertFromString<SharedQueue<double >>(StringView str)
126
150
{
@@ -133,5 +157,17 @@ SharedQueue<double> convertFromString<SharedQueue<double>>(StringView str)
133
157
return output;
134
158
}
135
159
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
+
136
172
137
173
} // namespace BT
Original file line number Diff line number Diff line change @@ -91,6 +91,8 @@ BehaviorTreeFactory::BehaviorTreeFactory():
91
91
registerNodeType<SwitchNode<5 >>(" Switch5" );
92
92
registerNodeType<SwitchNode<6 >>(" Switch6" );
93
93
94
+ registerNodeType<LoopNode<int >>(" LoopInt" );
95
+ registerNodeType<LoopNode<bool >>(" LoopBool" );
94
96
registerNodeType<LoopNode<double >>(" LoopDouble" );
95
97
registerNodeType<LoopNode<std::string>>(" LoopString" );
96
98
You can’t perform that action at this time.
0 commit comments