Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 5295a7e

Browse files
author
Davide Faconti
committed
aded default value to port Model (issue BehaviorTree#56)
1 parent 0d9d56b commit 5295a7e

File tree

2 files changed

+15
-0
lines changed

2 files changed

+15
-0
lines changed

include/behaviortree_cpp/basic_types.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -220,14 +220,19 @@ class PortInfo
220220

221221
void setDescription(StringView description);
222222

223+
void setDefaultValue(StringView default_value_as_string);
224+
223225
const std::string& description() const;
224226

227+
const std::string& defaultValue() const;
228+
225229
private:
226230

227231
PortDirection _type;
228232
const std::type_info* _info;
229233
StringConverter _converter;
230234
std::string description_;
235+
std::string default_value_;
231236
};
232237

233238
template <typename T = void>

src/basic_types.cpp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -254,11 +254,21 @@ void PortInfo::setDescription(StringView description)
254254
description_ = description.to_string();
255255
}
256256

257+
void PortInfo::setDefaultValue(StringView default_value_as_string)
258+
{
259+
default_value_ = default_value_as_string.to_string();
260+
}
261+
257262
const std::string &PortInfo::description() const
258263
{
259264
return description_;
260265
}
261266

267+
const std::string &PortInfo::defaultValue() const
268+
{
269+
return default_value_;
270+
}
271+
262272
const char *toStr(PortDirection type)
263273
{
264274
switch(type)

0 commit comments

Comments
 (0)