29 #include "CorbaDeploymentComponent.hpp" 30 #include <rtt/transports/corba/TaskContextProxy.hpp> 31 #include <rtt/transports/corba/TaskContextServer.hpp> 32 #include <rtt/deployment/ComponentLoader.hpp> 45 log(Debug) <<
"createTaskContextProxy" <<endlog();
46 return ::RTT::corba::TaskContextProxy::Create(name,
false);
55 log(Debug) <<
"createTaskContextProxyIORFile" <<endlog();
56 std::ifstream iorfile( iorfilename.c_str() );
57 if (iorfile.is_open() && iorfile.good() ) {
60 return ::RTT::corba::TaskContextProxy::Create( ior,
true);
63 log(Error) <<
"Could not open IORFile: '" << iorfilename <<
"'."<< endlog();
74 log(Debug) <<
"createTaskContextProxyIOR" <<endlog();
75 return ::RTT::corba::TaskContextProxy::Create( ior,
true);
79 CorbaDeploymentComponent::CorbaDeploymentComponent(
const std::string& name,
const std::string& siteFile)
82 log(Info) <<
"Registering TaskContextProxy factory." <<endlog();
88 this->addOperation(
"server", &
CorbaDeploymentComponent::createServer,
this, ClientThread).doc(
"Creates a CORBA TaskContext server for the given component").arg(
"tc",
"Name of the RTT::TaskContext (must be a peer).").arg(
"UseNamingService",
"Set to true to use the naming service.");
89 this->addOperation(
"aliasServer", &
CorbaDeploymentComponent::createAliasServer,
this, ClientThread).doc(
"Creates a CORBA TaskContext server for the given component using an alias").arg(
"tc",
"Name of the RTT::TaskContext (must be a peer).").arg(
"alias",
"Alias to use when registering to the CORBA Namingservice").arg(
"UseNamingService",
"Set to true to use the naming service.");
92 CorbaDeploymentComponent::~CorbaDeploymentComponent()
95 ::RTT::corba::TaskContextServer::CleanupServer(
this);
100 RTT::TaskContext* peer = this->getPeer(tc);
102 log(Error)<<
"No such peer: "<< tc <<endlog();
105 if ( ::RTT::corba::TaskContextServer::Create(peer, use_naming) != 0 )
112 RTT::TaskContext* peer = this->getPeer(tc);
114 log(Error)<<
"No such peer: "<< tc <<endlog();
117 if ( ::RTT::corba::TaskContextServer::Create(peer, alias, use_naming) != 0 )
124 if ( dynamic_cast<RTT::corba::TaskContextProxy*>(c) ) {
126 for ( CompMap::iterator cit = compmap.begin(); cit != compmap.end(); ++cit) {
127 if (cit->second.instance == c) {
128 cit->second.proxy =
true;
136 bool use_naming = compmap[c->getName()].use_naming;
137 bool server = compmap[c->getName()].server;
138 log(Info) <<
"Name:"<< c->getName() <<
" Server: " << server <<
" Naming: " << use_naming <<endlog();
141 ::RTT::corba::TaskContextServer::Create(c, use_naming);
147 ::RTT::corba::TaskContextServer::CleanupServer( c );
virtual bool componentLoaded(RTT::TaskContext *c)
Check if c is a proxy or a local object.
bool createServer(const std::string &tc, bool use_naming)
Creates a ControlTask CORBA server for a given peer TaskContext.
This file contains the macros and definitions to create dynamically loadable components.
RTT::TaskContext * createTaskContextProxyIOR(std::string ior)
This helper function looks up a server using an IOR file and creates a proxy for that object...
The Orocos Component Library.
bool createAliasServer(const std::string &tc, const std::string &alias, bool use_naming)
Creates a ControlTask CORBA server for a given peer TaskContext.
RTT::TaskContext * createTaskContextProxyIORFile(std::string iorfilename)
This helper function looks up a server using an IOR file and creates a proxy for that object...
A Component for deploying (configuring) other components in an application.
virtual void componentUnloaded(RTT::TaskContext *c)
Removes the CORBA server for this component.
RTT::TaskContext * createTaskContextProxy(std::string name)
This helper function looks up a server using the Naming Service and creates a proxy for that object...