Into

Modules

Documentation

classPiiInputArchive

#include <PiiInputArchive.h>

A base class for input archive implementations.

Description

This class provides functions for saving pointers.

Classes

struct
struct
struct
struct
struct
struct
struct
struct

Public types

enum
{ InputArchive = true, OutputArchive = false }

This enumeration is used as a static constant for compile-time checking of input/output.

Public member functions

template<class T>
void
(
  • T & value
)
template<class T>
void
(
  • T & from
  • T & to
)

Tell the archive that you changed the location of an object after saving it.

template<class T>
Archive &
(
  • const T & value
)
template<class T>
Archive &
(
  • T & value
)

This operator is defined for both input and output archives, which makes it possible to serialize and deserialize data with a single function.

template<class T>
Archive &
(
  • T & value
)
template<class T>
Archive &
(
  • const T & value
)
template<class T>
void
(
  • T *& ptr
  • unsigned int & size
)

Reads an array of size elements to the memory location pointed to by @2 ptr.

Archive *
( )

A design pattern for casting the type of this archive to that of the template parameter.

void

This function is called by PiiInputArchive each time a tracked object is deserialized by a reference to a previously deserialized object.

Friends

friend struct
friend struct
friend struct
friend struct
friend struct
friend struct
friend struct
friend struct

Enumeration details

  • enum @31

    This enumeration is used as a static constant for compile-time checking of input/output.

Function details

  • template<class T>

    void load

    (
    • T & value
    )
    [inline]
  • template<class T>

    void objectMoved

    (
    • T & from
    • T & to
    )
    [inline]

    Tell the archive that you changed the location of an object after saving it.

     QList<MyObj> lst; // filled somehow
    
     // In your load() function:
     for (int i=0; i<elementCount; i++)
       {
         MyObj obj;
         archive >> obj;
         lst << obj;
         // "archive" now thinks &obj is the address of the deserialized object.
         // If a pointer refers to this object, it must be updated
         archive.objectMoved(obj, lst.last());
       }
    
  • template<class T>

    Archive & operator&

    (
    • const T & value
    )
    [inline]

    This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

  • template<class T>

    Archive & operator&

    (
    • T & value
    )
    [inline]

    This operator is defined for both input and output archives, which makes it possible to serialize and deserialize data with a single function.

    The input archive converts the operator to operator>>.

  • template<class T>

    Archive & operator>>

    (
    • T & value
    )
    [inline]

    This function calls Archive::load(value).

  • template<class T>

    Archive & operator>>

    (
    • const T & value
    )
    [inline]
  • template<class T>

    void readArray

    (
    • T *& ptr
    • unsigned int & size
    )
    [inline]

    Reads an array of size elements to the memory location pointed to by @2 ptr.

  • Archive * self

    ()
    [inline]

    A design pattern for casting the type of this archive to that of the template parameter.

  • void rereferencePointer

    (
    • void *
    )
    [inline]

    This function is called by PiiInputArchive each time a tracked object is deserialized by a reference to a previously deserialized object.

    This allows one to do reference counting on tracked objects when reading an archive. The default implementation does nothing. Override this function to perform any action required to restore reference counts.

     namespace PiiSerialization
     {
       inline void rereferencePointer(MyRefCountedObj* ptr)
       {
          ptr->increaseRefCount();
       }
     }
    
Notes (0)

Add a note

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