43 # if defined(_POSIX_VERSION) 44 # define USE_SIGNALS 1 51 #include <boost/algorithm/string.hpp> 60 #undef _POSIX_C_SOURCE 61 #include <sys/types.h> 85 #if defined(USE_SIGNALS) 87 void ctrl_c_catcher(
int sig)
94 #define ORO_str(s) ORO__str(s) 95 #define ORO__str(s) #s 100 autoUnload(
"AutoUnload",
101 "Stop, cleanup and unload all components loaded by the DeploymentComponent when it is destroyed.",
103 validConfig(
"Valid", false),
112 this->
addProperty(
"RTT_COMPONENT_PATH",
compPath ).doc(
"Locations to look for components. Use a colon or semi-colon separated list of paths. Defaults to the environment variable with the same name.");
113 this->
addProperty(
"DefaultWaitPeriodPolicy",
defaultWaitPeriodPolicy ).doc(
"The default value for the wait period policy property for threads of newly created activities (ORO_WAIT_ABS or ORO_WAIT_REL).");
124 this->
addOperation(
"reloadLibrary", &
DeploymentComponent::reloadLibrary,
this,
ClientThread).doc(
"Reload a new component library into memory.").arg(
"FilePath",
"The absolute file name of the to be reloaded library. Warning: this is a low-level function only to be used during development/testing.");
125 this->
addOperation(
"loadLibrary", &
DeploymentComponent::loadLibrary,
this,
ClientThread).doc(
"Load a new library (component, plugin or typekit) into memory.").arg(
"Name",
"The absolute or relative name of the to be loaded library. Warning: this is a low-level function you should only use if import() doesn't work for you.");
126 this->
addOperation(
"import", &
DeploymentComponent::import,
this,
ClientThread).doc(
"Import all components, plugins and typekits from a given package or directory in the search path.").arg(
"Package",
"The name absolute or relative name of a directory or package.");
127 this->
addOperation(
"path", &
DeploymentComponent::path,
this,
ClientThread).doc(
"Add additional directories to the component search path without importing them.").arg(
"Paths",
"A colon or semi-colon separated list of paths to search for packages.");
134 this->
provides()->removeOperation(
"loadService");
135 this->
addOperation(
"loadService", &
DeploymentComponent::loadService,
this,
ClientThread).doc(
"Load a discovered service or plugin in an existing component.").arg(
"Name",
"The name of the component which will receive the service").arg(
"Service",
"The name of the service or plugin.");
156 this->
addOperation(
"kickOut", &
DeploymentComponent::kickOut,
this,
ClientThread).doc(
"Calls stopComponents, cleanupComponents and unloadComponents in a row.").arg(
"File",
"The file which contains the name of the components to kickOut (for example, the same used in kickStart).");
159 this->
addOperation(
"waitForSignal", &
DeploymentComponent::waitForSignal,
this,
ClientThread).doc(
"This operation waits for the signal of the argument and then returns. This allows you to wait in a script for any signal except SIGKILL and SIGSTOP.").arg(
"signal number",
"The signal number to wait for.");
165 this->
addOperation(
"connectPeers", cp,
this,
ClientThread).doc(
"Connect two Components known to this Component.").arg(
"One",
"The first component.").arg(
"Two",
"The second component.");
167 this->
addOperation(
"connectPorts", cp,
this,
ClientThread).doc(
"DEPRECATED. Connect the Data Ports of two Components known to this Component.").arg(
"One",
"The first component.").arg(
"Two",
"The second component.");
169 const std::string&,
const std::string&);
171 this->
addOperation(
"connectTwoPorts", cp4,
this,
ClientThread).doc(
"DEPRECATED. Connect two ports of Components known to this Component.")
172 .arg(
"One",
"The first component.")
173 .arg(
"PortOne",
"The port name of the first component.")
174 .arg(
"Two",
"The second component.")
175 .arg(
"PortTwo",
"The port name of the second component.");
177 .arg(
"component",
"The component which owns 'port'.")
178 .arg(
"port",
"The port to create a stream from or to.")
179 .arg(
"policy",
"The connection policy which serves to describe the stream to be created.");
183 .arg(
"portOne",
"The first port of the connection. Use a dot-separated-path.")
184 .arg(
"portTwo",
"The second port of the connection. Use a dot-separated-path.")
185 .arg(
"policy",
"The connection policy which serves to describe the stream to be created. Use 'ConnPolicy()' to use the default.");
187 .arg(
"port",
"The port to create a stream from or to. Use a dot-separated-path.")
188 .arg(
"policy",
"The connection policy which serves to describe the stream to be created. Use 'ConnPolicy()' to use the default.");
191 this->
addOperation(
"connectOperations", &
DeploymentComponent::connectOperations,
this,
ClientThread).doc(
"Connect the matching provides/requires operations of two Components known to this Component.").arg(
"Requested",
"The requested operation (dot-separated path).").arg(
"Provided",
"The provided operation (dot-separated path).");
194 this->
addOperation(
"addPeer", cp,
this,
ClientThread).doc(
"Add a peer to a Component.").arg(
"From",
"The first component.").arg(
"To",
"The other component.");
195 this->
addOperation(
"aliasPeer", &
DeploymentComponent::aliasPeer,
this,
ClientThread).doc(
"Add a peer to a Component with an alternative name.").arg(
"From",
"The component which will see 'To' in its peer list.").arg(
"To",
"The component which will be seen by 'From'.").arg(
"Alias",
"The name under which 'To' is known to 'From'");
198 this->
addOperation(
"removePeer", rp,
this,
ClientThread).doc(
"Remove a peer from this Component.").arg(
"PeerName",
"The name of the peer to remove.");
200 this->
addOperation(
"setActivity", &
DeploymentComponent::setActivity,
this,
ClientThread).doc(
"Attach an activity to a Component.").arg(
"CompName",
"The name of the Component.").arg(
"Period",
"The period of the activity (set to 0.0 for non periodic).").arg(
"Priority",
"The priority of the activity.").arg(
"SchedType",
"The scheduler type of the activity.");
201 this->
addOperation(
"setActivityOnCPU", &
DeploymentComponent::setActivityOnCPU,
this,
ClientThread).doc(
"Attach an activity to a Component.").arg(
"CompName",
"The name of the Component.").arg(
"Period",
"The period of the activity (set to 0.0 for non periodic).").arg(
"Priority",
"The priority of the activity.").arg(
"SchedType",
"The scheduler type of the activity.").arg(
"CPU",
"The CPU to run on, starting from zero.");
202 this->
addOperation(
"setPeriodicActivity", &
DeploymentComponent::setPeriodicActivity,
this,
ClientThread).doc(
"Attach a periodic activity to a Component.").arg(
"CompName",
"The name of the Component.").arg(
"Period",
"The period of the activity.").arg(
"Priority",
"The priority of the activity.").arg(
"SchedType",
"The scheduler type of the activity.");
205 this->
addOperation(
"setMasterSlaveActivity", &
DeploymentComponent::setMasterSlaveActivity,
this,
ClientThread).doc(
"Attach a slave activity with a master to a Component. The slave becomes a peer of the master as well.").arg(
"Master",
"The name of the Component which is master of the Slave.").arg(
"Slave",
"The name of the Component which gets the SlaveActivity.");
207 .doc(
"Attach a File Descriptor activity to a Component.")
208 .arg(
"CompName",
"The name of the Component.")
209 .arg(
"Timeout",
"The timeout of the activity (set to zero for no timeout).")
210 .arg(
"Priority",
"The priority of the activity.")
211 .arg(
"SchedType",
"The scheduler type of the activity.");
215 valid_names.insert(
"AutoUnload");
216 valid_names.insert(
"UseNamingService");
217 valid_names.insert(
"Server");
218 valid_names.insert(
"AutoConf");
219 valid_names.insert(
"AutoStart");
220 valid_names.insert(
"AutoConnect");
221 valid_names.insert(
"AutoSave");
222 valid_names.insert(
"PropertyFile");
223 valid_names.insert(
"UpdateProperties");
224 valid_names.insert(
"LoadProperties");
225 valid_names.insert(
"ProgramScript");
226 valid_names.insert(
"StateMachineScript");
227 valid_names.insert(
"Ports");
228 valid_names.insert(
"Peers");
229 valid_names.insert(
"Activity");
230 valid_names.insert(
"Master");
231 valid_names.insert(
"Properties");
232 valid_names.insert(
"Service");
233 valid_names.insert(
"Plugin");
234 valid_names.insert(
"Provides");
235 valid_names.insert(
"RunScript");
238 if (siteFile.empty())
239 siteFile = this->
getName() +
"-site.cpf";
240 std::ifstream hassite(siteFile.c_str());
246 log(
Info) <<
"No site file was found. Importing 'ocl' by default." <<endlog();
249 }
catch (std::exception& e) {
256 log(
Info) <<
"Using site file '" << siteFile <<
"'." << endlog();
263 Logger::In in(
"configure");
268 log(
Info) <<
"RTT_COMPONENT_PATH was set to " <<
compPath << endlog();
269 log(
Info) <<
"Re-scanning for plugins and components..."<<endlog();
270 PluginLoader::Instance()->setPluginPath(
compPath);
290 int sigs[] = { SIGINT, SIGTERM, SIGHUP };
293 cout <<
"DeploymentComponent: Got interrupt !" <<
endl;
303 struct sigaction sa, sold[sig_count];
304 std::size_t index = 0;
305 sa.sa_handler = ctrl_c_catcher;
306 for( ; index < sig_count; ++index) {
307 if ( ::sigaction(sigs[index], &sa, &sold[index]) != 0) {
308 cout <<
"DeploymentComponent: Failed to install signal handler for signal " << sigs[index] <<
endl;
313 if (index == sig_count) {
314 bool break_loop =
false;
316 for(std::size_t check = 0; check < sig_count; ++check) {
317 if (got_signal == sigs[check]) break_loop =
true;
330 if (sold[index].sa_handler || sold[index].sa_sigaction) {
331 ::sigaction(sigs[index], &sold[index], NULL);
336 cout <<
"DeploymentComponent: Failed to install signal handler for signal " << sig <<
": Not supported by this Operating System. "<<
endl;
347 log(
Error)<<
"No such peer: "<<one<<endlog();
351 log(
Error) <<
"No such peer: "<<other<<endlog();
363 log(
Error)<<
"No such peer: "<<from<<endlog();
367 log(
Error)<<
"No such peer: "<<to<<endlog();
371 log(
Info) <<
"addPeer: "<< to <<
" is already a peer of " << from << endlog();
383 log(
Error)<<
"No such peer known to deployer '"<< this->
getName()<<
"': "<<from<<endlog();
387 log(
Error)<<
"No such peer known to deployer '"<< this->
getName()<<
"': "<<to<<endlog();
394 std::vector<std::string> strs;
395 boost::split(strs, names, boost::is_any_of(
"."));
400 string component = strs.front();
403 log(
Error) <<
"No such component: '"<< component <<
"'";
404 if ( names.find(
'.') != string::npos )
405 log(
Error) <<
" when looking for service '" << names <<
" '";
413 strs.erase( strs.begin() );
416 while ( !strs.empty() && ret) {
417 ret = ret->getService( strs.front() );
419 strs.erase( strs.begin() );
422 log(
Error) <<
"No such service: '"<< strs.front() <<
"' while looking for service '"<< names<<
"'"<<endlog();
428 std::vector<std::string> strs;
429 boost::split(strs, names, boost::is_any_of(
"."));
431 string component = strs.front();
434 log(
Error) <<
"No such component: '"<< component <<
"'" <<endlog();
435 if ( names.find(
'.') != string::npos )
436 log(
Error)<<
" when looking for service '" << names <<
"'" <<endlog();
443 strs.erase( strs.begin() );
446 while ( !strs.empty() && ret) {
447 ret = ret->requires( strs.front() );
449 strs.erase( strs.begin() );
452 log(
Error) <<
"No such service: '"<< strs.front() <<
"' while looking for service '"<< names<<
"'"<<endlog();
458 std::vector<std::string> strs;
459 boost::split(strs, names, boost::is_any_of(
"."));
462 if (strs.empty())
return 0;
464 string component = strs.front();
467 log(
Error) <<
"No such component: '"<< component <<
"'" ;
468 log(
Error)<<
" when looking for port '" << names <<
"'" <<endlog();
476 strs.erase( strs.begin() );
479 while ( strs.size() != 1 && serv) {
480 serv = serv->getService( strs.front() );
482 strs.erase( strs.begin() );
485 log(
Error) <<
"No such service: '"<< strs.front() <<
"' while looking for port '"<< names<<
"'"<<endlog();
488 ret = serv->getPort(strs.front());
490 log(
Error) <<
"No such port: '"<< strs.front() <<
"' while looking for port '"<< names<<
"'"<<endlog();
503 log(
Error) << one <<
" could not be found."<< endlog();
507 log(
Error) << other <<
" could not be found."<< endlog();
515 const std::string&
other,
const std::string& other_port)
524 ap = a->getPort(one_port);
525 bp = b->getPort(other_port);
527 log(
Error) << one <<
" does not have a port "<<one_port<< endlog();
531 log(
Error) << other <<
" does not have a port "<<other_port<< endlog();
537 log(
Debug) <<
"Port '"<< ap->
getName() <<
"' of Component '"<<a->getName()
538 <<
"' and port '"<< bp->
getName() <<
"' of Component '"<<b->getName()
539 <<
"' are already connected but (probably) not to each other. Connecting them anyway."<<endlog();
545 log(
Info)<<
"Connected Port " << one +
"." + one_port <<
" to "<< other +
"." + other_port <<
"." << endlog();
548 log(
Error)<<
"Failed to connect Port " << one +
"." + one_port <<
" to "<< other +
"." + other_port <<
"." << endlog();
558 PortInterface* porti = serv->getPort(port);
560 log(
Error) <<
"Service in component "<<comp<<
" has no port "<< port <<
"."<< endlog();
563 return porti->createStream( policy );
578 log(
Debug) <<
"Port '"<< ap->
getName() <<
"' of '"<< one
579 <<
"' and port '"<< bp->
getName() <<
"' of '"<< other
580 <<
"' are already connected but (probably) not to each other. Connecting them anyway."<<endlog();
586 log(
Info)<<
"Connected Port " << one <<
" to "<< other <<
"." << endlog();
589 log(
Error)<<
"Failed to connect Port " << one <<
" to "<< other <<
"." << endlog();
610 log(
Error) << one <<
" could not be found."<< endlog();
614 log(
Error) << other <<
" could not be found."<< endlog();
625 boost::iterator_range<std::string::const_iterator> reqs = boost::algorithm::find_last(required,
".");
626 std::string reqs_name(required.begin(), reqs.begin());
627 std::string rop_name(reqs.begin()+1, required.end());
628 log(
Debug) <<
"Looking for required operation " << rop_name <<
" in service " << reqs_name << endlog();
631 boost::iterator_range<std::string::const_iterator> pros = boost::algorithm::find_last(provided,
".");
632 std::string pros_name(provided.begin(), pros.begin());
633 std::string pop_name(pros.begin()+1, provided.end());
634 log(
Debug) <<
"Looking for provided operation " << pop_name <<
" in service " << pros_name << endlog();
639 log(
Error) <<
"No requested operation " << rop_name <<
" found in service " << reqs_name << endlog();
642 if ( rop->
ready() ) {
643 log(
Error) <<
"Requested operation " << rop_name <<
" already connected to a provided operation!" << endlog();
647 if (! p->hasOperation(pop_name)) {
648 log(
Error) <<
"No provided operation " << pop_name <<
" found in service " << pros_name << endlog();
652 rop->
setImplementation(p->getLocalOperation( pop_name ), r->getServiceOwner()->engine());
654 log(
Debug) <<
"Successfully set up OperationCaller for operation " << rop_name << endlog();
659 if ( sched ==
"ORO_SCHED_OTHER" )
661 if (sched ==
"ORO_SCHED_RT" )
663 log(
Error)<<
"Unknown scheduler type: "<< sched <<endlog();
669 const char* tmpfile =
".loadConfigurationString.cpf";
670 std::ofstream file( tmpfile );
671 file << text.c_str();
679 if (file_name.rfind(
".lua") == file_name.length() - 4) {
680 if (!this->
provides()->hasService(
"Lua")) {
689 this->
provides(
"Lua")->getOperation(
"exec_str");
692 exec_str(
"require(\"rttlib\")");
697 this->
provides(
"Lua")->getOperation(
"exec_file");
699 return exec_file( file_name );
702 return this->getProvider<Scripting>(
"scripting")->
runScript( file_name );
708 bool configureOk =
true;
711 const bool rc =
kickStart2(configurationfile,
true, loadOk, configureOk, startOk);
736 log(
Warning) <<
"No components loaded by DeploymentComponent from "<< configurationfile <<endlog();
742 log(
Info) <<
"Successfully loaded, configured and started components from "<< configurationfile <<endlog();
745 log(
Error) <<
"Failed to start a component: aborting kick-start."<<endlog();
749 log(
Info) <<
"Successfully loaded and configured (but did not start) components from "<< configurationfile <<endlog();
753 log(
Error) <<
"Failed to configure a component: aborting kick-start."<<endlog();
757 log(
Error) <<
"Failed to load a component: aborting kick-start."<<endlog();
781 if ( sret && cret && uret) {
782 log(
Info) <<
"Kick-out of group " << group <<
" successful."<<endlog();
786 log(
Critical) <<
"Kick-out of group " << group <<
" failed: ";
788 log(
Critical) <<
" stopComponents() failed.";
790 log(
Critical) <<
" cleanupComponents() failed.";
792 log(
Critical) <<
" unloadComponents() failed.";
799 const bool ignoreNonexistentPorts)
810 if ( !portcon.
ready() ) {
811 log(
Error)<<
"RTT::Property '"<< (*pit)->
getName() <<
"' is not of type 'string'." << endlog();
817 if (ignoreNonexistentPorts)
819 log(
Info)<<
"Component '"<< c->
getName() <<
"' does not have a Port '"<< portcon.
getName()<<
"'. Will try to connect again later." << endlog();
822 log(
Error)<<
"Component '"<< c->
getName() <<
"' does not have a Port '"<< portcon.
getName()<<
"'." << endlog();
828 string conn_name = portcon.
value();
832 for(
unsigned int a=0; a <
conmap[conn_name].ports.size(); a++)
834 if(
conmap[conn_name].ports.at(a) == p &&
conmap[conn_name].owners.at(a) == c)
844 log(
Debug)<<
" in " << conn_name <<endlog();
845 conmap[conn_name].ports.push_back( p );
846 conmap[conn_name].owners.push_back( c );
872 log(
Info) <<
"Loading '" <<configurationfile<<
"' in group " << group <<
"."<< endlog();
874 bool failure =
false;
882 log(
Info)<<
"Validating new configuration..."<<endlog();
883 if ( from_file.
empty() ) {
884 log(
Error)<<
"Configuration was empty !" <<endlog();
891 if ( (*it)->getName() ==
"Import" ) {
893 if ( !importp.
ready() ) {
894 log(
Error)<<
"Found 'Import' statement, but it is not of type='string'."<<endlog();
898 if ( this->
import( importp.
get() ) ==
false )
902 if ( (*it)->getName() ==
"LoadLibrary" ) {
904 if ( !importp.
ready() ) {
905 log(
Error)<<
"Found 'LoadLibrary' statement, but it is not of type='string'."<<endlog();
913 if ( (*it)->getName() ==
"Path" ) {
915 if ( !pathp.
ready() ) {
916 log(
Error)<<
"Found 'Path' statement, but it is not of type='string'."<<endlog();
923 if ( (*it)->getName() ==
"Include" ) {
925 if ( !includep.
ready() ) {
926 log(
Error)<<
"Found 'Include' statement, but it is not of type='string'."<<endlog();
935 if ( (*it)->getName() ==
"GlobalsRepository" ) {
937 if ( !global.
ready() ) {
938 log(
Error)<<
"Found 'GlobalsRepository' tag, but it is not a complex xml type"<<endlog();
944 if ( (*pf)->getName() ==
"Properties" ) {
946 if ( !props.
ready() ) {
947 log(
Error)<<
"Found 'Properties' in 'GlobalsRepository' tag, but it is not of type PropertyBag"<<endlog();
953 log(
Error) <<
"Failed to configure global properties from configuration file."<<endlog();
956 log(
Info) <<
"Configured global properties from configuration file."<<endlog();
965 if ( !comp.
ready() ) {
966 log(
Error)<<
"RTT::Property '"<< *it <<
"' should be a struct, Include, Path or Import statement." << endlog();
974 assert( cp_prop.ready() );
975 if ( cp_prop.compose( comp ) ) {
977 #if defined(RTT_VERSION_GTE) 978 #if RTT_VERSION_GTE(2,8,99) 980 if (cp_prop.getName() ==
"Default") {
985 conmap[cp_prop.getName()].policy = cp_prop.get();
986 #if defined(RTT_VERSION_GTE) 987 #if RTT_VERSION_GTE(2,8,99) 991 log(
Debug) <<
"Saw connection policy " << (*it)->getName() << endlog();
997 if ( valid_names.find( (*optit)->getName() ) == valid_names.end() ) {
998 log(
Error) <<
"Unknown type syntax: '"<< (*optit)->getName() <<
"' in component struct "<< comp.
getName() <<endlog();
1002 if ( (*optit)->getName() ==
"AutoConnect" ) {
1005 log(
Error) <<
"AutoConnect must be of type <boolean>" << endlog();
1011 if ( (*optit)->getName() ==
"AutoStart" ) {
1014 log(
Error) <<
"AutoStart must be of type <boolean>" << endlog();
1020 if ( (*optit)->getName() ==
"AutoSave" ) {
1023 log(
Error) <<
"AutoSave must be of type <boolean>" << endlog();
1029 if ( (*optit)->getName() ==
"AutoConf" ) {
1032 log(
Error) <<
"AutoConf must be of type <boolean>" << endlog();
1038 if ( (*optit)->getName() ==
"Server" ) {
1041 log(
Error) <<
"Server must be of type <boolean>" << endlog();
1047 if ( (*optit)->getName() ==
"Service" || (*optit)->getName() ==
"Plugin" || (*optit)->getName() ==
"Provides") {
1050 log(
Error) << (*optit)->
getName() <<
" must be of type <string>" << endlog();
1057 if ( (*optit)->getName() ==
"UseNamingService" ) {
1060 log(
Error) <<
"UseNamingService must be of type <boolean>" << endlog();
1066 if ( (*optit)->getName() ==
"PropertyFile" ) {
1069 log(
Error) <<
"PropertyFile must be of type <string>" << endlog();
1075 if ( (*optit)->getName() ==
"UpdateProperties" ) {
1078 log(
Error) <<
"UpdateProperties must be of type <string>" << endlog();
1084 if ( (*optit)->getName() ==
"LoadProperties" ) {
1087 log(
Error) <<
"LoadProperties must be of type <string>" << endlog();
1093 if ( (*optit)->getName() ==
"Properties" ) {
1096 log(
Error) <<
"Properties must be a <struct>" << endlog();
1101 if ( (*optit)->getName() ==
"RunScript" ) {
1104 log(
Error) <<
"RunScript must be of type <string>" << endlog();
1109 if ( (*optit)->getName() ==
"ProgramScript" ) {
1112 log(
Error) <<
"ProgramScript must be of type <string>" << endlog();
1117 if ( (*optit)->getName() ==
"StateMachineScript" ) {
1120 log(
Error) <<
"StateMachineScript must be of type <string>" << endlog();
1129 if ( (*it)->getName() ==
"this" || (*it)->getName() == this->
getName() )
1132 c = this->
getPeer( (*it)->getName() );
1136 log(
Warning)<<
"Could not configure '"<< (*it)->
getName() <<
"': No such peer."<< endlog();
1140 c =
compmap[(*it)->getName()].instance;
1143 compmap[(*it)->getName()].group = group;
1144 log(
Info) <<
"Component " << (*it)->getName() <<
" added to group " << group <<
"." << endlog();
1147 compmap[(*it)->getName()].instance = c;
1153 vector<string>& services =
compmap[(*it)->getName()].plugins;
1154 for (vector<string>::iterator svit = services.begin(); svit != services.end(); ++svit) {
1155 if ( c->
provides()->hasService( *svit ) ==
false) {
1156 PluginLoader::Instance()->loadService(*svit, c);
1161 if ( comp.
value().getProperty(
"PropFile") )
1162 comp.
value().getProperty(
"PropFile")->setName(
"PropertyFile");
1169 if ( comp.
value().find(
"Peers") != 0) {
1171 if ( !nm.
ready() ) {
1172 log(
Error)<<
"RTT::Property 'Peers' must be a 'struct', was type "<< comp.
value().find(
"Peers")->getType() << endlog();
1177 if ( !pr.
ready() ) {
1178 log(
Error)<<
"RTT::Property 'Peer' does not have type 'string'."<<endlog();
1187 if ( comp.
value().find(
"Activity") != 0) {
1189 if ( !nm.
ready() ) {
1190 log(
Error)<<
"RTT::Property 'Activity' must be a 'struct'."<<endlog();
1193 if ( nm.
rvalue().getType() ==
"PeriodicActivity" ) {
1195 if ( !per.
ready() ) {
1196 log(
Error)<<
"Please specify period <double> of PeriodicActivity."<<endlog();
1200 if ( !prio.
ready() ) {
1201 log(
Error)<<
"Please specify priority <short> of PeriodicActivity."<<endlog();
1205 unsigned cpu_affinity = ~0;
1207 if(cpu_affinity_prop.
ready()) {
1208 cpu_affinity = cpu_affinity_prop.
get();
1213 if (nm.
rvalue().getProperty(
"Scheduler") )
1214 sched = nm.
rvalue().getProperty(
"Scheduler");
1216 if ( sched.
ready() ) {
1218 if (scheduler == -1 )
1225 if ( nm.
rvalue().getType() ==
"Activity" || nm.
rvalue().getType() ==
"NonPeriodicActivity" ) {
1227 if ( !per.
ready() ) {
1231 if ( !prio.
ready() ) {
1232 log(
Error)<<
"Please specify priority <short> of Activity."<<endlog();
1236 unsigned int cpu_affinity = ~0;
1238 if(cpu_affinity_prop.
ready()) {
1239 cpu_affinity = cpu_affinity_prop.
get();
1245 if ( sched.
ready() ) {
1247 if (scheduler == -1 )
1254 if ( nm.
rvalue().getType() ==
"SlaveActivity" ) {
1255 double period = 0.0;
1257 if ( nm.
rvalue().getProperty(
"Master") ) {
1258 master = nm.
rvalue().getPropertyType<
string>(
"Master")->
get();
1264 if ( nm.
rvalue().getProperty(
"Period") )
1265 period = nm.
rvalue().getPropertyType<
double>(
"Period")->
get();
1271 if ( nm.
rvalue().getType() ==
"SequentialActivity" ) {
1274 if ( nm.
rvalue().getType() ==
"FileDescriptorActivity" ) {
1276 if ( !per.
ready() ) {
1282 if ( !prio.
ready() ) {
1283 log(
Error)<<
"Please specify priority <short> of FileDescriptorActivity."<<endlog();
1287 unsigned int cpu_affinity = ~0;
1289 if(cpu_affinity_prop.
ready()) {
1290 cpu_affinity = cpu_affinity_prop.
get();
1296 if ( sched.
ready() ) {
1298 if (scheduler == -1 )
1305 log(
Error) <<
"Unknown activity type: " << nm.
rvalue().getType()<<endlog();
1317 string delimiter(
"@!#?<!");
1320 log(
Error) <<
"Failed to store deployment properties for component " << comp.
getName() <<endlog();
1329 log(
Error)<<
"Some error occured while parsing "<< configurationfile <<endlog();
1334 log(
Error)<<
"Uncaught exception in loadcomponents() !"<< endlog();
1338 return !failure && valid;
1345 for(ConMap::iterator it =
conmap.begin(); it !=
conmap.end(); ++it) {
1347 std::string connection_name = it->first;
1354 if ( connection->
ports.size() == 1 ){
1355 string owner = connection->
owners[0]->getName();
1356 string portname = connection->
ports.front()->getName();
1357 string porttype =
dynamic_cast<InputPortInterface*
>(connection->
ports.front() ) ?
"InputPort" :
"OutputPort";
1361 if (skipUnconnected)
1363 log(
Info) <<
"Skipping connection with name "<<connection_name<<
" with only one Port "<<portname<<
" from "<< owner << endlog();
1365 else if ( connection->
ports.front()->createStream( connection->
policy ) ==
false) {
1366 log(
Warning) <<
"Creating stream with name "<<connection_name<<
" with Port "<<portname<<
" from "<< owner <<
" failed."<< endlog();
1368 log(
Info) <<
"Component "<< owner <<
"'s " + porttype<<
" " + portname <<
" will stream to "<< connection->
policy.
name_id << endlog();
1374 ConnectionData::Ports::iterator p = connection->
ports.begin();
1377 vector<OutputPortInterface*> writers;
1378 while (p !=connection->
ports.end() ) {
1379 if ( OutputPortInterface* out = dynamic_cast<base::OutputPortInterface*>( *p ) ) {
1381 log(
Info) <<
"Forming multi-output connections with additional OutputPort " << (*p)->getName() <<
"."<<endlog();
1384 writers.push_back( out );
1385 std::string owner = it->second.owners[p - it->second.ports.begin()]->
getName();
1386 log(
Info) <<
"Component "<< owner <<
"'s OutputPort "<< writer->
getName()<<
" will write topic "<<it->first<< endlog();
1392 if ( writer == 0 ) {
1393 log(
Error) <<
"No OutputPort listed that writes " << it->first << endlog();
1399 p = connection->
ports.begin();
1400 vector<OutputPortInterface*>::iterator w = writers.begin();
1402 while (w != writers.end() ) {
1403 while (p != connection->
ports.end() ) {
1405 if ( dynamic_cast<base::InputPortInterface*>( *p ) )
1407 string owner = connection->
owners[p - connection->
ports.begin()]->getName();
1410 if ( (*w)->connectTo( *p, connection->
policy ) ==
false) {
1411 log(
Error) <<
"Could not subscribe InputPort "<< owner<<
"."<< (*p)->getName() <<
" to topic " << (*w)->getName() <<
'/'<< connection_name <<endlog();
1414 log(
Info) <<
"Subscribed InputPort "<< owner<<
"."<< (*p)->getName() <<
" to topic " << (*w)->getName() <<
'/'<< connection_name <<endlog();
1420 p = connection->
ports.begin();
1431 for (
int group = 0; group <=
nextGroup; ++group) {
1442 <<
"No components loaded by DeploymentComponent !" <<endlog();
1447 log(
Info) <<
"Configuring components in group " << group << endlog();
1461 log(
Error) <<
"Peer not found: "<< comp.
getName() <<endlog();
1471 if ( peers.
ready() )
1477 log(
Error) << this->
getName() <<
" can't make " << nm.
value() <<
" a peer of " <<
1481 log(
Info) << this->
getName() <<
" makes " << nm.
value() <<
" a peer of " <<
1486 log(
Error) <<
"Wrong property type in Peers struct. Expected property of type 'string'," 1487 <<
" got type "<< (*it)->getType() <<endlog();
1499 if ( !comp.
ready() )
1515 for(RTT::TaskContext::PeerList::iterator pit = peers.begin(); pit != peers.end(); ++pit) {
1539 log(
Warning) <<
"Component "<< peer->
getName()<<
" doesn't need to be configured (already Running)." <<endlog();
1546 if ( (*pf)->getName() ==
"Properties"){
1550 log(
Error) <<
"Failed to configure properties from main configuration file for component "<< comp.
getName() <<endlog();
1553 log(
Info) <<
"Configured Properties of "<< comp.
getName() <<
" from main configuration file." <<endlog();
1560 if ( (*pf)->getName() ==
"PropertyFile" || (*pf)->getName() ==
"UpdateProperties" || (*pf)->getName() ==
"LoadProperties"){
1562 string filename = dummy.
get();
1564 bool strict = (*pf)->getName() ==
"PropertyFile" ?
true :
false;
1565 bool load = (*pf)->getName() ==
"LoadProperties" ?
true :
false;
1570 ret = pl.
load(filename);
1572 log(
Error) <<
"Failed to configure properties for component "<< comp.
getName() <<endlog();
1575 log(
Info) <<
"Configured Properties of "<< comp.
getName() <<
" from "<<filename<<endlog();
1584 log(
Info) <<
"Re-setting activity of "<< comp.
getName() <<endlog();
1586 log(
Info) <<
"Setting activity of "<< comp.
getName() <<endlog();
1590 log(
Error) <<
"Failed to set Activity of " << comp.
getName() << endlog();
1600 if ( (*ps)->getName() ==
"RunScript" )
1602 if ( script.
ready() ) {
1607 if ( (*ps)->getName() ==
"ProgramScript" )
1609 if ( pscript.ready() ) {
1613 if ( (*ps)->getName() ==
"StateMachineScript" )
1615 if ( sscript.ready() ) {
1616 valid = valid && peer->
getProvider<
Scripting>(
"scripting")->loadStateMachines( sscript.get() );
1626 if ( peerconfigure() ==
false) {
1627 log(
Error) <<
"Component " << peer->
getName() <<
" returns false in configure()" << endlog();
1632 log(
Warning) <<
"Apparently component "<< peer->
getName()<<
" don't need to be configured (already Running)." <<endlog();
1646 for ( CompList::iterator cit =
comps.begin(); cit !=
comps.end(); ++cit) {
1655 log(
Info) <<
"Configuration successful for group " << group <<
"." <<endlog();
1666 for (
int group = 0; group <=
nextGroup; ++group) {
1676 log(
Error) <<
"Not starting components with invalid configuration." <<endlog();
1683 if (group !=
compmap[(*it)->getName()].group) {
1698 if (
compmap[(*it)->getName()].autostart )
1699 if ( !peer || ( !peer->
isRunning() && peerstart() ==
false) )
1704 for ( CompList::iterator cit =
comps.begin(); cit !=
comps.end(); ++cit) {
1708 if (group != it->
group) {
1713 log(
Error) <<
"Failed to start component "<< *cit <<
": not found." << endlog();
1720 log(
Info) <<
"Startup of 'AutoStart' components successful for group " << group <<
"." <<endlog();
1729 for (
int group =
nextGroup ; group != -1; --group) {
1738 log(
Info) <<
"Stopping group " << group << endlog();
1741 for ( CompList::reverse_iterator cit =
comps.rbegin(); cit !=
comps.rend(); ++cit) {
1761 for (
int group =
nextGroup ; group != -1; --group) {
1771 log(
Info) <<
"Cleaning up group " << group << endlog();
1773 for ( CompList::reverse_iterator cit =
comps.rbegin(); cit !=
comps.rend(); ++cit) {
1777 if (group != it->
group) {
1787 bool ret = pl.
save( file,
true );
1792 log(
Info) <<
"Refusing to save property file that was not loaded for "<< it->
instance->
getName() <<endlog();
1795 log(
Error) <<
"AutoSave set but no property file specified. Specify one using the UpdateProperties simple element."<<endlog();
1798 log(
Error) <<
"AutoSave set but no property file specified. Specify one using the UpdateProperties simple element."<<endlog();
1804 log(
Error) <<
"Could not cleanup Component "<< it->
instance->
getName() <<
" (not Stopped)"<<endlog();
1816 for (
int group =
nextGroup ; group != -1; --group) {
1824 log(
Info) <<
"Unloading group " << group << endlog();
1827 CompList::reverse_iterator cit =
comps.rbegin();
1828 while ( valid && cit !=
comps.rend())
1831 if (group == it->
group)
1836 cit =
comps.rbegin();
1850 log(
Info) <<
"Clearing configuration options."<< endlog();
1865 PluginLoader::Instance()->setPluginPath( PluginLoader::Instance()->getPluginPath() + path );
1882 if ((name ==
getName()) || (name ==
"this"))
1884 else if ( (peer =
getPeer(name)) == 0) {
1885 log(
Error)<<
"No such peer: "<< name<<
". Can not load service '"<<type<<
"'."<<endlog();
1890 if (peer->
provides()->hasService(type))
1892 return PluginLoader::Instance()->loadService(type, peer);
1900 if ( type ==
"RTT::PropertyBag" )
1904 log(
Error) <<
"Failed to load component with name "<<name<<
": already present as peer or loaded."<<endlog();
1915 compmap[name].instance = instance;
1916 comps.push_back(name);
1919 log(
Error) <<
"This deployer type refused to connect to "<< instance->
getName() <<
": aborting !" << endlog(
Error);
1926 this->
addPeer( instance, name );
1927 log(
Info) <<
"Adding "<< name <<
" as new peer: OK."<< endlog(
Info);
1942 std::string name = cit->first;
1949 log(
Debug) <<
"Disconnecting " <<name <<endlog();
1951 log(
Debug) <<
"Terminating " <<name <<endlog();
1953 log(
Debug) <<
"Removing proxy for " <<name <<endlog();
1956 for( ConMap::iterator cmit =
conmap.begin(); cmit !=
conmap.end(); ++cmit) {
1958 while ( n != cmit->second.owners.size() ) {
1959 if (cmit->second.owners[n] == it->
instance ) {
1960 cmit->second.owners.erase( cmit->second.owners.begin() + n );
1961 cmit->second.ports.erase( cmit->second.ports.begin() + n );
1978 log(
Info) <<
"Disconnected and destroyed "<< name <<endlog();
1980 log(
Error) <<
"Could not unload Component "<< name <<
": still running." <<endlog();
1988 CompList::iterator it =
comps.begin();
1989 while(it !=
comps.end()) {
1991 it =
comps.erase(it);
2001 CompMap::iterator it;
2003 if (
compmap.count( name ) == 0 ||
compmap[name].loaded == false ) {
2004 log(
Error) <<
"Can't unload component '"<<name<<
"': not loaded by "<<this->
getName()<<endlog();
2014 log(
Info) <<
"Successfully unloaded component "<<name<<
"."<<endlog();
2020 FactoryMap::const_iterator it;
2021 cout <<
"I can create the following component types: " <<
endl;
2023 cout <<
" " << it->first << endl;
2026 cout <<
" (none)"<<endl;
2031 std::vector<std::string> s;
2032 FactoryMap::const_iterator it;
2034 s.push_back(it->first);
2040 double period,
int priority,
2043 if ( this->
setNamedActivity(comp_name,
"Activity", period, priority, scheduler) ) {
2044 assert(
compmap[comp_name].instance );
2045 assert(
compmap[comp_name].act );
2046 compmap[comp_name].instance->setActivity(
compmap[comp_name].act );
2054 double timeout,
int priority,
2057 if ( this->
setNamedActivity(comp_name,
"FileDescriptorActivity", timeout, priority, scheduler) ) {
2058 assert(
compmap[comp_name].instance );
2059 assert(
compmap[comp_name].act );
2060 compmap[comp_name].instance->setActivity(
compmap[comp_name].act );
2068 double period,
int priority,
2069 int scheduler,
unsigned int cpu_nr)
2071 unsigned int mask = 0x1 << cpu_nr;
2072 if ( this->
setNamedActivity(comp_name,
"Activity", period, priority, scheduler, mask) ) {
2073 assert(
compmap[comp_name].instance );
2074 assert(
compmap[comp_name].act );
2075 compmap[comp_name].instance->setActivity(
compmap[comp_name].act );
2083 double period,
int priority,
2086 if ( this->
setNamedActivity(comp_name,
"PeriodicActivity", period, priority, scheduler) ) {
2087 assert(
compmap[comp_name].instance );
2088 assert(
compmap[comp_name].act );
2089 compmap[comp_name].instance->setActivity(
compmap[comp_name].act );
2100 assert(
compmap[comp_name].instance );
2101 assert(
compmap[comp_name].act );
2102 compmap[comp_name].instance->setActivity(
compmap[comp_name].act );
2112 assert(
compmap[comp_name].instance );
2113 assert(
compmap[comp_name].act );
2114 compmap[comp_name].instance->setActivity(
compmap[comp_name].act );
2122 const std::string& slave)
2125 assert(
compmap[slave].instance );
2136 const std::string& act_type,
2137 double period,
int priority,
2138 int scheduler,
const std::string& master_name)
2150 const std::string& act_type,
2151 double period,
int priority,
2152 int scheduler,
unsigned cpu_affinity,
2153 const std::string& master_name)
2159 if ( comp_name ==
"this" || comp_name == this->
getName() )
2162 if (
compmap.count(comp_name) )
2163 peer =
compmap[comp_name].instance;
2165 peer = this->
getPeer(comp_name);
2167 log(
Error) <<
"Can't create Activity: component "<<comp_name<<
" not found."<<endlog();
2170 if ( !master_name.empty() ) {
2171 if ( master_name ==
"this" || master_name == this->
getName() )
2175 master_act =
compmap[master_name].act;
2179 if ( !this->
getPeer(master_name) ) {
2180 log(
Error) <<
"Can't create SlaveActivity: Master component "<<master_name<<
" not known as peer."<<endlog();
2185 log(
Error) <<
"Can't create SlaveActivity: Master component "<<master_name<<
" has no activity set."<<endlog();
2190 compmap[comp_name].instance = peer;
2192 log(
Error) <<
"Can't change activity of component "<<comp_name<<
" since it is still running."<<endlog();
2198 if ( act_type ==
"Activity")
2199 newact =
new RTT::Activity(scheduler, priority, period, cpu_affinity, 0, comp_name);
2202 if ( act_type ==
"PeriodicActivity" && period != 0.0)
2206 if ( act_type ==
"NonPeriodicActivity" && period == 0.0)
2207 newact =
new RTT::Activity(scheduler, priority, period, cpu_affinity, 0, comp_name);
2209 if ( act_type ==
"SlaveActivity" ) {
2210 if ( master_act == 0 )
2218 if (act_type ==
"Activity") {
2219 newact =
new Activity(scheduler, priority, period, cpu_affinity, 0, comp_name);
2222 if (act_type ==
"SequentialActivity") {
2223 newact =
new SequentialActivity();
2225 else if ( act_type ==
"FileDescriptorActivity") {
2233 log(
Error) <<
"Can't create '"<< act_type <<
"' for component "<<comp_name<<
": incorrect arguments."<<endlog();
2242 delete compmap[comp_name].act;
2243 compmap[comp_name].act = newact;
2250 if ( !
compmap.count(comp_name) ) {
2251 log(
Error) <<
"Can't setWaitPeriodPolicy: component "<<comp_name<<
" not found."<<endlog();
2257 log(
Error) <<
"Can't setWaitPeriodPolicy: component "<<comp_name<<
" has no activity (yet)."<<endlog();
2274 if ( name ==
"this" || name == this->
getName() )
2279 log(
Error)<<
"No such peer to configure: "<<name<<endlog();
2297 std::vector<std::string> deleted_components_type;
2303 if ( (*it)->getName() ==
"Import" )
continue;
2304 if ( (*it)->getName() ==
"Include" )
continue;
2311 log(
Error)<<
"Some error occured while parsing "<< config_file <<endlog();
2315 log(
Error)<<
"Uncaught exception in kickOut() !"<< endlog();
2325 if ( instance->
getTaskState() <= base::TaskCore::Stopped ) {
2328 log(
Info) <<
"Cleaned up "<< instance->
getName() <<endlog();
2330 log(
Error) <<
"Could not cleanup Component "<< instance->
getName() <<
" (not Stopped)"<<endlog();
2344 if(instanceconfigure()) {
2345 log(
Info) <<
"Configured " << instance->
getName()<<endlog();
2349 log(
Error) <<
"Could not configure loaded Component "<< instance->
getName() <<endlog();
2364 log(
Info) <<
"Started "<< instance->
getName() <<endlog();
2368 log(
Error) <<
"Could not start loaded Component "<< instance->
getName() <<endlog();
2383 log(
Info) <<
"Stopped "<< instance->
getName() <<endlog();
2386 log(
Error) <<
"Could not stop loaded Component "<< instance->
getName() <<endlog();
2400 log(
Error) <<
"Component not loaded by this Deployer: "<< comp_name <<endlog();
2415 static const char* PEER=
"Application";
2416 static const char* NAME=
"shutdownDeployment";
2419 static const char* WAIT_PROP_NAME=
"shutdownWait_ms";
2420 static const char* TOTAL_WAIT_PROP_NAME=
"shutdownTotalWait_ms";
2423 bool has_program =
false;
2424 bool has_operation =
false;
2428 has_operation = peer->
provides()->hasOperation(NAME);
2430 ds = peer->
provides()->getOperation(NAME);
2432 log(
Info) <<
"Ignoring deployment shutdown function due to missing peer." << endlog();
2437 has_operation =
false;
2438 log(
Info) <<
"Ignoring deployment shutdown function, looking for shutdown program script." << endlog();
2442 if (has_operation || has_program)
2444 log(
Info) <<
"Shutting down deployment." << endlog();
2455 int totalWait = 2000;
2460 if (wait_prop.
ready())
2462 int w = wait_prop.
rvalue();
2466 log(
Debug) <<
"Using override value for " << WAIT_PROP_NAME << endlog();
2470 log(
Warning) <<
"Ignoring illegal value for " << WAIT_PROP_NAME << endlog();
2475 log(
Debug) <<
"Using default value for " << WAIT_PROP_NAME << endlog();
2480 if (totalWait_prop.
ready())
2482 int w = totalWait_prop.
rvalue();
2486 log(
Debug) <<
"Using override value for " << TOTAL_WAIT_PROP_NAME << endlog();
2490 log(
Warning) <<
"Ignoring illegal value for " << TOTAL_WAIT_PROP_NAME << endlog();
2495 log(
Debug) <<
"Using default value for " << TOTAL_WAIT_PROP_NAME << endlog();
2499 if (wait > totalWait)
2502 log(
Warning) <<
"Setting wait == totalWait" << endlog();
2505 const long int wait_ns = wait * 1000000LL;
2507 ts.tv_sec = wait_ns / 1000000000LL;
2508 ts.tv_nsec = wait_ns % 1000000000LL;
2511 log(
Debug) <<
"Waiting for deployment shutdown to complete ..." << endlog();
2515 && (waited < totalWait) )
2520 if (waited >= totalWait)
2522 log(
Error) <<
"Timed out waiting for deployment shutdown to complete." << endlog();
2526 log(
Debug) <<
"Deployment shutdown completed." << endlog();
2531 log(
Error) <<
"Failed to start operation or scripting program: " << NAME << endlog();
2537 log(
Info) <<
"No deployment shutdown function or program available." << endlog();
void clearConfiguration()
RTT::Constant< int > lowest_Priority
static std::set< string > valid_names
Property< T > & addProperty(const std::string &name, T &attr)
bool kickStart2(const std::string &configurationfile, const bool doStart, bool &loadOk, bool &configureOk, bool &startOk)
bool unloadComponent(const std::string &name)
DataSourceType get() const
virtual bool setImplementation(boost::shared_ptr< base::DisposableInterface > impl, ExecutionEngine *caller=0)=0
bool createConnectionMapFromPortsTag(RTT::Property< RTT::PropertyBag > &comp, RTT::TaskContext *c, const bool ignoreNonexistentPorts)
bool updateProperty(PropertyBag &target, const PropertyBag &source, const std::string &name, const std::string &separator)
RTT::Constant< int > highest_Priority
bool configureComponentsGroup(const int group)
ServiceRequester::shared_ptr stringToServiceRequester(std::string const &names)
Property< T > * getPropertyType(const std::string &name) const
const RTT::FactoryMap & getFactories() const
bool updateProperties(PropertyBag &target, const PropertyBag &source)
Service::shared_ptr provides()
bool configureComponents()
bool setSlaveActivity(const std::string &comp_name, double period)
ActivityInterface * getActivity() const
RTT::Attribute< std::string > target
Service::shared_ptr stringToService(std::string const &names)
bool aliasPeer(const std::string &from, const std::string &target, const std::string &alias)
bool configure(const std::string &filename, bool all=true) const
bool createStream(const std::string &component, const std::string &port, ConnPolicy policy)
int group
Group number this component belongs to.
DeploymentComponent(std::string name="Deployer", std::string siteFile="")
int rtos_nanosleep(const TIME_SPEC *rqtp, TIME_SPEC *rmtp)
static shared_ptr Instance()
virtual void componentUnloaded(RTT::TaskContext *c)
bool setActivityOnCPU(const std::string &comp_name, double period, int priority, int scheduler, unsigned int cpu_nr)
bool setActivity(const std::string &comp_name, double period, int priority, int scheduler)
bool waitForSignals(int *sigs, std::size_t sig_count)
bool connectPorts(const std::string &one, const std::string &other)
bool load(const std::string &filename) const
RTT::Attribute< bool > validConfig
boost::shared_ptr< ServiceRequester > shared_ptr
const std::string & getName() const
bool setMasterSlaveActivity(const std::string &comp_name, const std::string &master_name)
int string_to_oro_sched(const std::string &sched)
virtual bool connectPeers(TaskContext *peer)
bool import(const std::string &package)
virtual void removePeer(const std::string &name)
RTT::Constant< int > sched_OTHER
const_reference_t rvalue() const
base::PortInterface * stringToPort(std::string const &names)
static boost::shared_ptr< ComponentLoader > Instance()
virtual bool componentLoaded(RTT::TaskContext *c)
bool connectPeers(const std::string &one, const std::string &other)
RTT::Property< bool > autoUnload
std::vector< std::string > getComponentTypes() const
virtual bool isRunning() const
bool setActivity(base::ActivityInterface *new_act)
std::map< std::string, ComponentLoaderSignature > FactoryMap
bool createDataPortConnections(const bool skipUnconnected)
virtual TaskContext * getPeer(const std::string &peer_name) const
virtual bool deserialize(PropertyBag &v)
bool startComponent(RTT::TaskContext *instance)
boost::shared_ptr< Service > shared_ptr
bool stopComponentsGroup(const int group)
bool startComponentsGroup(const int group)
bool cleanupComponentsGroup(const int group)
virtual bool hasPeer(const std::string &peer_name) const
bool save(const std::string &filename, bool all=true) const
ServiceRequester::shared_ptr requires()
bool connectOperations(const std::string &required, const std::string &provided)
OperationCaller< bool(const std::string &)> isProgramRunning
const int HighestPriority
bool reloadLibrary(const std::string &filepath)
void deletePropertyBag(PropertyBag &target)
virtual void disconnect()
DataFlowInterface * ports()
bool addPeer(const std::string &from, const std::string &target)
base::PortInterface * getPort(const std::string &name) const
virtual PeerList getPeerList() const
bool setWaitPeriodPolicy(const std::string &comp_name, int policy)
void displayComponentTypes() const
base::PropertyBase * find(const std::string &name) const
bool loadConfiguration(const std::string &config_file)
void kickOut(const std::string &config_file)
bool kickStart(const std::string &file_name)
bool removeProperty(base::PropertyBase *p)
std::vector< std::string > PeerList
bool setPeriodicActivity(const std::string &comp_name, double period, int priority, int scheduler)
bool loadLibrary(const std::string &name)
bool addAttribute(const std::string &name, T &attr)
bool unloadComponentsGroup(const int group)
Properties::const_iterator const_iterator
basic_ostreams & endl(basic_ostreams &s)
virtual TaskState getTaskState() const
bool configureComponent(RTT::TaskContext *instance)
bool configureFromFile(const std::string &name, const std::string &filename)
base::PropertyBase * getProperty(const std::string &name) const
base::ActivityInterface * act
bool setSequentialActivity(const std::string &comp_name)
bool setFileDescriptorActivity(const std::string &comp_name, double timeout, int priority, int scheduler)
PropertyBag * properties()
bool loadService(const std::string &component, const std::string &service)
RTT::Constant< int > sched_RT
virtual os::ThreadInterface * thread()=0
OperationInterfacePart * getOperation(std::string name)
bool loadComponent(const std::string &name, const std::string &type)
bool kickOutComponent(const std::string &comp_name)
bool connect(const std::string &one, const std::string &other, ConnPolicy policy)
virtual bool connectTo(PortInterface *other, ConnPolicy const &policy)=0
static ConnPolicy & Default()
RTT::TaskContext * instance
const std::string & getName() const
bool setNamedActivity(const std::string &comp_name, const std::string &act_type, double period, int priority, int scheduler, const std::string &master_name="")
virtual bool connectPorts(TaskContext *peer)
static boost::shared_ptr< PluginLoader > Instance()
virtual bool ready() const =0
virtual bool createStream(ConnPolicy const &policy)=0
bool kickOutGroup(const int group)
bool loadComponents(const std::string &config_file)
bool connectPorts(TaskContext *A, TaskContext *B)
Properties::iterator iterator
void shutdownDeployment()
virtual bool connectServices(TaskContext *peer)
bool unloadComponentImpl(CompMap::iterator cit)
bool runScript(const std::string &file_name)
bool waitForSignal(int signumber)
virtual bool connected() const =0
bool stream(const std::string &port, ConnPolicy policy)
virtual void setWaitPeriodPolicy(int p)=0
Operation< Signature > & addOperation(Operation< Signature > &op)
struct timespec TIME_SPEC
bool loadConfigurationString(const std::string &config_text)
bool loadComponentsInGroup(const std::string &config_file, const int group)
bool stopComponent(RTT::TaskContext *instance)
const ExecutionEngine * engine() const
int nextGroup
Next group number.
bool connectServices(const std::string &one, const std::string &other)
static Logger::LogFunction endlog()
int defaultWaitPeriodPolicy
bool cleanupComponent(RTT::TaskContext *instance)
virtual bool addPeer(TaskContext *peer, std::string alias="")
base::ActivityInterface * getActivity()
virtual const std::string & getName() const
void path(const std::string &path)
boost::shared_ptr< ServiceType > getProvider(const std::string &name)