20 #ifndef RTC_BYTEDATASTREAMBASE_H 21 #define RTC_BYTEDATASTREAMBASE_H 23 #include <coil/Properties.h> 24 #include <coil/Factory.h> 128 virtual void writeData(
const unsigned char *buffer,
unsigned long length) = 0;
145 virtual void readData(
unsigned char *buffer,
unsigned long length)
const = 0;
198 template <
typename DataType>
250 virtual bool serialize(
const DataType &data) = 0;
266 virtual bool deserialize(DataType &data) = 0;
291 template <
class DataType>
294 std::string mtype{std::string(::CORBA_Util::toRepositoryId<DataType>()) +
":" + marshalingtype};
313 template <
class DataType,
class SerializerType>
316 std::string mtype = addDataTypeToMarshalingType<DataType>(marshalingtype);
317 SerializerFactory::instance()
340 template <
class DataType>
343 std::string mtype = addDataTypeToMarshalingType<DataType>(marshalingtype);
344 SerializerFactory::instance().removeFactory(mtype);
362 template <
class DataType>
365 std::string mtype = addDataTypeToMarshalingType<DataType>(marshalingtype);
366 return SerializerFactory::instance().createObject(mtype);
384 template <
class DataType>
387 std::vector<std::string> available_types;
388 std::vector<std::string> types = SerializerFactory::instance().getIdentifiers();
390 for (
auto type : types)
392 std::string
id{::CORBA_Util::toRepositoryId<DataType>()};
393 if (type.size() >=
id.size() && std::equal(std::begin(
id), std::end(
id), std::begin(type)))
395 type.erase(0,
id.size() + 1);
396 available_types.push_back(type);
399 return available_types;
404 EXTERN
template class DLL_PLUGIN coil::GlobalFactory<::RTC::ByteDataStreamBase>;
406 #endif // RTC_BYTEDATASTREAMBASE_H
virtual void writeData(const unsigned char *buffer, unsigned long length)=0
std::string addDataTypeToMarshalingType(const std::string &marshalingtype)
Definition: ByteDataStreamBase.h:292
virtual void isLittleEndian(bool little_endian)
::RTC::ByteDataStreamBase * createSerializer(const std::string &marshalingtype)
Definition: ByteDataStreamBase.h:363
ByteDataStreamBase()
Constructor.
std::vector< std::string > getSerializerList()
Definition: ByteDataStreamBase.h:385
virtual void init(const coil::Properties &prop)
void addSerializer(const std::string &marshalingtype)
Definition: ByteDataStreamBase.h:314
virtual void readData(unsigned char *buffer, unsigned long length) const =0
void removeSerializer(const std::string &marshalingtype)
Definition: ByteDataStreamBase.h:341
virtual unsigned long getDataLength() const =0
Definition: ByteDataStreamBase.h:62
virtual ~ByteDataStreamBase()
Virtual destractor.
coil::Properties Properties
Definition: RTC.h:72
Definition: ByteDataStreamBase.h:199
coil::GlobalFactory< ByteDataStreamBase > SerializerFactory
Definition: ByteDataStreamBase.h:269