RInside Version 0.2.12
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
RInsideClient Class Reference

#include <rinsideclient.h>

Collaboration diagram for RInsideClient:

Public Member Functions

 RInsideClient (BinaryStream &stream)
 
 ~RInsideClient ()
 
void parseEvalQ (const std::string &code)
 
template<typename T >
parseEval (const std::string &code)
 
template<typename T >
void setValue (const std::string &name, const T &value)
 
template<typename T >
getValue (const std::string &name)
 
template<typename R , typename... Params>
void setCallback (const std::string &name, std::function< R(Params...)> &callback)
 
std::string getConsoleOutput ()
 
void initPlot (uint32_t width=800, uint32_t height=600)
 
std::string getPlot ()
 

Private Member Functions

void runScript (const std::string code, int32_t result_typeid)
 
void writeCommand (char command)
 
char readReply (bool accept_ok=true, bool accept_value=false)
 
void unrecoverable_error (const std::string &error)
 

Private Attributes

BinaryStream stream
 
uint32_t next_callback_id
 
std::map< uint32_t,
std::function< void(void)> > 
callbacks
 
bool had_unrecoverable_error
 
bool can_send_command
 

Detailed Description

Definition at line 19 of file rinsideclient.h.

Constructor & Destructor Documentation

RInsideClient::RInsideClient ( BinaryStream stream)

Definition at line 12 of file rinsideclient.cpp.

References can_send_command, RIS_MAGIC_NUMBER, stream, and BinaryStream::write().

Here is the call graph for this function:

RInsideClient::~RInsideClient ( )

Definition at line 17 of file rinsideclient.cpp.

References can_send_command, had_unrecoverable_error, RIS_CMD_EXIT, stream, and BinaryStream::write().

Here is the call graph for this function:

Member Function Documentation

std::string RInsideClient::getConsoleOutput ( )

Definition at line 70 of file rinsideclient.cpp.

References can_send_command, BinaryStream::read(), readReply(), RIS_CMD_GETCONSOLE, stream, and writeCommand().

Referenced by test_console_output().

Here is the call graph for this function:

std::string RInsideClient::getPlot ( )

Definition at line 87 of file rinsideclient.cpp.

References can_send_command, BinaryStream::read(), readReply(), RIS_CMD_GETPLOT, stream, and writeCommand().

Referenced by test_plot().

Here is the call graph for this function:

template<typename T >
T RInsideClient::getValue ( const std::string &  name)
inline

Definition at line 49 of file rinsideclient.h.

References can_send_command, BinaryStream::read(), readReply(), RIS_CMD_GETVALUE, unrecoverable_error(), BinaryStream::write(), and writeCommand().

Referenced by test_multiple(), and test_setting_getting().

Here is the call graph for this function:

void RInsideClient::initPlot ( uint32_t  width = 800,
uint32_t  height = 600 
)

Definition at line 79 of file rinsideclient.cpp.

References can_send_command, readReply(), RIS_CMD_INITPLOT, stream, BinaryStream::write(), and writeCommand().

Referenced by test_plot().

Here is the call graph for this function:

template<typename T >
T RInsideClient::parseEval ( const std::string &  code)
inline

Definition at line 30 of file rinsideclient.h.

References can_send_command, BinaryStream::read(), and runScript().

Referenced by test_callbacks(), and test_setting_getting().

Here is the call graph for this function:

void RInsideClient::parseEvalQ ( const std::string &  code)
inline

Definition at line 25 of file rinsideclient.h.

References can_send_command, and runScript().

Referenced by test_console_output(), and test_plot().

Here is the call graph for this function:

char RInsideClient::readReply ( bool  accept_ok = true,
bool  accept_value = false 
)
private

Definition at line 105 of file rinsideclient.cpp.

References can_send_command, BinaryStream::read(), RIS_REPLY_ERROR, RIS_REPLY_OK, RIS_REPLY_VALUE, stream, and unrecoverable_error().

Referenced by getConsoleOutput(), getPlot(), getValue(), initPlot(), setCallback(), and setValue().

Here is the call graph for this function:

void RInsideClient::runScript ( const std::string  code,
int32_t  result_typeid 
)
private
template<typename R , typename... Params>
void RInsideClient::setCallback ( const std::string &  name,
std::function< R(Params...)> &  callback 
)
inline

Definition at line 65 of file rinsideclient.h.

References callbacks, can_send_command, next_callback_id, readReply(), RIS_CMD_SETCALLBACK, BinaryStream::write(), and writeCommand().

Referenced by test_callbacks().

Here is the call graph for this function:

template<typename T >
void RInsideClient::setValue ( const std::string &  name,
const T &  value 
)
inline

Definition at line 38 of file rinsideclient.h.

References can_send_command, readReply(), RIS_CMD_SETVALUE, BinaryStream::write(), and writeCommand().

Referenced by test_multiple(), and test_setting_getting().

Here is the call graph for this function:

void RInsideClient::unrecoverable_error ( const std::string &  error)
private

Definition at line 120 of file rinsideclient.cpp.

References had_unrecoverable_error.

Referenced by getValue(), readReply(), and runScript().

void RInsideClient::writeCommand ( char  command)
private

Definition at line 95 of file rinsideclient.cpp.

References can_send_command, had_unrecoverable_error, stream, and BinaryStream::write().

Referenced by getConsoleOutput(), getPlot(), getValue(), initPlot(), runScript(), setCallback(), and setValue().

Here is the call graph for this function:

Member Data Documentation

std::map<uint32_t, std::function<void(void)> > RInsideClient::callbacks
private

Definition at line 98 of file rinsideclient.h.

Referenced by runScript(), and setCallback().

bool RInsideClient::can_send_command
private
bool RInsideClient::had_unrecoverable_error
private

Definition at line 99 of file rinsideclient.h.

Referenced by runScript(), unrecoverable_error(), writeCommand(), and ~RInsideClient().

uint32_t RInsideClient::next_callback_id
private

Definition at line 97 of file rinsideclient.h.

Referenced by setCallback().

BinaryStream RInsideClient::stream
private

The documentation for this class was generated from the following files: