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.");
91 CorbaDeploymentComponent::~CorbaDeploymentComponent()
94 ::RTT::corba::TaskContextServer::CleanupServer(
this);
99 RTT::TaskContext* peer = this->getPeer(tc);
101 log(Error)<<
"No such peer: "<< tc <<endlog();
104 if ( ::RTT::corba::TaskContextServer::Create(peer, use_naming) != 0 )
112 if ( dynamic_cast<RTT::corba::TaskContextProxy*>(c) ) {
114 for ( CompMap::iterator cit = compmap.begin(); cit != compmap.end(); ++cit) {
115 if (cit->second.instance == c) {
116 cit->second.proxy =
true;
124 bool use_naming = compmap[c->getName()].use_naming;
125 bool server = compmap[c->getName()].server;
126 log(Info) <<
"Name:"<< c->getName() <<
" Server: " << server <<
" Naming: " << use_naming <<endlog();
129 ::RTT::corba::TaskContextServer::Create(c, use_naming);
135 ::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.
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...