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());
148 RTC_ERROR((
"invalid connection_limit value: %s",
244 RTC_TRACE((
"getConnectorById(id = %s)",
id));
254 RTC_WARN((
"ConnectorProfile with the id(%s) not found.",
id));
267 RTC_TRACE((
"getConnectorByName(name = %s)", name));
269 std::string sname(name);
277 RTC_WARN((
"ConnectorProfile with the name(%s) not found.", name));
291 RTC_TRACE((
"getConnectorProfileById(id = %s)",
id));
311 RTC_TRACE((
"getConnectorProfileByName(name = %s)", name));
374 RTC_TRACE((
"addConnectorDataListener(%s)",
379 RTC_ERROR((
"addConnectorDataListener(): Unknown Listener Type"));
398 RTC_TRACE((
"removeConnectorDataListener(%s)",
403 RTC_ERROR((
"removeConnectorDataListener(): Unknown Listener Type"));
427 RTC_ERROR((
"addConnectorListener(): Unknown Listener Type"));
445 RTC_TRACE((
"removeConnectorListener(%s)",
450 RTC_ERROR((
"removeConnectorListener(): Unknown Listener Type"));
474 throw (CORBA::SystemException)
480 "dataport.serializer.cdr.endian"));
483 RTC_TRACE((
"ConnectorProfile dataport.serializer.cdr.endian set."));
486 NVUtil::newNV(
"dataport.serializer.cdr.endian",
"little,big"));
530 prop << conn_prop.
getNode(
"dataport");
537 prop << conn_prop.
getNode(
"dataport.outport");
539 RTC_DEBUG((
"ConnectorProfile::properties are as follows."));
548 std::string dflow_type(prop[
"dataflow_type"]);
551 if (dflow_type ==
"push")
556 else if (dflow_type ==
"pull")
558 RTC_PARANOID((
"dataflow_type = pull .... create PullConnector"));
576 RTC_DEBUG((
"publishInterface() successfully finished."));
580 RTC_ERROR((
"unsupported dataflow_type"));
601 prop << conn_prop.
getNode(
"dataport");
608 prop << conn_prop.
getNode(
"dataport.outport");
610 RTC_DEBUG((
"ConnectorProfile::properties are as follows."));
627 std::string& dflow_type(prop[
"dataflow_type"]);
630 if (dflow_type ==
"push")
648 RTC_DEBUG((
"subscribeInterfaces() successfully finished."));
651 else if (dflow_type ==
"pull")
659 RTC_ERROR((
"specified connector not found: %s",
660 (
const char*)cprof.connector_id));
664 RTC_DEBUG((
"subscribeInterfaces() successfully finished."));
668 RTC_ERROR((
"unsupported dataflow_type: %s", dflow_type.c_str()));
684 std::string
id(connector_profile.connector_id);
691 if (
id == (*it)->id())
696 RTC_TRACE((
"delete connector: %s",
id.c_str()));
701 RTC_ERROR((
"specified connector not found: %s",
id.c_str()));
722 #ifndef RTC_NO_DATAPORTIF_ACTIVATION_OPTION 730 provider_types.clear();
734 std::sort(temp_types.begin(), temp_types.end());
735 std::sort(active_types.begin(), active_types.end());
736 std::set_intersection(temp_types.begin(), temp_types.end(),
737 active_types.begin(), active_types.end(),
738 std::back_inserter(provider_types));
743 if (provider_types.size() > 0)
745 RTC_DEBUG((
"dataflow_type pull is supported"));
771 #ifndef RTC_NO_DATAPORTIF_ACTIVATION_OPTION 779 consumer_types.clear();
783 std::sort(temp_types.begin(), temp_types.end());
784 std::sort(active_types.begin(), active_types.end());
785 std::set_intersection(temp_types.begin(), temp_types.end(),
786 active_types.begin(), active_types.end(),
787 std::back_inserter(consumer_types));
792 if (consumer_types.size() > 0)
814 if(prop.
hasKey(
"serializer") == NULL)
821 std::string endian_type(prop.
getProperty(
"serializer.cdr.endian",
""));
822 RTC_DEBUG((
"endian_type: %s", endian_type.c_str()));
824 std::vector<std::string> endian(
coil::split(endian_type,
","));
826 if(endian.empty()) {
return false; }
827 if(endian[0] ==
"little")
832 else if(endian[0] ==
"big")
834 littleEndian =
false;
850 if (!prop[
"interface_type"].empty() &&
854 RTC_DEBUG((
"interface_type: %s", prop[
"interface_type"].c_str()));
860 RTC_DEBUG((
"interface_type: %s", prop[
"interface_type"].c_str()));
863 instance().createObject(prop[
"interface_type"].c_str());
873 RTC_ERROR((
"publishing interface information error"));
877 #else // ORB_IS_RTORB 878 ::SDOPackage::NVList_ptr prop_ref(cprof.properties);
881 RTC_ERROR((
"publishing interface information error"));
885 #endif // ORB_IS_RTORB 904 if (!prop[
"interface_type"].empty() &&
908 RTC_DEBUG((
"interface_type: %s", prop[
"interface_type"].c_str()));
914 RTC_DEBUG((
"interface_type: %s", prop[
"interface_type"].c_str()));
917 instance().createObject(prop[
"interface_type"].c_str());
926 RTC_ERROR((
"interface subscription failed."));
955 #else // ORB_IS_RTORB 961 #endif // ORB_IS_RTORB 970 RTC_ERROR((
"old compiler? new returned 0;"));
973 RTC_TRACE((
"OutPortPushConnector created"));
982 catch (std::bad_alloc& e)
984 RTC_ERROR((
"OutPortPushConnector creation failed"));
987 RTC_FATAL((
"never comes here: createConnector()"));
1004 #ifndef ORB_IS_RTORB 1009 #else // ORB_IS_RTORB 1015 #endif // ORB_IS_RTORB 1024 RTC_ERROR((
"old compiler? new returned 0;"));
1027 RTC_TRACE((
"OutPortPullConnector created"));
1033 catch (std::bad_alloc& e)
1035 RTC_ERROR((
"OutPortPullConnector creation failed"));
1038 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.
std::vector< std::pair< std::string, std::string > > NVList
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
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.
Properties * hasKey(const char *key) const
Check whether key exists in the children.
#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.
const std::string & getProperty(const std::string &key) const
Search for the property with the specified key in this property.
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 ();.
PortProfile m_profile
PortProfile of the Port.
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_list(CorbaSequence &seq1, const CorbaSequence &seq2)
Merge the elements of the CORBA sequence.
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.
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.
coil::Properties & properties()
Get properties.