Skip to content

Commit

Permalink
Added KnowledgeBase::set methods for direct KR entry and from/to_pyst…
Browse files Browse the repository at this point in the history
…rings (#113)
  • Loading branch information
ssabatier authored and jredmondson committed Oct 5, 2018
1 parent faf71b8 commit 0573f4b
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 0 deletions.
4 changes: 4 additions & 0 deletions port/python/src/Madara.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -77,10 +77,14 @@ BOOST_PYTHON_MODULE(madara)

def("to_pylongs", &stl_to_python<std::vector<int64_t>>);

def("to_pystrings", &stl_to_python<std::vector<std::string>>);

def("from_pydoubles", &python_to_stl<std::vector<double>>);

def("from_pylongs", &python_to_stl<std::vector<int64_t>>);

def("from_pystrings", &python_to_stl<std::vector<std::string>>);

define_filters();
define_transport();
define_knowledge();
Expand Down
20 changes: 20 additions & 0 deletions port/python/src/MadaraKnowledge.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2057,6 +2057,26 @@ void define_knowledge(void)
m_send_modifieds_0_of_2(args("prefix", "settings"),
"Sends all modified variables through the attached transports."))

// sets a knowledge record to a specified value
.def("set",
static_cast<int (madara::knowledge::KnowledgeBase::*)(
const VariableReference &,
const KnowledgeRecord &,
const EvalSettings & )>(
&madara::knowledge::KnowledgeBase::set),
m_set_2_of_3(args("key", "value", "settings"),
"Atomically sets the value of a variable to a KnowledgeRecord."))

// sets a knowledge record to a specified value
.def("set",
static_cast<int (madara::knowledge::KnowledgeBase::*)(
const std::string &,
const KnowledgeRecord &,
const EvalSettings & )>(
&madara::knowledge::KnowledgeBase::set),
m_set_2_of_3(args("key", "value", "settings"),
"Atomically sets the value of a variable to a KnowledgeRecord."))

// sets a knowledge record to a double
.def("set",
static_cast<int (madara::knowledge::KnowledgeBase::*)(
Expand Down

0 comments on commit 0573f4b

Please sign in to comment.