- Aldebaran documentation |
- C++ Libraries |
- index

libqi-api 2.8.7.4

- Main Page
- Related Pages
- Namespaces
- Classes
- Files
- Examples

- File List
- File Members

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
binarycodec.hpp
Go to the documentation of this file.
1 #pragma once
2 /*
3 ** Copyright (C) 2013 Aldebaran Robotics
4 ** See COPYING for the license
5 */
6
7 #ifndef _QI_TYPE_BINARYCODEC_HPP_
8 #define _QI_TYPE_BINARYCODEC_HPP_
9
10 #include <qi/atomic.hpp>
11
12 #include <qi/api.hpp>
13 #include <boost/function.hpp>
14 #include <qi/buffer.hpp>
15 #include <qi/anyvalue.hpp>
16 #include <qi/type/metaobject.hpp>
17 #include <qi/objectuid.hpp>
18
19 namespace qi {
20
22 struct ObjectSerializationInfo
23 {
24 ObjectSerializationInfo()
25 : transmitMetaObject(true),
26 metaObjectCachedId(notCached)
27 {}
28
29 MetaObject metaObject;
30 bool transmitMetaObject;
31 qi::uint32_t metaObjectCachedId;
32 qi::uint32_t serviceId;
33 qi::uint32_t objectId;
34 boost::optional<ObjectUid> objectUid;
35 static const qi::uint32_t notCached = 0xFFFFFFFF;
36 };
37
38 class StreamContext;
39
41 using DeserializeObjectCallback = boost::function<AnyObject(const ObjectSerializationInfo&)>;
42
44 using SerializeObjectCallback = boost::function<ObjectSerializationInfo(const AnyObject&)>;
45
46 template <typename T>
47 AnyReference decodeBinary(qi::BufferReader *buf, T* value,
48 DeserializeObjectCallback onObject=DeserializeObjectCallback(),
49 StreamContext* streamContext = 0
50 );
51
59 QI_API void encodeBinary(qi::Buffer *buf, const AutoAnyReference &gvp, SerializeObjectCallback onObject=SerializeObjectCallback(), StreamContext* ctx=0);
60
61
71 QI_API AnyReference decodeBinary(qi::BufferReader *buf, AnyReference gvp, DeserializeObjectCallback onObject=DeserializeObjectCallback(), StreamContext* ctx = 0);
72
73 template <typename T>
74 AnyReference decodeBinary(qi::BufferReader *buf, T* value, DeserializeObjectCallback onObject, StreamContext* ctx) {
75 return decodeBinary(buf, AnyReference::fromPtr(value), onObject, ctx);
76 }
77 }
78
79 #endif // _QITYPE_BINARYCODEC_HPP_
qi::ObjectSerializationInfo::metaObject
MetaObject metaObject
Definition: binarycodec.hpp:29
qi::decodeBinary
AnyReference decodeBinary(qi::BufferReader *buf, T *value, DeserializeObjectCallback onObject=DeserializeObjectCallback(), StreamContext *streamContext=0)
Definition: binarycodec.hpp:74
qi::ObjectSerializationInfo::transmitMetaObject
bool transmitMetaObject
Definition: binarycodec.hpp:30
QI_API
#define QI_API
Definition: api.hpp:33
objectuid.hpp
qi::uint32_t
uint32_t uint32_t
Definition: types.hpp:65
qi::ObjectSerializationInfo::ObjectSerializationInfo
ObjectSerializationInfo()
Definition: binarycodec.hpp:24
qi::DeserializeObjectCallback
boost::function< AnyObject(const ObjectSerializationInfo &)> DeserializeObjectCallback
Type of callback invoked by sdeerializer when it encounters an object.
Definition: binarycodec.hpp:41
qi::ObjectSerializationInfo::objectId
qi::uint32_t objectId
Definition: binarycodec.hpp:33
qi::encodeBinary
void encodeBinary(qi::Buffer *buf, const AutoAnyReference &gvp, SerializeObjectCallback onObject=SerializeObjectCallback(), StreamContext *ctx=0)
metaobject.hpp
qi::AnyReference
Definition: anyreference.hpp:360
qi::ObjectSerializationInfo::notCached
static const qi::uint32_t notCached
Definition: binarycodec.hpp:35
api.hpp
dll import/export and compiler message
qi::ObjectSerializationInfo::metaObjectCachedId
qi::uint32_t metaObjectCachedId
Definition: binarycodec.hpp:31
qi::ObjectSerializationInfo
Informations passed when serializing an object.
Definition: binarycodec.hpp:22
qi::ObjectSerializationInfo::objectUid
boost::optional< ObjectUid > objectUid
Definition: binarycodec.hpp:34
qi::SerializeObjectCallback
boost::function< ObjectSerializationInfo(const AnyObject &)> SerializeObjectCallback
Type of callback invoked by serializer when it encounters an object.
Definition: binarycodec.hpp:44
anyvalue.hpp
qi::ObjectSerializationInfo::serviceId
qi::uint32_t serviceId
Definition: binarycodec.hpp:32
buffer.hpp
atomic.hpp
qi::AutoAnyReference
Definition: anyreference.hpp:409
qi::BufferReader
Class to read const buffer. <includename>qi/buffer.hpp</includename> This class is intendeed to rea...
Definition: buffer.hpp:227
qi::detail::AnyReferenceBase::fromPtr
static AnyReference fromPtr(const T *ptr)
Definition: anyreference.hxx:54
qi::Buffer
Class to store buffer. <includename>qi/buffer.hpp</includename> .
Definition: buffer.hpp:76
qi::MetaObject
Description of the signals and methods accessible on an ObjectTypeInterface.
Definition: metaobject.hpp:25