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"));
106 RTC_ERROR((
"default buffer creation failed"));
120 RTC_ERROR((
"invalid connection_limit value: %s",
217 RTC_TRACE((
"getConnectorById(id = %s)",
id));
227 RTC_WARN((
"ConnectorProfile with the id(%s) not found.",
id));
240 RTC_TRACE((
"getConnectorByName(name = %s)", name));
242 std::string sname(name);
250 RTC_WARN((
"ConnectorProfile with the name(%s) not found.", name));
264 RTC_TRACE((
"getConnectorProfileById(id = %s)",
id));
284 RTC_TRACE((
"getConnectorProfileByName(name = %s)", name));
329 RTC_DEBUG((
"deactivate connector: %s %s",
353 RTC_TRACE((
"addConnectorDataListener(%s)",
358 RTC_ERROR((
"addConnectorDataListener(): Invalid listener type."));
368 RTC_TRACE((
"removeConnectorDataListener(%s)",
373 RTC_ERROR((
"removeConnectorDataListener(): Invalid listener type."));
397 RTC_ERROR((
"addConnectorListener(): Invalid listener type."));
406 RTC_TRACE((
"removeConnectorListener(%s)",
411 RTC_ERROR((
"removeConnectorListener(): Invalid listener type."));
434 throw (CORBA::SystemException)
440 "dataport.serializer.cdr.endian"));
443 RTC_TRACE((
"ConnectorProfile dataport.serializer.cdr.endian set."));
446 NVUtil::newNV(
"dataport.serializer.cdr.endian",
"little,big"));
477 prop << conn_prop.
getNode(
"dataport");
484 prop << conn_prop.
getNode(
"dataport.inport");
486 RTC_DEBUG((
"ConnectorProfile::properties are as follows."));
495 std::string dflow_type(prop[
"dataflow_type"]);
498 if (dflow_type ==
"push")
500 RTC_DEBUG((
"dataflow_type = push .... create PushConnector"));
506 RTC_ERROR((
"InPort provider creation failed."));
514 RTC_ERROR((
"PushConnector creation failed."));
521 RTC_DEBUG((
"publishInterface() successfully finished."));
524 else if (dflow_type ==
"pull")
526 RTC_DEBUG((
"dataflow_type = pull .... do nothing"));
530 RTC_ERROR((
"unsupported dataflow_type: %s", dflow_type.c_str()));
550 prop << conn_prop.
getNode(
"dataport");
557 prop << conn_prop.
getNode(
"dataport.inport");
559 RTC_DEBUG((
"ConnectorProfile::properties are as follows."));
568 RTC_TRACE((
"endian: %s", littleEndian ?
"little" :
"big"));
576 std::string dflow_type(prop[
"dataflow_type"]);
579 if (dflow_type ==
"push")
587 RTC_ERROR((
"specified connector not found: %s",
588 (
const char*)cprof.connector_id));
593 RTC_DEBUG((
"subscribeInterfaces() successfully finished."));
596 else if (dflow_type ==
"pull")
614 RTC_DEBUG((
"subscribeInterfaces() successfully finished."));
618 RTC_ERROR((
"unsupported dataflow_type: %s", dflow_type.c_str()));
634 std::string
id(connector_profile.connector_id);
641 if (
id == (*it)->id())
649 RTC_TRACE((
"delete connector: %s",
id.c_str()));
654 RTC_ERROR((
"specified connector not found: %s",
id.c_str()));
675 #ifndef RTC_NO_DATAPORTIF_ACTIVATION_OPTION 683 provider_types.clear();
687 std::sort(temp_types.begin(), temp_types.end());
688 std::sort(active_types.begin(), active_types.end());
689 std::set_intersection(temp_types.begin(), temp_types.end(),
690 active_types.begin(), active_types.end(),
691 std::back_inserter(provider_types));
696 if (provider_types.size() > 0)
698 RTC_DEBUG((
"dataflow_type push is supported"));
724 #ifndef RTC_NO_DATAPORTIF_ACTIVATION_OPTION 732 consumer_types.clear();
736 std::sort(temp_types.begin(), temp_types.end());
737 std::sort(active_types.begin(), active_types.end());
738 std::set_intersection(temp_types.begin(), temp_types.end(),
739 active_types.begin(), active_types.end(),
740 std::back_inserter(consumer_types));
745 if (consumer_types.size() > 0)
767 if(prop.
hasKey(
"serializer") == NULL)
774 std::string endian_type(prop.
getProperty(
"serializer.cdr.endian",
""));
775 RTC_DEBUG((
"endian_type: %s", endian_type.c_str()));
777 std::vector<std::string> endian(
coil::split(endian_type,
","));
779 if(endian.empty()) {
return false; }
780 if(endian[0] ==
"little")
785 else if(endian[0] ==
"big")
787 littleEndian =
false;
805 if (!prop[
"interface_type"].empty() &&
809 RTC_DEBUG((
"interface_type: %s", prop[
"interface_type"].c_str()));
815 RTC_DEBUG((
"interface_type: %s", prop[
"interface_type"].c_str()));
818 instance().createObject(prop[
"interface_type"].c_str());
828 RTC_ERROR((
"publishing interface information error"));
832 #else // ORB_IS_RTORB 834 ::SDOPackage::NVList_ptr prop_ref(cprof.properties);
837 RTC_ERROR((
"publishing interface information error"));
841 #endif // ORB_IS_RTORB 860 if (!prop[
"interface_type"].empty() &&
864 RTC_DEBUG((
"interface_type: %s", prop[
"interface_type"].c_str()));
870 RTC_DEBUG((
"interface_type: %s", prop[
"interface_type"].c_str()));
873 instance().createObject(prop[
"interface_type"].c_str());
882 RTC_ERROR((
"interface subscription failed."));
910 #else // ORB_IS_RTORB 916 #endif // ORB_IS_RTORB 936 RTC_ERROR((
"old compiler? new returned 0;"));
939 RTC_TRACE((
"InPortPushConnector created"));
945 catch (std::bad_alloc& e)
947 RTC_ERROR((
"InPortPushConnector creation failed"));
950 RTC_FATAL((
"never comes here: createConnector()"));
971 #else // ORB_IS_RTORB 977 #endif // ORB_IS_RTORB 995 RTC_ERROR((
"old compiler? new returned 0;"));
998 RTC_TRACE((
"InPortPushConnector created"));
1006 catch (std::bad_alloc& e)
1008 RTC_ERROR((
"InPortPullConnector creation failed"));
1011 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.
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
Properties * hasKey(const char *key) const
Check whether key exists in the children.
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.
#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.
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.
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(CorbaSequence &seq, SequenceElement elem)
Push the new element back to the CORBA sequence.
OutPortConsumer abstract class.
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.
const std::string & getProperty(const std::string &key) const
Search for the property with the specified key in this property.
InPortProvider * createProvider(ConnectorProfile &cprof, coil::Properties &prop)
InPort provider creation.
virtual ReturnCode_t publishInterfaces(ConnectorProfile &connector_profile)
Publish interface information.