Skip to content

Commit

Permalink
Added read_file and various other methods (#81)
Browse files Browse the repository at this point in the history
  • Loading branch information
ssabatier authored and jredmondson committed Sep 18, 2018
1 parent 3d396cf commit c295d28
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 0 deletions.
2 changes: 2 additions & 0 deletions port/python/src/FunctionDefaults.h
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,8 @@ BOOST_PYTHON_MEMBER_FUNCTION_OVERLOADS (m_from_kb_2_of_3,
BOOST_PYTHON_MEMBER_FUNCTION_OVERLOADS (m_read_file_1_of_2,
read_file, 1, 2)

BOOST_PYTHON_MEMBER_FUNCTION_OVERLOADS (m_read_file_2_of_3,
read_file, 2, 3)

/********************************************************
* Static functions (standalone functions)
Expand Down
24 changes: 24 additions & 0 deletions port/python/src/MadaraKnowledge.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1177,6 +1177,30 @@ void define_knowledge (void)
args("level"),
"Alias of print(level). Prints all variables in the knowledge base"))

// reading a file
.def( "read_file",
static_cast<
int (madara::knowledge::KnowledgeBase::*)(
const std::string &,
const std::string &,
const madara::knowledge::EvalSettings & )
> (&madara::knowledge::KnowledgeBase::read_file),
m_read_file_2_of_3 (
args("knowledge_key", "filename", "settings"),
"Read a file into the knowledge base"))

// reading a file
.def( "read_file",
static_cast<
int (madara::knowledge::KnowledgeBase::*)(
const madara::knowledge::VariableReference &,
const std::string &,
const madara::knowledge::EvalSettings & )
> (&madara::knowledge::KnowledgeBase::read_file),
m_read_file_2_of_3 (
args("variable","filename", "settings"),
"Read a file into the knowledge base"))

// get a knowledge record at an index
.def( "retrieve_index",
static_cast<
Expand Down

0 comments on commit c295d28

Please sign in to comment.