Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Namespace Members | Class Members | File Members

SerialObj.h File Reference

#include <map>
#include <util.h>
#include "DebugLogger.h"
#include "Continuation.h"
#include "SerialTypes.h"
#include "config.h"

Include dependency graph for SerialObj.h:

Include dependency graph

This graph shows which files directly or indirectly include this file:

Included by dependency graph

Go to the source code of this file.

Classes

class  AutoPush
class  SerialObj
class  SerialTypeRegistrator
class  TransientID

Defines

#define DECLARE_ABSTRACT_SERIAL(classname)
#define DECLARE_SERIAL(classname)
#define IMPLEMENT_SERIAL(classname, classtype)
#define DO_SERIALIZE(classtype, super)
#define DO_UNSERIALIZE(super)
#define SERIALIZE(x)   info->s->Write(x, #x)
#define SERIALIZE_STR(x, y)   info->s->Write(x, y, #x)
#define SERIALIZE_BIT(bit)   info->s->Write(bool(bit), #bit)
#define UNSERIALIZE(x)   info->s->Read(x, #x)
#define UNSERIALIZE_STR(x, y)   info->s->Read(x, y, #x)
#define UNSERIALIZE_BIT(bit)
#define SERIALIZE_OPTIONAL(ptr)
#define SERIALIZE_OPTIONAL_STR(str)
#define UNSERIALIZE_OPTIONAL(dst, unserialize)
#define UNSERIALIZE_OPTIONAL_STR(dst)
#define UNSERIALIZE_OPTIONAL_STATIC(dst, unserialize, del)


Define Documentation

#define DECLARE_ABSTRACT_SERIAL classname   ) 
 

Value:

virtual bool DoSerialize(SerialInfo*) const; \
        virtual bool DoUnserialize(UnserialInfo*); \

Definition at line 146 of file SerialObj.h.

#define DECLARE_SERIAL classname   ) 
 

Value:

static classname* Instantiate(); \
        static SerialTypeRegistrator register_type; \
        virtual bool DoSerialize(SerialInfo*) const; \
        virtual bool DoUnserialize(UnserialInfo*); \
        virtual const TransientID*  GetTID() const      { return &tid; } \
        virtual SerialType GetSerialType() const; \
        TransientID tid;

Definition at line 150 of file SerialObj.h.

#define DO_SERIALIZE classtype,
super   ) 
 

Value:

DBG_LOG(DBG_SERIAL, __PRETTY_FUNCTION__); \
        if ( info->type == SER_NONE ) \
                info->type = classtype; \
        AutoPush auto_push; \
        if ( ! super::DoSerialize(info) ) \
                return false;

Definition at line 173 of file SerialObj.h.

#define DO_UNSERIALIZE super   ) 
 

Value:

DBG_LOG(DBG_SERIAL, __PRETTY_FUNCTION__); \
        AutoPush auto_push; \
        if ( ! super::DoUnserialize(info) ) \
                return false;

Definition at line 181 of file SerialObj.h.

#define IMPLEMENT_SERIAL classname,
classtype   ) 
 

Value:

SerialTypeRegistrator classname::register_type(classtype, \
                        FactoryFunc(&classname::Instantiate), #classname); \
        SerialType classname::GetSerialType() const { return classtype; }; \
        classname* classname::Instantiate()     { return new classname(); } \

Definition at line 160 of file SerialObj.h.

#define SERIALIZE  )     info->s->Write(x, #x)
 

Definition at line 187 of file SerialObj.h.

Referenced by SerialObj::DoSerialize(), TypeDecl::Serialize(), SerialObj::Serialize(), Packet::Serialize(), and EventHandler::Serialize().

#define SERIALIZE_BIT bit   )     info->s->Write(bool(bit), #bit)
 

Definition at line 193 of file SerialObj.h.

#define SERIALIZE_OPTIONAL ptr   ) 
 

Value:

{       \
        if ( ptr )      \
                {       \
                if ( ! (info->s->Write(true, "has_" #ptr) && ptr->Serialize(info)) )    \
                        return false;   \
                }       \
        \
        else if ( ! info->s->Write(false, "has_" #ptr) )        \
                return false;   \
        }

Definition at line 211 of file SerialObj.h.

Referenced by TypeDecl::Serialize().

#define SERIALIZE_OPTIONAL_STR str   ) 
 

Value:

{       \
        if ( str )      \
                {       \
                if ( ! (info->s->Write(true, "has_" #str) && info->s->Write(str, "str")) )      \
                        return false;   \
                }       \
        \
        else if ( ! info->s->Write(false, "has_" #str) )        \
                return false;   \
        }

Definition at line 223 of file SerialObj.h.

#define SERIALIZE_STR x,
y   )     info->s->Write(x, y, #x)
 

Definition at line 190 of file SerialObj.h.

#define UNSERIALIZE  )     info->s->Read(x, #x)
 

Definition at line 196 of file SerialObj.h.

Referenced by SerialObj::Unserialize(), Packet::Unserialize(), and Serializer::UnserializeCall().

#define UNSERIALIZE_BIT bit   ) 
 

Value:

{ \
        bool tmp; \
        if ( ! info->s->Read(&tmp, #bit) ) \
                return false; \
        bit = (unsigned int) tmp; \
        }

Definition at line 202 of file SerialObj.h.

#define UNSERIALIZE_OPTIONAL dst,
unserialize   ) 
 

Value:

{       \
        bool has_it;    \
        if ( ! info->s->Read(&has_it, "has_" #dst) )    \
                return false;   \
        \
        if ( has_it )   \
                {       \
                dst = unserialize;      \
                if ( ! dst )    \
                        return false;   \
                }       \
        \
        else    \
                dst = 0;        \
        }

Definition at line 235 of file SerialObj.h.

#define UNSERIALIZE_OPTIONAL_STATIC dst,
unserialize,
del   ) 
 

Value:

{       \
        bool has_it;    \
        if ( ! info->s->Read(&has_it, "has_" #dst) )    \
                {       \
                delete del;     \
                return 0;       \
                }       \
        \
        if ( has_it )   \
                {       \
                dst = unserialize;      \
                if ( ! dst )    \
                        {       \
                        delete del;     \
                        return 0;       \
                        }       \
                }       \
        \
        else    \
                dst = 0;        \
        }

Definition at line 269 of file SerialObj.h.

Referenced by TypeDecl::Unserialize().

#define UNSERIALIZE_OPTIONAL_STR dst   ) 
 

Value:

{       \
        bool has_it;    \
        if ( ! info->s->Read(&has_it, "has_" #dst) )    \
                return false;   \
        \
        if ( has_it )   \
                {       \
                info->s->Read(&dst, 0, "has_" #dst);    \
                if ( ! dst )    \
                        return false;   \
                }       \
        \
        else    \
                dst = 0;        \
        }

Definition at line 252 of file SerialObj.h.

#define UNSERIALIZE_STR x,
y   )     info->s->Read(x, y, #x)
 

Definition at line 199 of file SerialObj.h.

Referenced by TypeDecl::Unserialize(), EventHandler::Unserialize(), and Serializer::UnserializeCall().


Generated on Wed Sep 14 03:04:48 2005 for bro_docs by doxygen 1.3.5