#include <TypelibMarshallerBase.hpp>
Classes | |
struct | Handle |
Public Member Functions | |
Handle * | createHandle () |
virtual Handle * | createSample ()=0 |
virtual RTT::base::ChannelElementBase::shared_ptr | createStream (RTT::base::PortInterface *port, const RTT::ConnPolicy &policy, bool is_sender) const |
void | deleteHandle (Handle *data) |
virtual void | deleteOrocosSample (Handle *data)=0 |
virtual void | deleteTypelibSample (Handle *data)=0 |
virtual RTT::base::DataSourceBase::shared_ptr | getDataSource (Handle *handle)=0 |
size_t | getMarshallingSize (Handle const *sample) const |
char const * | getMarshallingType () const |
uint8_t * | getTypelibSample (Handle *sample) |
bool | isPlainTypelibType () const |
int | marshal (void *buffer, int buffer_size, Handle *sample) |
void | marshal (std::vector< uint8_t > &buffer, Handle *sample) |
void | marshal (std::ostream &stream, Handle *sample) |
void | marshal (int fd, Handle *sample) |
virtual bool | readDataSource (RTT::base::DataSourceBase &source, Handle *handle)=0 |
virtual void | refreshOrocosSample (Handle *data)=0 |
virtual void | refreshTypelibSample (Handle *handle)=0 |
virtual uint8_t * | releaseOrocosSample (Handle *sample)=0 |
virtual void | setOrocosSample (Handle *data, void *sample, bool refresh_typelib=true)=0 |
virtual void | setTypelibSample (Handle *data, uint8_t *typelib_data, bool refresh_orocos=true)=0 |
void | setTypelibSample (Handle *data, Typelib::Value typelib_data, bool refresh_orocos=true) |
TypelibMarshallerBase (bool plain_type, std::string const &typelib_typename, std::string const &orocos_typename, Typelib::Registry const ®istry) | |
virtual void | unmarshal (void const *buffer, int buffer_size, Handle *sample) |
virtual void | unmarshal (std::vector< uint8_t > &buffer, Handle *sample) |
virtual void | writeDataSource (RTT::base::DataSourceBase &source, Handle const *handle)=0 |
Private Attributes | |
Typelib::MemoryLayout | layout |
bool | m_plain |
std::string | m_typename_orocos |
std::string | m_typename_typelib |
Typelib::Type const * | type_def |
Definition at line 13 of file TypelibMarshallerBase.hpp.
orogen_transports::TypelibMarshallerBase::TypelibMarshallerBase | ( | bool | plain_type, | |
std::string const & | typelib_typename, | |||
std::string const & | orocos_typename, | |||
Typelib::Registry const & | registry | |||
) |
Handle* orogen_transports::TypelibMarshallerBase::createHandle | ( | ) |
Creates a sample handler, which is an opaque type used to read/write/marshal data. Unlike createSample(), the handle returned by this method does not contain any preallocated data sample. Using it in readPort will cause memory allocation.
virtual Handle* orogen_transports::TypelibMarshallerBase::createSample | ( | ) | [pure virtual] |
Creates a sample handler, which is an opaque type used to read/write/marshal data. Unlike createHandle(), the handle returned by this method already contains a preallocated data sample. It can therefore be used as-is for readPort.
Implemented in orogen_transports::OpaqueTypelibMarshaller< TypelibType, OpaqueType, 0 >, orogen_transports::OpaqueTypelibMarshaller< TypelibType, OpaqueType, 1 >, and orogen_transports::TypelibMarshaller< T >.
virtual RTT::base::ChannelElementBase::shared_ptr orogen_transports::TypelibMarshallerBase::createStream | ( | RTT::base::PortInterface * | port, | |
const RTT::ConnPolicy & | policy, | |||
bool | is_sender | |||
) | const [inline, virtual] |
Creates a streaming channel element for reading or writing over this transport. It returns a ChannelElementBase that provides the implementation of sending or receiving data through the transport. Both sender and receiver find each other using the channel_id argument. Transports that do not support streaming may return null
port | The port for which this channel is setup. | |
channel_id | If the transport receives a non-empty channel_id, it will create a channel that connects to this id. If channel id is empty, it will be filled in with a unique identifier that identifies this channel. This allows the local caller to connect to the remote channel in a second invocation of createRemoteChannel. | |
is_sender | Set to true in case you will write() to this channel element, set it to false in case you will read() from this channel element. |
Implements RTT::types::TypeTransporter.
Definition at line 161 of file TypelibMarshallerBase.hpp.
void orogen_transports::TypelibMarshallerBase::deleteHandle | ( | Handle * | data | ) |
Destroys the sample handle and the data it owns.
What is actually deleted depends on how the handle has been used. For instance, if setTypelibSample has been used, then the sample will not be deleted.
virtual void orogen_transports::TypelibMarshallerBase::deleteOrocosSample | ( | Handle * | data | ) | [pure virtual] |
Destroys the orocos-related data sample that is stored in data
.
For non-opaque types, this is the same than destroyOrocosSample and destroyData. It is different only for opaque types.
Implemented in orogen_transports::OpaqueTypelibMarshallerBase< TypelibType, OpaqueType >, and orogen_transports::TypelibMarshaller< T >.
virtual void orogen_transports::TypelibMarshallerBase::deleteTypelibSample | ( | Handle * | data | ) | [pure virtual] |
Destroys the typelib-related data sample that is stored in data
.
For non-opaque types, this is the same than destroyTypelibSample and destroyData. It is different only for opaque types.
Implemented in orogen_transports::OpaqueTypelibMarshallerBase< TypelibType, OpaqueType >, and orogen_transports::TypelibMarshaller< T >.
virtual RTT::base::DataSourceBase::shared_ptr orogen_transports::TypelibMarshallerBase::getDataSource | ( | Handle * | handle | ) | [pure virtual] |
Returns a data source that can be used to modify the Orocos sample stored in this handle
Implemented in orogen_transports::OpaqueTypelibMarshallerBase< TypelibType, OpaqueType >, and orogen_transports::TypelibMarshaller< T >.
size_t orogen_transports::TypelibMarshallerBase::getMarshallingSize | ( | Handle const * | sample | ) | const |
Returns the marshalled size for the given data sample
char const* orogen_transports::TypelibMarshallerBase::getMarshallingType | ( | ) | const |
Returns the Typelib-friendly type name for this marshaller. I.e. the type name for the pointer returned by getTypelibData.
I.e. if the type is opaque, it is the name of the intermediate type. Otherwise, it is the type name itself.
uint8_t* orogen_transports::TypelibMarshallerBase::getTypelibSample | ( | Handle * | sample | ) |
Returns a type-pruned pointer to an object that Typelib understands. This object is of the type returned by getMarshallingType
bool orogen_transports::TypelibMarshallerBase::isPlainTypelibType | ( | ) | const |
Returns true if the underlying orocos type can be manipulated by typelib directly and false otherwise
int orogen_transports::TypelibMarshallerBase::marshal | ( | void * | buffer, | |
int | buffer_size, | |||
Handle * | sample | |||
) |
Marshals the given sample into a memory buffer
void orogen_transports::TypelibMarshallerBase::marshal | ( | std::vector< uint8_t > & | buffer, | |
Handle * | sample | |||
) |
Marshals the given sample into a memory buffer
void orogen_transports::TypelibMarshallerBase::marshal | ( | std::ostream & | stream, | |
Handle * | sample | |||
) |
Marshals the given sample directly on to a C++ stream
void orogen_transports::TypelibMarshallerBase::marshal | ( | int | fd, | |
Handle * | sample | |||
) |
Marshals the given sample directly on to a file
virtual bool orogen_transports::TypelibMarshallerBase::readDataSource | ( | RTT::base::DataSourceBase & | source, | |
Handle * | handle | |||
) | [pure virtual] |
Reads the data from a data source a handle
Implemented in orogen_transports::OpaqueTypelibMarshallerBase< TypelibType, OpaqueType >, and orogen_transports::TypelibMarshaller< T >.
virtual void orogen_transports::TypelibMarshallerBase::refreshOrocosSample | ( | Handle * | data | ) | [pure virtual] |
Updates the value of data->orocos_sample based on the data in data->typelib_sample
Implemented in orogen_transports::OpaqueTypelibMarshaller< TypelibType, OpaqueType, 0 >, orogen_transports::OpaqueTypelibMarshaller< TypelibType, OpaqueType, 1 >, and orogen_transports::TypelibMarshaller< T >.
virtual void orogen_transports::TypelibMarshallerBase::refreshTypelibSample | ( | Handle * | handle | ) | [pure virtual] |
Updates the value of data->typelib_sample based on the data in data->orocos_sample
Implemented in orogen_transports::OpaqueTypelibMarshaller< TypelibType, OpaqueType, 0 >, orogen_transports::OpaqueTypelibMarshaller< TypelibType, OpaqueType, 1 >, and orogen_transports::TypelibMarshaller< T >.
virtual uint8_t* orogen_transports::TypelibMarshallerBase::releaseOrocosSample | ( | Handle * | sample | ) | [pure virtual] |
Returns a type-pruned pointer to the C++ object, and passes ownership along
Implemented in orogen_transports::OpaqueTypelibMarshallerBase< TypelibType, OpaqueType >, and orogen_transports::TypelibMarshaller< T >.
virtual void orogen_transports::TypelibMarshallerBase::setOrocosSample | ( | Handle * | data, | |
void * | sample, | |||
bool | refresh_typelib = true | |||
) | [pure virtual] |
Updates the sample handler by using a data sample that Typelib understands. +typelib_data+ must be pointing to an object whose type is the one returned by getMarshallingType.
The handle will then point directly to the given data sample, i.e. calls to read
might modify that sample directly.
The ownership of typelib_data
is retained by the caller. I.e. it has to delete it.
Implemented in orogen_transports::OpaqueTypelibMarshallerBase< TypelibType, OpaqueType >, and orogen_transports::TypelibMarshaller< T >.
virtual void orogen_transports::TypelibMarshallerBase::setTypelibSample | ( | Handle * | data, | |
uint8_t * | typelib_data, | |||
bool | refresh_orocos = true | |||
) | [pure virtual] |
Updates the sample handler by using a data sample that Typelib understands. +typelib_data+ must be pointing to an object whose type is the one returned by getMarshallingType.
The handle will then point directly to the given data sample, i.e. calls to read
might modify that sample directly.
The ownership of typelib_data
is retained by the caller. I.e. it has to delete it.
Implemented in orogen_transports::OpaqueTypelibMarshaller< TypelibType, OpaqueType, 0 >, orogen_transports::OpaqueTypelibMarshaller< TypelibType, OpaqueType, 1 >, and orogen_transports::TypelibMarshaller< T >.
void orogen_transports::TypelibMarshallerBase::setTypelibSample | ( | Handle * | data, | |
Typelib::Value | typelib_data, | |||
bool | refresh_orocos = true | |||
) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
virtual void orogen_transports::TypelibMarshallerBase::unmarshal | ( | void const * | buffer, | |
int | buffer_size, | |||
Handle * | sample | |||
) | [virtual] |
Update the sample in +sample+ from the marshalled data in +buffer+
Reimplemented in orogen_transports::OpaqueTypelibMarshallerBase< TypelibType, OpaqueType >.
virtual void orogen_transports::TypelibMarshallerBase::unmarshal | ( | std::vector< uint8_t > & | buffer, | |
Handle * | sample | |||
) | [virtual] |
Update the sample in +sample+ from the marshalled data in +buffer+
Reimplemented in orogen_transports::OpaqueTypelibMarshallerBase< TypelibType, OpaqueType >.
virtual void orogen_transports::TypelibMarshallerBase::writeDataSource | ( | RTT::base::DataSourceBase & | source, | |
Handle const * | handle | |||
) | [pure virtual] |
Writes the data from from the handle into the data source
Implemented in orogen_transports::OpaqueTypelibMarshallerBase< TypelibType, OpaqueType >, and orogen_transports::TypelibMarshaller< T >.
Typelib::MemoryLayout orogen_transports::TypelibMarshallerBase::layout [private] |
Definition at line 17 of file TypelibMarshallerBase.hpp.
bool orogen_transports::TypelibMarshallerBase::m_plain [private] |
Definition at line 15 of file TypelibMarshallerBase.hpp.
std::string orogen_transports::TypelibMarshallerBase::m_typename_orocos [private] |
Definition at line 19 of file TypelibMarshallerBase.hpp.
std::string orogen_transports::TypelibMarshallerBase::m_typename_typelib [private] |
Definition at line 18 of file TypelibMarshallerBase.hpp.
Typelib::Type const* orogen_transports::TypelibMarshallerBase::type_def [private] |
Definition at line 16 of file TypelibMarshallerBase.hpp.