Thea
Classes | Public Types | Public Member Functions | Static Public Member Functions | Static Public Attributes | List of all members
Codec Class Referenceabstract

A serialization codec. More...

#include <Codec.hpp>

Inheritance diagram for Codec:
INamedObject Codec_UNKNOWN CodecAuto MeshCodec< MeshT > ImageCodec MatrixCodec< MatrixT > CodecJpeg CodecCsv< MatrixT, Enable >

Classes

struct  BlockHeader
 A header preceding a data block serialized using a codec. More...
 

Public Types

typedef std::array< int8,(size_t) MAGIC_LENGTHMagicString
 The type of the codec's magic string (an array of MAGIC_LENGTH bytes). More...
 

Public Member Functions

virtual MagicString const & getMagic () const
 Get the magic string for the codec, if it has one (else a string of all zeros). More...
 
virtual char const * getName () const =0
 Get the name of the object. More...
 
 operator intx () const
 Implicitly convert to an integer value for use in switch statements etc. More...
 
bool operator== (Codec const &other) const
 Check if two codecs are equal. More...
 
int8 setName (char const *s)
 Set the name of the object. More...
 
virtual ~Codec ()=0
 Destructor. More...
 

Static Public Member Functions

static MagicString toMagic (std::string const &s)
 Convenience function to convert a string literal to a magic string. More...
 

Static Public Attributes

static intx const MAGIC_LENGTH = 8
 The standard length (in bytes) of the codec's magic string as used in BlockHeader. More...
 

Detailed Description

A serialization codec.

Identified by an ID that is unique for a given run of the program (it is not guaranteed to retain its value over different runs).

Definition at line 33 of file Codec.hpp.

Member Typedef Documentation

typedef std::array<int8, (size_t)MAGIC_LENGTH> MagicString

The type of the codec's magic string (an array of MAGIC_LENGTH bytes).

Definition at line 42 of file Codec.hpp.

Constructor & Destructor Documentation

~Codec ( )
pure virtual

Destructor.

Definition at line 154 of file Codec.hpp.

Member Function Documentation

virtual MagicString const& getMagic ( ) const
virtual

Get the magic string for the codec, if it has one (else a string of all zeros).

Reimplemented in CodecJpeg.

Definition at line 127 of file Codec.hpp.

virtual char const* getName ( ) const
pure virtualinherited
operator intx ( ) const

Implicitly convert to an integer value for use in switch statements etc.

This value will be common to all instances of the codec class

Definition at line 136 of file Codec.hpp.

bool operator== ( Codec const &  other) const

Check if two codecs are equal.

All instances of a codec class must be considered equal.

Definition at line 130 of file Codec.hpp.

int8 setName ( char const *  s)
virtual

Set the name of the object.

Returns
True if the name was successfully set, else false (e.g. if the name is read-only).

Implements INamedObject.

Definition at line 124 of file Codec.hpp.

static MagicString toMagic ( std::string const &  s)
static

Convenience function to convert a string literal to a magic string.

Definition at line 139 of file Codec.hpp.

Member Data Documentation

intx const MAGIC_LENGTH = 8
static

The standard length (in bytes) of the codec's magic string as used in BlockHeader.

Definition at line 39 of file Codec.hpp.


The documentation for this class was generated from the following file: