6#ifndef YARP_MANAGER_MODULE_H
7#define YARP_MANAGER_MODULE_H
23 Author(
const char* name,
const char* email) {
24 if(name) { strName = name;}
25 if(email) { strEmail = email; }
29 void setName(
const char* name) {
if(name) { strName = name; } }
30 void setEmail(
const char* email) {
if(email) { strEmail = email; } }
31 const char*
getName() {
return strName.c_str(); }
32 const char*
getEmail() {
return strEmail.c_str(); }
35 return (strName == alt.strName);
49 Argument(
const char* szParam,
bool required=
false,
50 const char* szDesc=
nullptr,
bool _switch=
false) {
51 if(szParam) { strParam = szParam; }
52 if(szDesc) { strDesc = szDesc; }
55 if(bSwitch) { strDefault =
"off"; }
56 strValue = strDefault;
60 void setParam(
const char* szParam) {
if(szParam) { strParam = szParam; } }
61 void setDefault(
const char* szDefault) {
if(szDefault) { strDefault = szDefault; } }
62 void setValue(
const char* szValue) {
if(szValue) { strValue = szValue; } }
64 const char*
getParam() {
return strParam.c_str(); }
65 const char*
getValue() {
return strValue.c_str(); }
70 return (strParam == alt.strParam);
78 std::string strDefault;
103 Module(
const char* szName);
109 void setName(
const char* szName) {
if(szName) { strName = szName; } }
111 void setVersion(
const char* szVersion) {
if(szVersion) { strVersion = szVersion; } }
112 void setDescription(
const char* szDesc) {
if(szDesc) { strDescription = szDesc; } }
113 void setHost(
const char* szHost) {
if(szHost) { strHost = szHost; } }
117 void setXmlFile(
const char* szFilename) {
if(szFilename) { strXmlFile = szFilename;} }
118 void setWorkDir(
const char* szWDir) {
if(szWDir) { strWorkDir = szWDir; } }
119 void setStdio(
const char* szStdio) {
if(szStdio) { strStdio = szStdio; } }
120 void setBroker(
const char* szBroker) {
if(szBroker) { strBroker = szBroker; } }
121 void setPrefix(
const char* szPrefix) {
if(szPrefix) { strPrefix = szPrefix; } }
123 void setBasePrefix(
const char* szPrefix) {
if(szPrefix) { strBasePrefix = szPrefix; } }
125 void setDisplay(
const char* szDisplay) {
if(szDisplay) { strDisplay = szDisplay; } }
128 const char*
getName() {
return strName.c_str(); }
131 const char*
getHost() {
return strHost.c_str(); }
135 const char*
getParam() {
return strParam.c_str(); }
138 const char*
getStdio() {
return strStdio.c_str(); }
197 std::string strVersion;
198 std::string strDescription;
208 std::string strParam;
209 std::string strXmlFile;
210 std::string strWorkDir;
211 std::string strStdio;
212 std::string strBroker;
214 std::string strPrefix;
215 std::string strEnvironment;
216 std::string strBasePrefix;
219 std::string strDisplay;
226 void swap(
const Module &mod);
227 bool getParamValue(
const char* key,
bool bSwitch, std::string ¶m);
234#define PRINT_MODULE(m)\
236 std::cout<<"Name : "<<m->getName()<<'\n';\
237 std::cout<<"Desc : "<<m->getDescription()<<'\n';\
238 std::cout<<"Version : "<<m->getVersion()<<'\n';\
239 std::cout<<"Rank : "<<m->getRank()<<'\n';\
240 std::cout<<"Param : "<<'\n';\
241 for(int i=0; i<m->argumentCount(); i++)\
243 std::cout<<" "<<m->getArgumentAt(i).getParam()<<" (";\
244 std::cout<<m->getArgumentAt(i).getDescription()<<")"<<'\n';\
246 std::cout<<"Authors : "<<'\n';\
247 for(int i=0; i<m->authorCount(); i++)\
248 std::cout<<" "<<m->getAuthorAt(i).getName()<<" ("<<m->getAuthorAt(i).getEmail()<<")"<<'\n';\
253 std::cout<<"Inputs : "<<'\n';\
254 for(int i=0; i<m->inputCount(); i++)\
256 std::cout<<" "<<m->getInputAt(i).getName()\
257 <<", "<<m->getInputAt(i).getPort();\
258 if(m->getInputAt(i).isRequired())\
259 std::cout<<", [REQUIRED]";\
260 if(m->getInputAt(i).withPriority())\
261 std::cout<<", [PRIORITY]";\
264 std::cout<<"Outputs : "<<'\n';\
265 for(int i=0; i<m->outputCount(); i++)\
266 std::cout<<" "<<m->getOutputAt(i).getName()\
267 <<", "<<m->getOutputAt(i).getPort()<<'\n';\
const char * getDefault()
void setDefault(const char *szDefault)
Argument(const char *szParam, bool required=false, const char *szDesc=nullptr, bool _switch=false)
bool operator==(const Argument &alt) const
void setValue(const char *szValue)
void setParam(const char *szParam)
const char * getDescription()
void setName(const char *name)
bool operator==(const Author &alt) const
Author(const char *name, const char *email)
void setEmail(const char *email)
bool removeInput(InputData &input)
bool removeOutput(OutputData &output)
void setStdio(const char *szStdio)
bool removeResource(GenericResource &res)
Argument & getArgumentAt(int index)
GraphicModel & getModelBase()
void setWorkDir(const char *szWDir)
void setXmlFile(const char *szFilename)
void setEnvironment(const char *szEnv)
void setHost(const char *szHost)
bool removeAuthor(Author &author)
void setNeedDeployer(bool need)
const char * getBasePrefix()
const char * getWorkDir()
void setForced(bool flag)
void setDescription(const char *szDesc)
InputData & getInputAt(int index)
void setPrefix(const char *szPrefix)
int resourceCount() const
void setModelBase(GraphicModel &mdl)
void addAuthor(Author &author)
const char * getDisplay()
const char * getDescription()
bool removeArgument(Argument &argument)
bool setParam(const char *szParam)
void setPostStopWait(double t)
void setName(const char *szName)
void setBasePrefix(const char *szPrefix)
Author & getAuthorAt(int index)
OutputData & getOutputAt(int index)
void setBroker(const char *szBroker)
bool addArgument(Argument &arg)
Module & operator=(const Module &rhs)
const char * getXmlFile()
GenericResource & getResourceAt(int index) const
bool addInput(InputData &input)
void setOwner(Node *owner)
const char * getEnvironment()
bool addResource(GenericResource &res)
const char * getVersion()
void setPostExecWait(double t)
bool addOutput(OutputData &output)
void setVersion(const char *szVersion)
void setDisplay(const char *szDisplay)
std::vector< InputData > InputContainer
std::vector< Author >::iterator AuthorIterator
std::vector< GenericResource * >::iterator ResourcePIterator
std::vector< OutputData > OutputContainer
std::vector< InputData >::iterator InputIterator
std::vector< Module * > ModulePContainer
std::vector< Argument > ArgumentContainer
std::vector< Author > AuthorContainer
std::vector< GenericResource * > ResourcePContainer
std::vector< OutputData >::iterator OutputIterator
std::vector< Module * >::iterator ModulePIterator
std::vector< Argument >::iterator ArgumentIterator