4 int connectPorts(RTC::PortService_ptr outPort, RTC::PortService_ptr inPort)
6 RTC::ConnectorProfileList_var connectorProfiles = inPort->get_connector_profiles();
7 for(CORBA::ULong
i=0;
i < connectorProfiles->length(); ++
i){
8 RTC::ConnectorProfile& connectorProfile = connectorProfiles[
i];
9 RTC::PortServiceList& connectedPorts = connectorProfile.ports;
11 for(CORBA::ULong j=0; j < connectedPorts.length(); ++j){
12 RTC::PortService_ptr connectedPortRef = connectedPorts[j];
13 if(connectedPortRef->_is_equivalent(outPort)){
19 RTC::ConnectorProfile cprof;
20 cprof.connector_id =
"";
21 cprof.name = CORBA::string_dup(
"connector0");
22 cprof.ports.length(2);
23 cprof.ports[0] = RTC::PortService::_duplicate(inPort);
24 cprof.ports[1] = RTC::PortService::_duplicate(outPort);
35 RTC::ReturnCode_t result = inPort->connect(cprof);
37 if(result == RTC::RTC_OK)
46 for(CORBA::ULong
i=0;
i < eclist->length(); ++
i){
47 if(!CORBA::is_nil(eclist[
i])){
48 eclist[i]->activate_component(pRtc->
getObjRef());
57 for(CORBA::ULong
i=0;
i < eclist->length(); ++
i){
58 if(!CORBA::is_nil(eclist[
i])){
59 eclist[i]->deactivate_component(pRtc->
getObjRef());
68 const char *
ior = NULL;
70 RTC::PortServiceList ports;
71 ports = *(rtc->get_ports());
73 RTC::ComponentProfile* cprof;
74 cprof = rtc->get_component_profile();
75 std::string portname = std::string(cprof->instance_name) +
"." + sname;
77 for(
unsigned int i=0;
i < ports.length();
i++)
79 RTC::PortService_var port = ports[
i];
80 RTC::PortProfile* prof = port->get_port_profile();
81 if(std::string(prof->name) == portname)
83 RTC::ConnectorProfile connProfile;
84 connProfile.name =
"noname";
85 connProfile.connector_id =
"";
86 connProfile.ports.length(1);
87 connProfile.ports[0] = port;
88 port->connect(connProfile);
90 connProfile.properties[0].value >>= ior;
92 port->disconnect(connProfile.connector_id);
102 const std::string& name,
const std::string& value)
104 SDOPackage::Configuration_ptr cfg = rtc->get_configuration();
105 SDOPackage::ConfigurationSetList_var cfgsets
106 = cfg->get_configuration_sets();
107 if (cfgsets->length()==0){
108 std::cerr <<
"configuration set is not found" << std::endl;
111 SDOPackage::ConfigurationSet& cfgset = cfgsets[0];
112 SDOPackage::NVList&
nv = cfgset.configuration_data;
113 for (
size_t i=0;
i<nv.length();
i++){
114 if (std::string(nv[
i].name) == name){
115 nv[
i].value <<= value.c_str();
116 cfg->set_configuration_set_values(cfgset);
117 cfg->activate_configuration_set(
"default");
121 std::cerr <<
"can't find property(" << name <<
")" << std::endl;
124 RTC::RTObject_var
findRTC(
const std::string &rtcName)
127 std::string nameServer = manager.
getConfig()[
"corba.nameservers"];
128 int comPos = nameServer.find(
",");
130 comPos = nameServer.length();
132 nameServer = nameServer.substr(0, comPos);
134 CosNaming::Name
name;
136 name[0].id = CORBA::string_dup(rtcName.c_str());
137 name[0].kind = CORBA::string_dup(
"rtc");
139 CORBA::Object_ptr
obj =
naming.resolve(name);
140 return RTC::RTObject::_narrow(obj);
SDOPackage::NameValue newNV(const char *name, Value value)
png_infop png_charpp name
static Manager & instance()
const char * getServiceIOR(RTC::RTObject_var rtc, const char *sname)
coil::Properties & getConfig()
void setConfiguration(RTC::RTObject_var rtc, const std::string &name, const std::string &value)
RTObject_ptr getObjRef() const
virtual ExecutionContextList * get_owned_contexts()
int connectPorts(RTC::PortService_ptr outPort, RTC::PortService_ptr inPort)
RTC::RTObject_var findRTC(const std::string &rtcName)
void push_back(CorbaSequence &seq, SequenceElement elem)
void activateRtc(RTC::RtcBase *pRtc)
void deactivateRtc(RTC::RtcBase *pRtc)