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>
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>;
シリアライザの基底クラス
Definition: ByteDataStreamBase.h:63
ByteDataStreamBase()
コンストラクタ
virtual void init(const coil::Properties &prop)
初期化関数(未使用)
virtual unsigned long getDataLength() const =0
データの長さを取得
virtual void writeData(const unsigned char *buffer, unsigned long length)=0
保持しているバッファにデータを書き込む
virtual void readData(unsigned char *buffer, unsigned long length) const =0
引数のバッファにデータを書き込む
virtual void isLittleEndian(bool little_endian)
エンディアンの設定
virtual ~ByteDataStreamBase()
仮想デストラクタ
シリアライザのテンプレートクラス シリアライザを実装する場合は必ずこのクラスを継承する必要がある coil::GlobalFactory <RTC::ByteDataStream>にシリアライザを登録す...
Definition: ByteDataStreamBase.h:200
ByteDataStream()=default
コンストラクタ
~ByteDataStream() override=default
仮想デストラクタ
virtual bool deserialize(DataType &data)=0
データの復号化
virtual bool serialize(const DataType &data)=0
データの符号化
void removeSerializer(const std::string &marshalingtype)
GlobalFactoryからシリアライザを削除する
Definition: ByteDataStreamBase.h:341
coil::GlobalFactory< ByteDataStreamBase > SerializerFactory
Definition: ByteDataStreamBase.h:269
::RTC::ByteDataStreamBase * createSerializer(const std::string &marshalingtype)
GlobalFactoryからシリアライザを生成する
Definition: ByteDataStreamBase.h:363
std::string addDataTypeToMarshalingType(const std::string &marshalingtype)
シリアライザの名前にデータ型名を追加する 例えば、"corba:RTC/TimedShort:RTC/TimedDouble"という名前のシリアライザ、 データ型がTimedDouble型の場合以下のよ...
Definition: ByteDataStreamBase.h:292
coil::Properties Properties
Definition: RTC.h:72
void addSerializer(const std::string &marshalingtype)
GlobalFactoryにシリアライザを追加する
Definition: ByteDataStreamBase.h:314
std::vector< std::string > getSerializerList()
使用可能なシリアライザの一覧を取得する
Definition: ByteDataStreamBase.h:385