19 #include <coil/UUID.h> 83 conf.description = CORBA::string_dup(prop[
"description"].c_str());
84 conf.id = CORBA::string_dup(prop.
getName());
86 conf.description = (
char *)prop[
"description"].c_str();
87 conf.id = (
char *)prop.
getName();
88 #endif // ORB_IS_RTORB 104 : rtclog(
"sdo_config"), m_configsets(configsets),
105 m_sdoservice(sdoServiceAdmin)
132 throw (CORBA::SystemException,
133 InvalidParameter, NotAvailable, InternalError)
143 throw InternalError(
"Unknown Error");
159 throw (CORBA::SystemException,
160 InvalidParameter, NotAvailable, InternalError)
174 throw InternalError(
"Configuration::set_service_profile");
188 throw (CORBA::SystemException,
189 InvalidParameter, NotAvailable, InternalError)
195 ::SDOPackage::Organization::_duplicate(
org));
199 throw InternalError(
"Configuration::set_service_profile");
215 throw (CORBA::SystemException,
216 InvalidParameter, NotAvailable, InternalError)
218 RTC_TRACE((
"remove_service_profile(%s)",
id));
225 throw InternalError(
"Configuration::remove_service_profile");
239 throw (CORBA::SystemException,
240 InvalidParameter, NotAvailable, InternalError)
242 RTC_TRACE((
"remove_organization(%s)", organization_id));
250 throw InternalError(
"Configuration::remove_organization");
269 throw (CORBA::SystemException,
270 NotAvailable, InternalError)
272 RTC_TRACE((
"get_configuration_parameters()"));
276 ParameterList_var param;
278 return param._retn();
282 throw InternalError(
"Configuration::get_configuration_parameters()");
286 return new ParameterList(0);
298 throw (CORBA::SystemException,
299 NotAvailable, InternalError)
301 RTC_TRACE((
"get_configuration_parameter_values()"));
304 nvlist =
new NVList((CORBA::ULong)0);
314 return nvlist._retn();
326 throw (CORBA::SystemException,
327 InvalidParameter, NotAvailable, InternalError)
329 RTC_TRACE((
"get_configuration_parameter_value(%s)", name));
330 if (std::string(name).empty())
throw InvalidParameter(
"Name is empty.");
333 CORBA::Any_var value;
334 value =
new CORBA::Any();
346 return value._retn();
358 const CORBA::Any& value)
359 throw (CORBA::SystemException,
360 InvalidParameter, NotAvailable, InternalError)
362 RTC_TRACE((
"set_configuration_parameter(%s, value)", name));
386 ConfigurationSetList*
388 throw (CORBA::SystemException,
389 NotAvailable, InternalError)
397 ConfigurationSetList_var config_sets =
398 new ConfigurationSetList((CORBA::ULong)cf.size());
400 config_sets->length((CORBA::ULong)cf.size());
402 for (CORBA::ULong i(0), len(cf.size()); i < len; ++i)
407 return config_sets._retn();
409 catch (CORBA::SystemException& e)
412 RTC_ERROR((
"CORBA::SystemException cought: %s", e._name()));
414 RTC_ERROR((
"CORBA::SystemException cought."));
416 throw InternalError(
"Configuration::get_configuration_sets()");
421 RTC_ERROR((
"Unknown exception cought."));
422 throw InternalError(
"Configuration::get_configuration_sets()");
425 return new ConfigurationSetList(0);
437 throw (CORBA::SystemException,
438 NotAvailable, InternalError)
440 RTC_TRACE((
"get_configuration_set(%s)",
id));
441 if (std::string(
id).empty())
throw InternalError(
"ID is empty");
452 throw InvalidParameter(
"No such ConfigurationSet");
458 throw InternalError(
"Unknown exception");
465 ConfigurationSet_var
config;
466 config =
new ConfigurationSet();
469 return config._retn();
473 throw InternalError(
"Configuration::get_configuration_set()");
478 return new ConfigurationSet();
491 throw (CORBA::SystemException,
492 InvalidParameter, NotAvailable, InternalError)
494 RTC_TRACE((
"set_configuration_set_values()"));
495 std::string
id(configuration_set.id);
496 if (
id.empty())
throw InvalidParameter(
"ID is empty.");
507 if (conf.
findNode(
"exported_ports") != 0)
510 exported_ports(
coil::split(conf[
"exported_ports"],
","));
511 std::string exported_ports_str(
"");
512 for (
size_t i(0), len(exported_ports.size()); i < len; ++i)
515 if (keyval.size() > 2)
517 exported_ports_str += (keyval[0] +
"." + keyval.back());
521 exported_ports_str += exported_ports[i];
523 if (i != exported_ports.size() - 1)
525 exported_ports_str +=
",";
528 conf[
"exported_ports"] = exported_ports_str;
536 throw InternalError(
"Configuration::set_configuration_set_values()");
550 throw (CORBA::SystemException,
551 NotAvailable, InternalError)
553 RTC_TRACE((
"get_active_configuration_set()"));
561 ConfigurationSet_var
config;
562 config =
new ConfigurationSet();
564 return config._retn();
568 throw InternalError(
"Configuration::get_active_configuration_set()");
571 return new ConfigurationSet();
584 throw (CORBA::SystemException,
585 InvalidParameter, NotAvailable, InternalError)
591 const char*
config_id(configuration_set.id);
602 throw InternalError(
"Configuration::add_configuration_set()");
617 throw (CORBA::SystemException,
618 InvalidParameter, NotAvailable, InternalError)
620 RTC_TRACE((
"remove_configuration_set(%s)",
id));
621 if (std::string(
id).empty())
622 throw InvalidParameter(
"ID is empty.");
631 throw InternalError(
"Configuration::remove_configuration_set()");
646 throw (CORBA::SystemException,
647 InvalidParameter, NotAvailable, InternalError)
649 RTC_TRACE((
"activate_configuration_set(%s)",
id));
650 if (std::string(
id).empty())
651 throw InvalidParameter(
"ID is empty.");
659 throw InvalidParameter(
"Configuration::activate_configuration_set()");
728 return (
const char*)
uuid->to_string();
#define RTC_ERROR(fmt)
Error log output macro.
virtual CORBA::Boolean add_configuration_set(const ConfigurationSet &configuration_set)
[CORBA interface] Add ConfigurationSet
virtual CORBA::Boolean set_configuration_set_values(const ConfigurationSet &configuration_set)
[CORBA interface] Set ConfigurationSet
virtual NVList * get_configuration_parameter_values()
[CORBA interface] Get a list of the value of configuration parameters
Functor for Organization.
void toConfigurationSet(SDOPackage::ConfigurationSet &conf, const coil::Properties &prop)
Convert properties into SDO ConfigurationSet.
virtual ConfigurationSet * get_active_configuration_set()
[CORBA interface] Get active ConfigurationSet
bool activateConfigurationSet(const char *config_id)
Activate the configuration set.
bool isActive(void)
Confirm to activate configuration set.
std::vector< std::pair< std::string, std::string > > NVList
void init()
Initialization.
const std::vector< coil::Properties * > & getConfigurationSets(void)
Get all configuration sets.
virtual CORBA::Boolean set_configuration_parameter(const char *name, const CORBA::Any &value)
[CORBA interface] Modify the configuration parameter value
Configuration_impl(RTC::ConfigAdmin &configAdmin, RTC::SdoServiceAdmin &sdoServiceAdmin)
Constructor.
vstring split(const std::string &input, const std::string &delimiter, bool ignore_empty)
Split string by delimiter.
virtual CORBA::Boolean remove_organization(const char *organization_id)
[CORBA interface] Remove the reference of Organization
const coil::Properties & getActiveConfigurationSet(void)
Get the active configuration set.
ExecutionContext base class.
virtual CORBA::Boolean add_organization(Organization_ptr org)
[CORBA interface] Add Organization
virtual CORBA::Boolean add_service_profile(const ServiceProfile &sProfile)
[CORBA interface] Set SDO's ServiceProfile
virtual CORBA::Any * get_configuration_parameter_value(const char *name)
[CORBA interface] Get the value of configuration parameter
const coil::Properties & getConfigurationSet(const char *config_id)
Get a configuration set by specified ID.
const char * getName(void) const
Get Names.
virtual CORBA::Boolean activate_configuration_set(const char *config_id)
[CORBA interface] Activate ConfigurationSet
#define RTC_FATAL(fmt)
Error log output macro.
std::vector< std::string > vstring
coil::UUID * generateUUID(ACE_UINT16 version=0x0001, u_char variant=0x80)
void copyToProperties(coil::Properties &prop, const SDOPackage::NVList &nv)
Copy NVList to the Proeprties.
bool addConfigurationSet(const coil::Properties &configuration_set)
Add the configuration value to configuration set.
Properties *const findNode(const std::string &key) const
Get node of properties.
const OrganizationList getOrganizations()
Get a list of Organization of SDO.
NameValue and NVList utility functions.
Configuration_var m_objref
The reference to CORBA object.
OrganizationList m_organizations
SDO OrganizationList with mutex lock.
CORBA sequence utility template functions.
void erase_if(CorbaSequence &seq, Functor f)
Remove an element of a sequence according to a predicate.
virtual CORBA::Boolean set_device_profile(const DeviceProfile &dProfile)
[CORBA interface] Set DeviceProfile of SDO
virtual ConfigurationSetList * get_configuration_sets()
[CORBA interface] Get a list of ConfigurationSet
prop
Organization::get_organization_property ();.
Class represents a set of properties.
Functor for ConfigurationSet.
virtual ConfigurationSet * get_configuration_set(const char *config_id)
[CORBA interface] Get a ConfigurationSet
RTC::SdoServiceAdmin & m_sdoservice
SDO Service admin object with mutex lock.
const std::string getUUID() const
Generate UUID.
bool addSdoServiceConsumer(const SDOPackage::ServiceProfile &sProfile)
Add Service Consumer.
DeviceProfile m_deviceProfile
SDO DeviceProfile with mutex lock.
void push_back(CorbaSequence &seq, SequenceElement elem)
Push the new element back to the CORBA sequence.
void copyFromProperties(SDOPackage::NVList &nv, const coil::Properties &prop)
Copy the properties to NVList.
ParameterList m_parameters
SDO Parameter.
Configuration_ptr getObjRef()
Get object reference.
bool haveConfig(const char *config_id)
Check the existence of configuration set.
bool setConfigurationSetValues(const coil::Properties &configuration_set)
Add to configuration set from specified property.
RTC::ConfigAdmin & m_configsets
SDO ConfigurationSetList with mutex lock.
const DeviceProfile getDeviceProfile()
Get the DeviceProfile of SDO.
bool removeConfigurationSet(const char *config_id)
Remove the configuration set.
virtual CORBA::Boolean remove_service_profile(const char *id)
[CORBA interface] Remove ServiceProfile
bool removeSdoServiceConsumer(const char *id)
Remove Service Consumer.
virtual ParameterList * get_configuration_parameters()
[CORBA interface] Get a list of configuration parameters
void toProperties(coil::Properties &prop, const SDOPackage::ConfigurationSet &conf)
Store SDO ConfigurationSet to properties.
virtual ~Configuration_impl(void)
Virtual destractor.
virtual CORBA::Boolean remove_configuration_set(const char *config_id)
[CORBA interface] Remove ConfigurationSet