47 #ifndef _MIRA_BINARYSERIALIZERCODEC_H_ 48 #define _MIRA_BINARYSERIALIZERCODEC_H_ 51 #include <boost/shared_ptr.hpp> 124 Fourcc(
const std::string& iFourcc=
"NULL")
126 std::size_t l = std::min<std::size_t>(iFourcc.size(),4);
127 for(std::size_t i=0; i<l; ++i)
128 fourcc[i] = iFourcc[i];
129 for(std::size_t i=l; i<4; ++i)
136 template<
typename Reflector>
138 r.member(
"Value", value,
"The 32bit value of the fourcc code");
147 return value==other.
value;
155 return value < other.
value;
160 return std::string(fourcc,4);
170 static_assert(
sizeof(Fourcc)==4,
"Fourcc must have a size of 4 bytes");
176 template<
typename Reflector>
178 r.itemName(this->getClass().getName());
185 std::string s = this->getClass().getMetaInfo(
"FOURCC");
195 virtual TypeId getSupportedTypeId()
const = 0;
200 template <
typename T>
204 return std::move(encodeBuffer(&
object));
208 template <
typename T>
210 decodeBuffer(data, &ioObject);
243 template <
typename T>
248 MIRA_THROW(XInvalidParameter,
"No codec found for fourcc '" <<
249 fourcc.
string() <<
"' and type '" << typeName<T>() <<
"'");
void reflect(Reflector &r)
Definition: BinarySerializerCodec.h:177
static BinarySerializerCodecPtr createCodec(Fourcc fourcc)
Creates a codec with the specified FOURCC code that is suitable for encoding/decoding the specified t...
Definition: BinarySerializerCodec.h:244
virtual ~BinarySerializerCodec()
Definition: BinarySerializerCodec.h:174
specialize cv::DataType for our ImgPixel and inherit from cv::DataType<Vec>
Definition: IOService.h:67
Abstract base class for codecs that can be used with BinarySerializer and BinaryDeserializer.
Definition: BinarySerializerCodec.h:113
Same as TypedVoidPtr but const.
Definition: TypedVoidPtr.h:171
Get compiler and platform independent typenames.
uint32 value
Definition: BinarySerializerCodec.h:166
Type safe handling of typed void pointers.
#define MIRA_THROW(ex, msg)
Macro for throwing an exception.
Definition: Exception.h:82
Buffer< uint8 > encode(const T &object)
Encodes the given object and returns the buffer with the encoded data.
Definition: BinarySerializerCodec.h:201
#define MIRA_ABSTRACT_OBJECT(classIdentifier)
Use this MACRO instead of MIRA_OBJECT to declare the class as abstract.
Definition: FactoryMacros.h:235
Class that allows to maintain type-safety when passing void pointers.
Definition: TypedVoidPtr.h:101
$Header file containing base classes to enable class creation using a class factory$ ...
A four-character code that is used to identify data formats and codecs.
Definition: BinarySerializerCodec.h:121
PropertyHint type(const std::string &t)
Sets the attribute "type" to the specified value.
Definition: PropertyHint.h:295
Fourcc(const std::string &iFourcc="NULL")
Constructs Fourcc from string.
Definition: BinarySerializerCodec.h:124
The object class acts as a generic base class for classes which should be used with the classFactory...
Definition: Object.h:144
bool operator!=(Fourcc other) const
Definition: BinarySerializerCodec.h:150
bool operator==(const ImgIteratorBase &a, const ImgIteratorBase &b)
Definition: ImgIterator.h:225
Fourcc(uint32 val)
Constructs Fourcc from 32bit value.
Definition: BinarySerializerCodec.h:134
void decode(const Buffer< uint8 > &data, T &ioObject)
Decodes the given buffer into the object.
Definition: BinarySerializerCodec.h:209
bool operator==(Fourcc other) const
Definition: BinarySerializerCodec.h:146
int TypeId
The type of the integral TypeId, that can be retrieved by typeId<T>()
Definition: TypeId.h:64
bool operator<(Fourcc other) const
Definition: BinarySerializerCodec.h:154
std::string string() const
Returns the fourcc as human readable string.
Definition: BinarySerializerCodec.h:159
Generic buffer class that can be used as a replacement for std::vector.
static Fourcc null()
Returns the 'NULL' fourcc.
Definition: BinarySerializerCodec.h:142
virtual Fourcc getFourcc() const
Returns the Fourcc code information.
Definition: BinarySerializerCodec.h:184
void reflect(Reflector &r)
Definition: BinarySerializerCodec.h:137
boost::shared_ptr< BinarySerializerCodec > BinarySerializerCodecPtr
Shared pointer of BinarySerializerCodec.
Definition: BinarySerializerCodec.h:64