|
YARP
Yet Another Robot Platform
|
|
Go to the documentation of this file.
19 #define CONNECTION_TIMEOUT 5.0 //seconds
33 const char *at = txt.c_str();
38 result.
addString(std::string(at,len-slash_tweak));
44 slash_tweak = (ch==
slash && len>0)?1:0;
48 result.
addString(std::string(at,len-slash_tweak));
55 fp = fopen(fname,
"r");
66 bool ScriptLocalBroker::init(
const char* szcmd,
const char* szparam,
67 const char* szhost,
const char* szstdio,
68 const char* szworkdir,
const char* szenv )
76 for (
size_t i=0; i<possiblePaths.
size(); ++i)
78 std::string guessString=possiblePaths.
get(i).
asString() +
79 std::string{
slash} + szcmd;
80 const char* guess=guessString.c_str();
84 strCmd =
"\"" + std::string(guess) +
"\"";
95 if(szparam) strParam = szparam;
96 strDevParam<<strCmd<<
" "<<strParam;
97 return LocalBroker::init(script.c_str(), strDevParam.str().c_str(),
98 szhost, szstdio, szworkdir, szenv);
102 bool ScriptYarprunBroker::whichFile(
const char* server,
const char* filename, std::string& filenameWithPath)
127 bool ret = port.
write(msg, filenameReader);
128 filenameWithPath=filenameReader.
asString();
139 bool ScriptYarprunBroker::init(
const char* szcmd,
const char* szparam,
140 const char* szhost,
const char* szstdio,
141 const char* szworkdir,
const char* szenv )
145 std::string strParam;
151 strHost = string(
"/") + string(szhost);
154 whichFile(strHost.c_str(), szcmd, strCmd);
156 if(szparam) strParam = szparam;
157 strDevParam<<strCmd<<
" "<<strParam;
158 return YarpBroker::init(script.c_str(), strDevParam.str().c_str(),
159 szhost, szstdio, szworkdir, szenv);
void close() override
Stop port activity.
A simple collection of objects that can be described and transmitted in a portable way.
void clear()
Empties the bottle of any objects it contains.
size_type size() const
Gets the number of elements in the bottle.
std::string getEnvironment(const char *key, bool *found=nullptr)
Read a variable from the environment.
static bool fileExists(const char *fname)
std::stringstream OSTRINGSTREAM
static constexpr value_type path_separator
#define CONNECTION_TIMEOUT
bool open(const std::string &name) override
Start port operation, with a specific name, with automatically-chosen network parameters.
constexpr fs::value_type slash
A mini-server for network communication.
Value & get(size_type index) const
Reads a Value v from a certain part of the list.
Bottle & addList()
Places an empty nested list in the bottle, at the end of the list.
virtual std::string asString() const
Get string value.
static bool connect(const std::string &src, const std::string &dest, const std::string &carrier="", bool quiet=true)
Request that an output port connect to an input port.
void addString(const char *str)
Places a string in the bottle, at the end of the list.
static Bottle parsePaths(const std::string &txt)
bool write(const PortWriter &writer, const PortWriter *callback=nullptr) const override
Write an object to the port.
An interface to the operating system, including Port based communication.
static constexpr value_type preferred_separator
A single value (typically within a Bottle).
constexpr fs::value_type sep
static bool disconnect(const std::string &src, const std::string &dest, bool quiet)
Request that an output port disconnect from an input port.