20 bHasUpdateCallback(
false),
21 bHasUpdateReplyCallback(
false),
35 registerExtraFunctions();
48 if(getLocalFunction(
"destroy"))
101 if(getLocalFunction(
"create"))
129 bHasAcceptCallback = getLocalFunction(
"accept");
133 bHasUpdateCallback = getLocalFunction(
"update");
137 bHasUpdateReplyCallback = getLocalFunction(
"update_reply");
146 if(getLocalFunction(
"accept"))
184 if(getLocalFunction(
"update"))
231 if(getLocalFunction(
"update_reply"))
278 if(getLocalFunction(
"setparam"))
311 if(getLocalFunction(
"getparam"))
358 if(getLocalFunction(
"trig"))
377bool MonitorLua::getLocalFunction(
const char *name)
385bool MonitorLua::registerExtraFunctions()
387#if LUA_VERSION_NUM > 501
403 if (constraint ==
"") {
428 std::string value = (
record.hasEvent(
token.c_str())) ?
"true" :
"false";
461inline void MonitorLua::searchReplace(std::string& str,
const std::string&
oldStr,
const std::string&
newStr)
464 while((pos = str.find(
oldStr, pos)) != std::string::npos)
471inline void MonitorLua::trimString(std::string& str)
473 std::string::size_type pos = str.find_last_not_of(
' ');
474 if(pos != std::string::npos) {
476 pos = str.find_first_not_of(
' ');
477 if (pos != std::string::npos) {
481 str.erase(str.begin(), str.end());
485inline bool MonitorLua::isKeyword(
const char* str)
491 std::string
token = str;
503int MonitorLua::setConstraint(
lua_State* L)
517 owner->setAcceptConstraint(
cst);
522int MonitorLua::getConstraint(
lua_State* L)
540 double lifetime = -1.0;
599int MonitorLua::setTrigInterval(
lua_State* L)
627 if(owner->trigger ==
nullptr) {
629 owner->trigger->start();
635#if LUA_VERSION_NUM > 501
640 {
"setConstraint", MonitorLua::setConstraint},
641 {
"getConstraint", MonitorLua::getConstraint},
642 {
"setEvent", MonitorLua::setEvent},
643 {
"unsetEvent", MonitorLua::unsetEvent},
644 {
"setTrigInterval", MonitorLua::setTrigInterval},
const yarp::os::LogComponent & PORTMONITORCARRIER()
A singleton class to record the port monitor events.
static MonitorEventRecord & getInstance()
A mini-server for performing network communication in the background.
void stop()
Call this to stop the thread, this call blocks until the thread is terminated (and releaseThread() ca...
A class for storing options and configuration information.
Value & find(const std::string &key) const override
Gets a value corresponding to a given keyword.
Base class for generic things.
virtual std::string asString() const
Get string value.
#define yCError(component,...)
#define yCAssert(component, x)
#define yCTrace(component,...)
An interface to the operating system, including Port based communication.
MonitorLua()
Class MonitorLua.
bool getParams(yarp::os::Property ¶ms) override
bool setParams(const yarp::os::Property ¶ms) override
bool canAccept() override
bool acceptData(yarp::os::Things &thing) override
yarp::os::Things & updateReply(yarp::os::Things &thing) override
bool peerTrigged() override
yarp::os::Things & updateData(yarp::os::Things &thing) override
bool load(const yarp::os::Property &options) override
static int SWIG_Lua_ConvertPtr(lua_State *L, int index, void **ptr, swig_type_info *type, int flags)
#define SWIG_NewPointerObj(L, ptr, type, owner)
static swig_type_info * SWIG_TypeQuery(lua_State *clientdata, const char *name)