94 template <
class DataType>
153 bool read_block =
false,
bool write_block =
false,
154 int read_timeout = 0,
int write_timeout = 0)
155 #if defined(__GNUC__) && (__GNUC__ <= 3 && __GNUC_MINOR__ <= 3) 156 :
InPortBase(name, ::CORBA_Util::toRepositoryIdOfStruct<DataType>()),
158 :
InPortBase(name, ::CORBA_Util::toRepositoryId<DataType>()),
161 m_name(name), m_value(value),
162 m_OnRead(NULL), m_OnReadConvert(NULL),
163 m_status(1), m_directNewData(
false)
210 return m_name.c_str();
246 Guard gurad(m_valueMutex);
247 if (m_directNewData ==
true)
249 RTC_DEBUG((
"isNew() returns true because of direct write."));
266 RTC_DEBUG((
"isNew() = true, readable data: %d", r));
270 RTC_DEBUG((
"isNew() = false, no readable data"));
300 if (m_directNewData ==
true) {
return false; }
318 RTC_DEBUG((
"isEmpty() = true, buffer is empty"));
322 RTC_DEBUG((
"isEmpty() = false, data exists in the buffer"));
326 virtual void write(
const DataType& data)
328 Guard guard(m_valueMutex);
330 m_directNewData =
true;
411 if (m_OnRead != NULL)
418 Guard guard(m_valueMutex);
419 if (m_directNewData ==
true)
422 if (m_OnReadConvert != 0)
424 m_value = (*m_OnReadConvert)(m_value);
425 RTC_DEBUG((
"OnReadConvert for direct data called"));
428 m_directNewData =
false;
458 Guard guard(m_valueMutex);
461 if (m_OnReadConvert != 0)
463 m_value = (*m_OnReadConvert)(m_value);
484 RTC_ERROR((
"unknown retern value from buffer.read()"));
665 m_OnReadConvert = on_rconvert;
669 std::string m_typename;
723 bool m_directNewData;
728 #endif // RTC_INPORT_H virtual void write(const DataType &data)
Definition: InPort.h:326
#define RTC_ERROR(fmt)
Error log output macro.
Definition: SystemLogger.h:500
#define DATAPORTSTATUS_ENUM
Importing RTC::DataPortStatus macro.
Definition: DataPortStatus.h:233
#define RTC_TRACE(fmt)
Trace level log output macro.
Definition: SystemLogger.h:588
Mutex class.
Definition: Mutex.h:40
coil::Mutex m_connectorsMutex
Definition: PortBase.h:2110
Definition: ConnectorListener.h:146
virtual ~InPort(void)
Destructor.
Definition: InPort.h:187
DATAPORTSTATUS_ENUM InPort(const char *name, DataType &value, int bufsize=64, bool read_block=false, bool write_block=false, int read_timeout=0, int write_timeout=0)
A constructor.
Definition: InPort.h:151
Definition: Timestamp.h:26
virtual const char * name()
Get port name.
Definition: InPort.h:208
#define RTC_WARN(fmt)
Warning log output macro.
Definition: SystemLogger.h:522
virtual bool isEmpty()
Check whether the data is newest.
Definition: InPort.h:297
Data convert callback abstract class on read()
Definition: PortCallback.h:385
void setOnReadConvert(OnReadConvert< DataType > *on_rconvert)
Set callback when data is readout to the InPort buffer.
Definition: InPort.h:663
std::vector< DataPortStatus::Enum > DataPortStatusList
Definition: DataPortStatus.h:206
Definition: DirectInPortBase.h:48
#define RTC_DEBUG(fmt)
Debug level log output macro.
Definition: SystemLogger.h:566
InPortConnector base class.
virtual void update()
Read the newly value to type-T variable which is bound to InPort's buffer.
Definition: InPort.h:511
InPortBase(const char *name, const char *data_type)
Constructor.
DirectPortBase * m_directport
Definition: PortBase.h:2235
Port for InPort.
Definition: InPortBase.h:74
Definition: ConnectorListener.h:144
Definition: DataPortStatus.h:145
RTC::Port implementation for InPort.
InPort template class.
Definition: InPort.h:95
virtual bool isNew()
Check whether the data is newest.
Definition: InPort.h:238
DataPortStatus::Enum getStatus(int index)
Getting specified connector's writing status.
Definition: InPort.h:575
void setOnRead(OnRead< DataType > *on_read)
Set callback when data is read from the InPort buffer.
Definition: InPort.h:635
Timestamp listener class.
DataPortStatusList getStatusList()
Getting specified connector's writing status list.
Definition: InPort.h:609
Definition: DataPortStatus.h:150
void operator>>(DataType &rhs)
Read the newly value data in InPort to type-T variable.
Definition: InPort.h:536
void addConnectorDataListener(ConnectorDataListenerType listener_type, ConnectorDataListener *listener, bool autoclean=true)
Adding BufferDataListener type listener.
Enum
DataPortStatus return codes.
Definition: DataPortStatus.h:143
ConnectorList m_connectors
Connection list.
Definition: InPortBase.h:880
bool read()
Readout the value from DataPort.
Definition: InPort.h:407
Callback abstract class on read()
Definition: PortCallback.h:323
Definition: DataPortStatus.h:149