00001 // -*- C++ -*- 00020 #ifndef RTC_OUTPORTCONNECTOR_H 00021 #define RTC_OUTPORTCONNECTOR_H 00022 00023 #include <rtm/SystemLogger.h> 00024 #include <rtm/ConnectorBase.h> 00025 00026 namespace RTC 00027 { 00048 class OutPortConnector 00049 : public ConnectorBase 00050 { 00051 public: 00052 DATAPORTSTATUS_ENUM 00053 00061 OutPortConnector(ConnectorInfo& info); 00062 00070 virtual ~OutPortConnector(); 00084 const ConnectorInfo& profile(); 00085 00099 const char* id(); 00100 00114 const char* name(); 00115 00129 virtual ReturnCode disconnect() = 0; 00130 00144 virtual CdrBufferBase* getBuffer() = 0; 00145 00159 virtual ReturnCode write(const cdrMemoryStream& data) = 0; 00160 00174 virtual void setEndian(const bool endian_type); 00175 00193 virtual bool isLittleEndian(); 00194 00208 template <class DataType> 00209 ReturnCode write(const DataType& data) 00210 { 00211 m_cdr.rewindPtrs(); 00212 RTC_TRACE(("connector endian: %s", isLittleEndian() ? "little":"big")); 00213 m_cdr.setByteSwapFlag(isLittleEndian()); 00214 data >>= m_cdr; 00215 return write(m_cdr); 00216 } 00217 00218 protected: 00226 Logger rtclog; 00234 ConnectorInfo m_profile; 00242 bool m_littleEndian; 00250 cdrMemoryStream m_cdr; 00251 00252 }; 00253 }; // namespace RTC 00254 00255 #endif // RTC_CONNECTORBASE_H