24 #include <coil/stringutil.h> 86 RTC_DEBUG((
"setting port.port_type: DataOutPort"));
89 RTC_DEBUG((
"setting dataport.data_type: %s", data_type));
98 RTC_DEBUG((
"available subscription_type: %s", pubs.c_str()));
99 addProperty(
"dataport.subscription_type", pubs.c_str());
145 RTC_ERROR((
"invalid connection_limit value: %s",
241 RTC_TRACE((
"getConnectorById(id = %s)",
id));
251 RTC_WARN((
"ConnectorProfile with the id(%s) not found.",
id));
264 RTC_TRACE((
"getConnectorByName(name = %s)", name));
266 std::string sname(name);
274 RTC_WARN((
"ConnectorProfile with the name(%s) not found.", name));
288 RTC_TRACE((
"getConnectorProfileById(id = %s)",
id));
308 RTC_TRACE((
"getConnectorProfileByName(name = %s)", name));
371 RTC_TRACE((
"addConnectorDataListener(%s)",
376 RTC_ERROR((
"addConnectorDataListener(): Unknown Listener Type"));
395 RTC_TRACE((
"removeConnectorDataListener(%s)",
400 RTC_ERROR((
"removeConnectorDataListener(): Unknown Listener Type"));
424 RTC_ERROR((
"addConnectorListener(): Unknown Listener Type"));
442 RTC_TRACE((
"removeConnectorListener(%s)",
447 RTC_ERROR((
"removeConnectorListener(): Unknown Listener Type"));
471 throw (CORBA::SystemException)
477 "dataport.serializer.cdr.endian"));
480 RTC_TRACE((
"ConnectorProfile dataport.serializer.cdr.endian set."));
483 NVUtil::newNV(
"dataport.serializer.cdr.endian",
"little,big"));
527 prop << conn_prop.
getNode(
"dataport");
534 prop << conn_prop.
getNode(
"dataport.outport");
536 RTC_DEBUG((
"ConnectorProfile::properties are as follows."));
545 std::string dflow_type(prop[
"dataflow_type"]);
548 if (dflow_type ==
"push")
553 else if (dflow_type ==
"pull")
555 RTC_PARANOID((
"dataflow_type = pull .... create PullConnector"));
573 RTC_DEBUG((
"publishInterface() successfully finished."));
577 RTC_ERROR((
"unsupported dataflow_type"));
598 prop << conn_prop.
getNode(
"dataport");
605 prop << conn_prop.
getNode(
"dataport.outport");
607 RTC_DEBUG((
"ConnectorProfile::properties are as follows."));
624 std::string& dflow_type(prop[
"dataflow_type"]);
627 if (dflow_type ==
"push")
645 RTC_DEBUG((
"subscribeInterfaces() successfully finished."));
648 else if (dflow_type ==
"pull")
656 RTC_ERROR((
"specified connector not found: %s",
657 (
const char*)cprof.connector_id));
661 RTC_DEBUG((
"subscribeInterfaces() successfully finished."));
665 RTC_ERROR((
"unsupported dataflow_type: %s", dflow_type.c_str()));
681 std::string
id(connector_profile.connector_id);
688 if (
id == (*it)->id())
693 RTC_TRACE((
"delete connector: %s",
id.c_str()));
698 RTC_ERROR((
"specified connector not found: %s",
id.c_str()));
719 #ifndef RTC_NO_DATAPORTIF_ACTIVATION_OPTION 727 provider_types.clear();
731 std::sort(temp_types.begin(), temp_types.end());
732 std::sort(active_types.begin(), active_types.end());
733 std::set_intersection(temp_types.begin(), temp_types.end(),
734 active_types.begin(), active_types.end(),
735 std::back_inserter(provider_types));
740 if (provider_types.size() > 0)
742 RTC_DEBUG((
"dataflow_type pull is supported"));
768 #ifndef RTC_NO_DATAPORTIF_ACTIVATION_OPTION 776 consumer_types.clear();
780 std::sort(temp_types.begin(), temp_types.end());
781 std::sort(active_types.begin(), active_types.end());
782 std::set_intersection(temp_types.begin(), temp_types.end(),
783 active_types.begin(), active_types.end(),
784 std::back_inserter(consumer_types));
789 if (consumer_types.size() > 0)
811 if(prop.
hasKey(
"serializer") == NULL)
818 std::string endian_type(prop.
getProperty(
"serializer.cdr.endian",
""));
819 RTC_DEBUG((
"endian_type: %s", endian_type.c_str()));
821 std::vector<std::string> endian(
coil::split(endian_type,
","));
823 if(endian.empty()) {
return false; }
824 if(endian[0] ==
"little")
829 else if(endian[0] ==
"big")
831 littleEndian =
false;
847 if (!prop[
"interface_type"].empty() &&
851 RTC_DEBUG((
"interface_type: %s", prop[
"interface_type"].c_str()));
857 RTC_DEBUG((
"interface_type: %s", prop[
"interface_type"].c_str()));
860 instance().createObject(prop[
"interface_type"].c_str());
870 RTC_ERROR((
"publishing interface information error"));
874 #else // ORB_IS_RTORB 875 ::SDOPackage::NVList_ptr prop_ref(cprof.properties);
878 RTC_ERROR((
"publishing interface information error"));
882 #endif // ORB_IS_RTORB 901 if (!prop[
"interface_type"].empty() &&
905 RTC_DEBUG((
"interface_type: %s", prop[
"interface_type"].c_str()));
911 RTC_DEBUG((
"interface_type: %s", prop[
"interface_type"].c_str()));
914 instance().createObject(prop[
"interface_type"].c_str());
923 RTC_ERROR((
"interface subscription failed."));
952 #else // ORB_IS_RTORB 958 #endif // ORB_IS_RTORB 967 RTC_ERROR((
"old compiler? new returned 0;"));
970 RTC_TRACE((
"OutPortPushConnector created"));
979 catch (std::bad_alloc& e)
981 RTC_ERROR((
"OutPortPushConnector creation failed"));
984 RTC_FATAL((
"never comes here: createConnector()"));
1001 #ifndef ORB_IS_RTORB 1006 #else // ORB_IS_RTORB 1012 #endif // ORB_IS_RTORB 1021 RTC_ERROR((
"old compiler? new returned 0;"));
1024 RTC_TRACE((
"OutPortPullConnector created"));
1030 catch (std::bad_alloc& e)
1032 RTC_ERROR((
"OutPortPullConnector creation failed"));
1035 RTC_FATAL((
"never comes here: createConnector()"));
SDOPackage::NameValue newNV(const char *name, Value value)
Create NameValue.
void removeListener(ConnectorListener *listener)
Remove the listener.
OutPortConnector * getConnectorById(const char *id)
Getting ConnectorProfile by ID.
void configure()
Configureing outport.
InPortConsumer abstract class.
#define RTC_ERROR(fmt)
Error log output macro.
virtual ~OutPortBase(void)
Destructor.
void initProviders()
OutPort provider initialization.
std::string normalize(std::string &str)
Erase the head/tail blank and replace upper case to lower case.
ConnectorInfoList getConnectorProfiles()
ConnectorProfile list.
void addConnectorDataListener(ConnectorDataListenerType listener_type, ConnectorDataListener *listener, bool autoclean=true)
Adding BufferDataListener type listener.
virtual void init(coil::Properties &prop)=0
Initializing configuration.
coil::vstring getConnectorNames()
Connector name list.
coil::vstring getConnectorIds()
ConnectorId list.
OutPortConnector * getConnectorByName(const char *name)
Getting Connector by name.
std::vector< OutPortConnector * > m_connectors
Connection list.
void initConsumers()
InPort consumer initialization.
bool stringTo(To &val, const char *str)
Convert the given std::string to object.
ConnectorDataListener class.
void addConnectorListener(ConnectorListenerType callback_type, ConnectorListener *listener, bool autoclean=true)
Adding ConnectorListener type listener.
void addListener(ConnectorDataListener *listener, bool autoclean)
Add the listener.
ConnectorListenerHolder connector_[CONNECTOR_LISTENER_NUM]
ConnectorListenerType listener array The ConnectorListenerType listener is stored.
virtual void setConnector(OutPortConnector *connector)=0
set Connector
void removeListener(ConnectorDataListener *listener)
Remove the listener.
coil::Properties m_properties
Properties.
void eraseBlank(std::string &str)
Erase blank characters of string.
void removeConnectorListener(ConnectorListenerType callback_type, ConnectorListener *listener)
Removing BufferDataListener type listener.
virtual void setEndian(const bool endian_type)
Setting an endian type.
ConnectorListeners m_listeners
ConnectorDataListener listener.
virtual ReturnCode_t connect(ConnectorProfile &connector_profile)
[CORBA interface] Connect the Port
vstring split(const std::string &input, const std::string &delimiter, bool ignore_empty)
Split string by delimiter.
virtual void unsubscribeInterfaces(const ConnectorProfile &connector_profile)
Disconnect the interface connection.
std::vector< ConnectorInfo > ConnectorInfoList
Properties * hasKey(const char *key) const
Check whether key exists in the children.
void addListener(ConnectorListener *listener, bool autoclean)
Add the listener.
static GlobalFactory< AbstractClass, Identifier, Compare, Creator, Destructor > & instance()
Create instance.
bool isLittleEndian()
return it whether endian setting.
GlobalFactory template class.
OutPortConnector * createConnector(const ConnectorProfile &cprof, coil::Properties &prop, InPortConsumer *consumer)
OutPortPushConnector creation.
void operator()(OutPortConnector *c)
virtual ReturnCode_t publishInterfaces(ConnectorProfile &connector_profile)
Publish interface information.
#define RTC_WARN(fmt)
Warning log output macro.
#define RTC_FATAL(fmt)
Error log output macro.
#define RTC_DEBUG_STR(str)
#define RTC_PARANOID(fmt)
Paranoid level log output macro.
std::vector< Identifier > getIdentifiers()
Get factory ID list.
std::vector< std::string > vstring
ConnectorDataListenerType
The types of ConnectorDataListener.
const CORBA::Long find_index(const SDOPackage::NVList &nv, const char *name)
Return the index of element specified by name from NVList.
static const char * toString(ConnectorListenerType type)
Convert ConnectorListenerType into the string.
void removeConnectorDataListener(ConnectorDataListenerType listener_type, ConnectorDataListener *listener)
Removing BufferDataListener type listener.
ConnectorDataListenerHolder connectorData_[CONNECTOR_DATA_LISTENER_NUM]
ConnectorDataListenerType listener array The ConnectorDataListenerType listener is stored...
void appendProperty(const char *key, const char *value)
Append NameValue data to PortProfile's properties.
#define RTC_DEBUG(fmt)
Debug level log output macro.
std::string flatten(vstring sv)
Create CSV file from the given string list.
void copyToProperties(coil::Properties &prop, const SDOPackage::NVList &nv)
Copy NVList to the Proeprties.
bool getConnectorProfileById(const char *id, ConnectorInfo &prof)
Getting ConnectorProfile by name.
Push type connector class.
void deleteObject(const Identifier &id, AbstractClass *&obj)
Delete factory object.
bool m_littleEndian
Connected Endian.
OutPortBase(const char *name, const char *data_type)
Constructor.
void init(coil::Properties &prop)
Initializing properties.
virtual ReturnCode_t connect(ConnectorProfile &connector_profile)
[CORBA interface] Connect the Port
OutPortProvider * createProvider(ConnectorProfile &cprof, coil::Properties &prop)
OutPort provider creation.
coil::vstring m_consumerTypes
Available consumers.
prop
Organization::get_organization_property ();.
virtual void init(coil::Properties &prop)
Initializing configuration.
ConnectorListenerType
The types of ConnectorListener.
Functor to delete Providers.
Class represents a set of properties.
static const char * toString(ConnectorDataListenerType type)
Convert ConnectorDataListenerType into the string.
bool checkEndian(const coil::Properties &prop, bool &littleEndian)
Checking endian flag of serializer.
std::vector< IPortService * > PortServiceList
OutPortPull type connector class.
virtual void activateInterfaces()
Activate all Port interfaces.
bool getConnectorProfileByName(const char *name, ConnectorInfo &prof)
Getting ConnectorProfile by name.
coil::vstring m_providerTypes
Available providers.
virtual bool publishInterface(SDOPackage::NVList &properties)
Publish interface information.
void operator()(OutPortProvider *p)
void push_back(CorbaSequence &seq, SequenceElement elem)
Push the new element back to the CORBA sequence.
Functor to delete Connectors.
virtual ReturnCode_t subscribeInterfaces(const ConnectorProfile &connector_profile)
Subscribe to the interface.
Properties & getNode(const std::string &key)
Get node of properties.
const std::vector< OutPortConnector * > & connectors()
Connector list.
bool includes(const vstring &list, std::string value, bool ignore_case)
Include if a string is included in string list.
InPortConsumer * createConsumer(const ConnectorProfile &cprof, coil::Properties &prop)
InPort consumer creation.
coil::vstring refToVstring(const CorbaRefSequence &objlist)
void addProperty(const char *key, ValueType value)
Add NameValue data to PortProfile's properties.
CORBA IOR helper functions.
virtual void deactivateInterfaces()
Deactivate all Port interfaces.
#define RTC_VERBOSE(fmt)
Verbose level log output macro.
Functor for_each(CorbaSequence &seq, Functor f)
Apply the functor to all CORBA sequence elements.
const ConnectorInfo & profile()
Getting Profile.
#define RTC_PARANOID_STR(str)
virtual ReturnCode_t _publishInterfaces(void)
Publish interface information.
OutPortProviderFactory & m_factory
virtual void setConnectionLimit(int limit_value)
Set the maximum number of connections.
virtual bool subscribeInterface(const SDOPackage::NVList &properties)=0
Subscribe the data send notification.
const std::string & getProperty(const std::string &key) const
Search for the property with the specified key in this property.
coil::Properties & properties()
Get properties.