29 #ifndef OCL_DEPLOYMENTCOMPONENT_HPP 30 #define OCL_DEPLOYMENTCOMPONENT_HPP 32 #include <rtt/RTT.hpp> 33 #include <rtt/TaskContext.hpp> 34 #include <rtt/extras/Properties.hpp> 35 #include <rtt/Attribute.hpp> 36 #include <rtt/InputPort.hpp> 37 #include <rtt/OutputPort.hpp> 38 #include <ocl/OCL.hpp> 41 #include <rtt/marsh/PropertyDemarshaller.hpp> 87 :
public RTT::TaskContext
96 int defaultWaitPeriodPolicy;
97 RTT::Property<bool> autoUnload;
98 RTT::Attribute<bool> validConfig;
99 RTT::Constant<int> sched_RT;
100 RTT::Constant<int> sched_OTHER;
101 RTT::Constant<int> lowest_Priority;
102 RTT::Constant<int> highest_Priority;
103 RTT::Attribute<std::string> target;
114 : instance(0), act(0), loaded(
false), loadedProperties(
false),
115 autostart(
false), autoconf(
false),
116 autoconnect(
false), autosave(
false),
117 proxy(
false), server(
false),
130 base::ActivityInterface*
act;
142 bool autostart, autoconf, autoconnect, autosave;
143 bool proxy, server, use_naming;
144 std::string configfile;
145 std::vector<std::string> plugins;
154 typedef std::vector<RTT::base::PortInterface*> Ports;
155 typedef std::vector<RTT::TaskContext*> Owners;
158 RTT::ConnPolicy policy;
164 typedef std::map<std::string, ConnectionData>
ConMap;
170 typedef std::map<std::string, ComponentData>
CompMap;
171 typedef std::list<std::string> CompList;
181 bool configureHook();
187 bool unloadComponentImpl( CompMap::iterator cit );
197 virtual bool componentLoaded(RTT::TaskContext* c);
204 virtual void componentUnloaded(RTT::TaskContext* c);
214 Service::shared_ptr stringToService(std::string
const& names);
223 ServiceRequester::shared_ptr stringToServiceRequester(std::string
const& names);
232 base::PortInterface* stringToPort(std::string
const& names);
238 bool waitForSignal(
int signumber);
244 bool waitForInterrupt();
276 RTT::TaskContext* myGetPeer(std::string name) {
return compmap[ name ].instance; }
288 bool connectPeers(
const std::string& one,
const std::string& other);
290 using TaskContext::connectPorts;
308 bool connectPorts(
const std::string& one,
const std::string& other);
325 bool connectPorts(
const std::string& one,
const std::string& one_port,
326 const std::string& other,
const std::string& other_port);
338 bool connect(
const std::string& one,
const std::string& other, ConnPolicy policy);
347 bool stream(
const std::string& port, ConnPolicy policy);
352 bool createStream(
const std::string& component,
const std::string& port, ConnPolicy policy);
354 using TaskContext::connectServices;
363 bool connectServices(
const std::string& one,
const std::string& other);
371 bool connectOperations(
const std::string& required,
const std::string& provided);
383 bool addPeer(
const std::string& from,
const std::string& target);
396 bool aliasPeer(
const std::string& from,
const std::string& target,
const std::string& alias);
398 using RTT::TaskContext::addPeer;
399 using RTT::TaskContext::connectPeers;
415 bool import(
const std::string& package);
424 void path(
const std::string& path);
435 bool loadLibrary(
const std::string& name);
446 bool reloadLibrary(
const std::string& filepath);
459 bool loadComponent(
const std::string& name,
const std::string& type);
475 bool loadService(
const std::string& component,
const std::string& service);
485 bool unloadComponent(
const std::string& name);
492 void displayComponentTypes()
const;
499 std::vector<std::string> getComponentTypes()
const;
512 bool setPeriodicActivity(
const std::string& comp_name,
513 double period,
int priority,
527 bool setActivity(
const std::string& comp_name,
528 double period,
int priority,
542 bool setFileDescriptorActivity(
const std::string& comp_name,
543 double timeout,
int priority,
558 bool setActivityOnCPU(
const std::string& comp_name,
559 double period,
int priority,
560 int scheduler,
unsigned int cpu_nr);
570 bool setSequentialActivity(
const std::string& comp_name);
581 bool setSlaveActivity(
const std::string& comp_name,
592 bool setMasterSlaveActivity(
const std::string& comp_name,
593 const std::string& master_name);
610 bool setNamedActivity(
const std::string& comp_name,
611 const std::string& act_type,
612 double period,
int priority,
613 int scheduler,
const std::string& master_name =
"");
629 bool setNamedActivity(
const std::string& comp_name,
630 const std::string& act_type,
631 double period,
int priority,
632 int scheduler,
unsigned cpu_affinity,
633 const std::string& master_name =
"");
643 bool setWaitPeriodPolicy(
const std::string& comp_name,
661 bool loadComponents(
const std::string& config_file);
675 bool loadComponentsInGroup(
const std::string& config_file,
704 bool configureComponents();
713 bool configureComponentsGroup(
const int group);
720 bool startComponents();
726 bool startComponentsGroup(
const int group);
732 void clearConfiguration();
737 bool stopComponents();
743 bool stopComponentsGroup(
const int group);
748 bool cleanupComponents();
754 bool cleanupComponentsGroup(
const int group);
759 bool unloadComponents();
765 bool unloadComponentsGroup(
const int group);
771 bool kickStart(
const std::string& file_name);
778 bool kickOutComponent(
const std::string& comp_name);
784 void kickOut(
const std::string& config_file);
796 bool kickOutGroup(
const int group);
802 bool runScript(
const std::string& file_name);
804 using base::TaskCore::configure;
814 bool configure(
const std::string& name);
825 bool configureFromFile(
const std::string& name,
const std::string& filename);
841 bool loadConfiguration(
const std::string& config_file);
849 bool loadConfigurationString(
const std::string& config_text);
855 const RTT::FactoryMap& getFactories()
const;
862 bool configureComponent(RTT::TaskContext *instance);
871 return this->configureComponent( this->getPeer(comp_name) );
879 bool startComponent(RTT::TaskContext *instance);
888 return this->startComponent( this->getPeer(comp_name) );
896 bool stopComponent(RTT::TaskContext *instance);
905 return this->stopComponent( this->getPeer(comp_name) );
913 bool cleanupComponent(RTT::TaskContext *instance);
922 return this->cleanupComponent( this->getPeer(comp_name) );
932 void shutdownDeployment();
std::map< std::string, ComponentData > CompMap
This list and map hold the dynamically loaded components.
int group
Group number this component belongs to.
base::ActivityInterface * act
The activity created by DeploymentComponent.
Assembles all ports which share a connection.
std::map< std::string, ConnectionData > ConMap
This maps connection names to associated ports.
bool stopComponent(const std::string &comp_name)
Stop a single loaded and running components.
int nextGroup
Next group number.
bool configureComponent(const std::string &comp_name)
Configure a single loaded and running components.
RTT::TaskContext * instance
The component instance.
This file contains the macros and definitions to create dynamically loadable components.
bool cleanupComponent(const std::string &comp_name)
Cleanup a single loaded and not running component.
bool startComponent(const std::string &comp_name)
Stop a single loaded and running components.
The Orocos Component Library.
bool loaded
True if it was loaded and created by DeploymentComponent.
A Component for deploying (configuring) other components in an application.
bool loadedProperties
True if successfully loaded a property file, and so will need auto-saving (it autosave is on) ...
Each configured component is stored in a struct like this.
RTT::PropertyBag root
This bag stores the current configuration.