43 :
PortBase(name), m_singlebuffer(true), m_thebuffer(0), m_littleEndian(true)
48 RTC_DEBUG((
"setting port.port_type: DataIntPort"));
51 RTC_DEBUG((
"setting dataport.data_type: %s", data_type));
70 RTC_ERROR((
"connector.size should be 0 in InPortBase's dtor."));
83 RTC_ERROR((
"Although singlebuffer flag is true, the buffer != 0"));
116 RTC_ERROR((
"default buffer creation failed"));
130 RTC_ERROR((
"invalid connection_limit value: %s",
227 RTC_TRACE((
"getConnectorById(id = %s)",
id));
237 RTC_WARN((
"ConnectorProfile with the id(%s) not found.",
id));
250 RTC_TRACE((
"getConnectorByName(name = %s)", name));
252 std::string sname(name);
260 RTC_WARN((
"ConnectorProfile with the name(%s) not found.", name));
274 RTC_TRACE((
"getConnectorProfileById(id = %s)",
id));
294 RTC_TRACE((
"getConnectorProfileByName(name = %s)", name));
339 RTC_DEBUG((
"deactivate connector: %s %s",
363 RTC_TRACE((
"addConnectorDataListener(%s)",
368 RTC_ERROR((
"addConnectorDataListener(): Invalid listener type."));
378 RTC_TRACE((
"removeConnectorDataListener(%s)",
383 RTC_ERROR((
"removeConnectorDataListener(): Invalid listener type."));
407 RTC_ERROR((
"addConnectorListener(): Invalid listener type."));
416 RTC_TRACE((
"removeConnectorListener(%s)",
421 RTC_ERROR((
"removeConnectorListener(): Invalid listener type."));
444 throw (CORBA::SystemException)
450 "dataport.serializer.cdr.endian"));
453 RTC_TRACE((
"ConnectorProfile dataport.serializer.cdr.endian set."));
456 NVUtil::newNV(
"dataport.serializer.cdr.endian",
"little,big"));
487 prop << conn_prop.
getNode(
"dataport");
494 prop << conn_prop.
getNode(
"dataport.inport");
496 RTC_DEBUG((
"ConnectorProfile::properties are as follows."));
505 std::string dflow_type(prop[
"dataflow_type"]);
508 if (dflow_type ==
"push")
510 RTC_DEBUG((
"dataflow_type = push .... create PushConnector"));
516 RTC_ERROR((
"InPort provider creation failed."));
524 RTC_ERROR((
"PushConnector creation failed."));
531 RTC_DEBUG((
"publishInterface() successfully finished."));
534 else if (dflow_type ==
"pull")
536 RTC_DEBUG((
"dataflow_type = pull .... do nothing"));
540 RTC_ERROR((
"unsupported dataflow_type: %s", dflow_type.c_str()));
560 prop << conn_prop.
getNode(
"dataport");
567 prop << conn_prop.
getNode(
"dataport.inport");
569 RTC_DEBUG((
"ConnectorProfile::properties are as follows."));
578 RTC_TRACE((
"endian: %s", littleEndian ?
"little" :
"big"));
586 std::string dflow_type(prop[
"dataflow_type"]);
589 if (dflow_type ==
"push")
597 RTC_ERROR((
"specified connector not found: %s",
598 (
const char*)cprof.connector_id));
603 RTC_DEBUG((
"subscribeInterfaces() successfully finished."));
606 else if (dflow_type ==
"pull")
624 RTC_DEBUG((
"subscribeInterfaces() successfully finished."));
628 RTC_ERROR((
"unsupported dataflow_type: %s", dflow_type.c_str()));
644 std::string
id(connector_profile.connector_id);
651 if (
id == (*it)->id())
659 RTC_TRACE((
"delete connector: %s",
id.c_str()));
664 RTC_ERROR((
"specified connector not found: %s",
id.c_str()));
685 #ifndef RTC_NO_DATAPORTIF_ACTIVATION_OPTION 693 provider_types.clear();
697 std::sort(temp_types.begin(), temp_types.end());
698 std::sort(active_types.begin(), active_types.end());
699 std::set_intersection(temp_types.begin(), temp_types.end(),
700 active_types.begin(), active_types.end(),
701 std::back_inserter(provider_types));
706 if (provider_types.size() > 0)
708 RTC_DEBUG((
"dataflow_type push is supported"));
734 #ifndef RTC_NO_DATAPORTIF_ACTIVATION_OPTION 742 consumer_types.clear();
746 std::sort(temp_types.begin(), temp_types.end());
747 std::sort(active_types.begin(), active_types.end());
748 std::set_intersection(temp_types.begin(), temp_types.end(),
749 active_types.begin(), active_types.end(),
750 std::back_inserter(consumer_types));
755 if (consumer_types.size() > 0)
777 if(prop.
hasKey(
"serializer") == NULL)
784 std::string endian_type(prop.
getProperty(
"serializer.cdr.endian",
""));
785 RTC_DEBUG((
"endian_type: %s", endian_type.c_str()));
787 std::vector<std::string> endian(
coil::split(endian_type,
","));
789 if(endian.empty()) {
return false; }
790 if(endian[0] ==
"little")
795 else if(endian[0] ==
"big")
797 littleEndian =
false;
815 if (!prop[
"interface_type"].empty() &&
819 RTC_DEBUG((
"interface_type: %s", prop[
"interface_type"].c_str()));
825 RTC_DEBUG((
"interface_type: %s", prop[
"interface_type"].c_str()));
828 instance().createObject(prop[
"interface_type"].c_str());
838 RTC_ERROR((
"publishing interface information error"));
842 #else // ORB_IS_RTORB 844 ::SDOPackage::NVList_ptr prop_ref(cprof.properties);
847 RTC_ERROR((
"publishing interface information error"));
851 #endif // ORB_IS_RTORB 870 if (!prop[
"interface_type"].empty() &&
874 RTC_DEBUG((
"interface_type: %s", prop[
"interface_type"].c_str()));
880 RTC_DEBUG((
"interface_type: %s", prop[
"interface_type"].c_str()));
883 instance().createObject(prop[
"interface_type"].c_str());
892 RTC_ERROR((
"interface subscription failed."));
920 #else // ORB_IS_RTORB 926 #endif // ORB_IS_RTORB 946 RTC_ERROR((
"old compiler? new returned 0;"));
949 RTC_TRACE((
"InPortPushConnector created"));
955 catch (std::bad_alloc& e)
957 RTC_ERROR((
"InPortPushConnector creation failed"));
960 RTC_FATAL((
"never comes here: createConnector()"));
981 #else // ORB_IS_RTORB 987 #endif // ORB_IS_RTORB 1005 RTC_ERROR((
"old compiler? new returned 0;"));
1008 RTC_TRACE((
"InPortPushConnector created"));
1016 catch (std::bad_alloc& e)
1018 RTC_ERROR((
"InPortPullConnector creation failed"));
1021 RTC_FATAL((
"never comes here: createConnector()"));
SDOPackage::NameValue newNV(const char *name, Value value)
Create NameValue.
void removeListener(ConnectorListener *listener)
Remove the listener.
#define RTC_ERROR(fmt)
Error log output macro.
bool checkEndian(const coil::Properties &prop, bool &littleEndian)
Checking endian flag of serializer.
std::string normalize(std::string &str)
Erase the head/tail blank and replace upper case to lower case.
virtual ReturnCode_t subscribeInterfaces(const ConnectorProfile &connector_profile)
Subscribe to the interface.
coil::Properties & properties()
Get properties.
virtual void unsubscribeInterfaces(const ConnectorProfile &connector_profile)
Disconnect the interface connection.
CdrBufferBase * m_thebuffer
Buffer.
virtual ReturnCode_t connect(ConnectorProfile &connector_profile)
[CORBA interface] Connect the Port
bool stringTo(To &val, const char *str)
Convert the given std::string to object.
ConnectorDataListener class.
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.
void removeListener(ConnectorDataListener *listener)
Remove the listener.
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.
std::vector< ConnectorInfo > ConnectorInfoList
bool isLittleEndian()
return it whether endian setting.
void addListener(ConnectorListener *listener, bool autoclean)
Add the listener.
static GlobalFactory< AbstractClass, Identifier, Compare, Creator, Destructor > & instance()
Create instance.
GlobalFactory template class.
virtual void deactivateInterfaces()
Deactivate all Port interfaces.
virtual const ConnectorInfo & profile()
Getting ConnectorInfo.
coil::vstring m_providerTypes
Available providers.
coil::vstring m_consumerTypes
Available consumers.
virtual void activateInterfaces()
Activate all Port interfaces.
virtual ~InPortBase(void)
Destructor.
#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.
InPortConnector * createConnector(ConnectorProfile &cprof, coil::Properties &prop, InPortProvider *provider)
InPortPushConnector creation.
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.
bool m_littleEndian
Connected Endian.
InPortConnector * getConnectorByName(const char *name)
Getting Connector by name.
ConnectorDataListenerHolder connectorData_[CONNECTOR_DATA_LISTENER_NUM]
ConnectorDataListenerType listener array The ConnectorDataListenerType listener is stored...
virtual bool subscribeInterface(const SDOPackage::NVList &properties)=0
Subscribe the data receive notification.
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.
void removeConnectorDataListener(ConnectorDataListenerType listener_type, ConnectorDataListener *listener)
Removing BufferDataListener type listener.
InPortBase(const char *name, const char *data_type)
Constructor.
NameValue and NVList utility functions.
virtual void setConnector(InPortConnector *connector)=0
set Connector
bool getConnectorProfileById(const char *id, ConnectorInfo &prof)
Getting ConnectorProfile by name.
ConnectorInfoList getConnectorProfiles()
ConnectorProfile list.
void initProviders()
InPort provider initialization.
CORBA sequence utility template functions.
virtual void setEndian(const bool endian_type)
Setting an endian type.
Push type connector class.
coil::vstring getConnectorIds()
ConnectorId list.
bool getConnectorProfileByName(const char *name, ConnectorInfo &prof)
Getting ConnectorProfile by name.
virtual void init(coil::Properties &prop)=0
Initializing configuration.
void addConnectorListener(ConnectorListenerType callback_type, ConnectorListener *listener, bool autoclean=true)
Adding ConnectorListener type listener.
const std::vector< InPortConnector * > & connectors()
Connector list.
prop
Organization::get_organization_property ();.
RTC::Port implementation for InPort.
void initConsumers()
OutPort consumer initialization.
PortProfile m_profile
PortProfile of the Port.
ConnectorListenerType
The types of ConnectorListener.
Class represents a set of properties.
void removeConnectorListener(ConnectorListenerType callback_type, ConnectorListener *listener)
Removing BufferDataListener type listener.
static const char * toString(ConnectorDataListenerType type)
Convert ConnectorDataListenerType into the string.
coil::Properties m_properties
Properties.
std::vector< IPortService * > PortServiceList
virtual bool publishInterface(SDOPackage::NVList &properties)
Publish interface information.
virtual void init(coil::Properties &prop)=0
Initializing configuration.
InPortPull type connector class.
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.
OutPortConsumer abstract class.
void copyFromProperties(SDOPackage::NVList &nv, const coil::Properties &prop)
Copy the properties to NVList.
coil::vstring getConnectorNames()
Connector name list.
Properties & getNode(const std::string &key)
Get node of properties.
InPortConnector * getConnectorById(const char *id)
Getting ConnectorProfile by ID.
void init(coil::Properties &prop)
Initializing properties.
bool m_singlebuffer
Buffer mode.
bool includes(const vstring &list, std::string value, bool ignore_case)
Include if a string is included in string list.
OutPortConsumer * createConsumer(const ConnectorProfile &cprof, coil::Properties &prop)
InPort provider 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.
void addConnectorDataListener(ConnectorDataListenerType listener_type, ConnectorDataListener *listener, bool autoclean=true)
Adding BufferDataListener type listener.
ConnectorList m_connectors
Connection list.
virtual ReturnCode_t _publishInterfaces(void)
Publish interface information.
virtual void setConnectionLimit(int limit_value)
Set the maximum number of connections.
InPortProvider * createProvider(ConnectorProfile &cprof, coil::Properties &prop)
InPort provider creation.
virtual ReturnCode_t publishInterfaces(ConnectorProfile &connector_profile)
Publish interface information.