Into

Modules

Documentation

classPiiSerializer

#include <PiiSerializer.h>

Serializer is an object that takes care of serializing objects.

Inherited by PiiSerializerTemplate< Archive, T >

Description

Each archive type has a static registry of serializers stored in a hash map. The reason serialization goes through PiiSerializer is that this allows one to conveniently create a name-based dictionary of serializers with virtual serialization functions.

Public types

typedef QHash< PiiConstCharWrapper, PiiSerializer< Archive > * >

The type of the serializer map.

Constructors and destructor

(
  • const char * name
)

Create a new serializer and insert it to the static serializer map.

virtual

Removes this from the archive's serializer map.

Public member functions

virtual void
(
  • Archive & archive
  • void * value
  • const unsigned int version
)  = 0

Subclasses override this function to serialize any custom type.

Static public member functions

static QList< const char * >
( )

Returns a list of type names for all registered serializers.

template<class T>
static bool
(
  • const char * className
  • Archive & archive
  • T & value
  • const unsigned int version
)

Seializes an object of type T.

static const PiiSerializer *
(
  • const char * className
)

Returns the serializer associated with className, or 0 if no serializer is found.

Protected member functions

(
  • const char * name
)

Create a new serializer and insert it to the static serializer map.

Function details

  • PiiSerializer

    (
    • const char * name
    )
    [protected]

    Create a new serializer and insert it to the static serializer map.

    The class is identified by the given name, which must be application-wide unique.

  • virtual ~PiiSerializer

    ()
    [virtual]

    Removes this from the archive's serializer map.

  • static QList< const char * > keys

    ()
    [static]

    Returns a list of type names for all registered serializers.

  • template<class T>

    static bool serialize

    (
    • const char * className
    • Archive & archive
    • T & value
    • const unsigned int version
    )
    [static]

    Seializes an object of type T.

    If T is a dynamic type, this function fetches a serializer for the type denoted by className. If no serializer is found, returns false. Otherwise, it calls the virtual serialize() function of the found serializer and returns true. If the type is not dynamic, PiiSerialization::serialize() will be called directly.

  • static const PiiSerializer * serializer

    (
    • const char * className
    )
    [inline, static]

    Returns the serializer associated with className, or 0 if no serializer is found.

  • virtual void serialize

    (
    • Archive & archive
    • void * value
    • const unsigned int version
    )
    [pure virtual]

    Subclasses override this function to serialize any custom type.

    Parameters
    archive

    the archive to store the data into

    value

    a pointer to the object to be stored. Subclasses should use reinterpret_cast to convert the pointer to the correct type.

    version

    the version of the class

Notes (0)

Add a note

Not a single note added yet. Be the first, add yours.