Anope IRC Services  Version 2.0
Public Member Functions | Static Public Member Functions | Data Fields | Private Types | Private Attributes | Static Private Attributes
Serialize Class Reference

#include <serialize.h>

Inheritance diagram for Serialize:
Inheritance graph
[legend]
Collaboration diagram for Serialize:
Collaboration graph
[legend]

Public Member Functions

 Type (const Anope::string &n, unserialize_func f, Module *owner=NULL)
 
 ~Type ()
 
const Anope::stringGetName ()
 
SerializableUnserialize (Serializable *obj, Serialize::Data &data)
 
void Check ()
 
time_t GetTimestamp () const
 
void UpdateTimestamp ()
 
ModuleGetOwner () const
 

Static Public Member Functions

static Serialize::TypeFind (const Anope::string &name)
 
static const std::vector< Anope::string > & GetTypeOrder ()
 
static const std::map< Anope::string, Serialize::Type * > & GetTypes ()
 

Data Fields

std::map< uint64_t, Serializable * > objects
 

Private Types

typedef Serializable *(* unserialize_func) (Serializable *obj, Serialize::Data &)
 

Private Attributes

Anope::string name
 
unserialize_func unserialize
 
Moduleowner
 
time_t timestamp
 

Static Private Attributes

static std::vector< Anope::stringTypeOrder
 
static std::map< Anope::string, Serialize::Type * > Types
 

Detailed Description

Definition at line 112 of file serialize.h.

Member Typedef Documentation

◆ unserialize_func

typedef Serializable*(* Serialize::unserialize_func) (Serializable *obj, Serialize::Data &)
private

Definition at line 114 of file serialize.h.

Constructor & Destructor Documentation

◆ ~Type()

Serialize::~Type ( )

Member Function Documentation

◆ Check()

void Serialize::Check ( )

◆ Find()

static Serialize::Type* Serialize::Find ( const Anope::string name)
static

Referenced by GetOwner().

◆ GetName()

const Anope::string& Serialize::GetName ( )
inline

Gets the name for this type

Returns
The name, eg "NickAlias"

Definition at line 148 of file serialize.h.

References Check(), GetTimestamp(), name, Unserialize(), and UpdateTimestamp().

◆ GetOwner()

Module* Serialize::GetOwner ( ) const
inline

Definition at line 171 of file serialize.h.

References Find(), GetTypeOrder(), GetTypes(), owner, and Type().

◆ GetTimestamp()

time_t Serialize::GetTimestamp ( ) const

Gets the timestamp for the object type. That is, the time we know all objects of this type are updated at least to.

Referenced by GetName().

◆ GetTypeOrder()

static const std::vector<Anope::string>& Serialize::GetTypeOrder ( )
static

Referenced by GetOwner().

◆ GetTypes()

static const std::map<Anope::string, Serialize::Type *>& Serialize::GetTypes ( )
static

Referenced by GetOwner().

◆ Type()

Serialize::Type ( const Anope::string n,
unserialize_func  f,
Module owner = NULL 
)

◆ Unserialize()

Serializable* Serialize::Unserialize ( Serializable obj,
Serialize::Data data 
)

Unserialized an object.

Parameters
objNULL if this object doesn't yet exist. If this isn't NULL, instead update the contents of this object.
dataThe data to unserialize
Returns
The unserialized object. If obj != NULL this should be obj.

Referenced by GetName().

◆ UpdateTimestamp()

void Serialize::UpdateTimestamp ( )

Bumps object type timestamp to current time

Referenced by GetName().

Field Documentation

◆ name

Anope::string Serialize::name
private

Definition at line 120 of file serialize.h.

Referenced by GetName().

◆ objects

std::map<uint64_t, Serializable *> Serialize::objects

Definition at line 135 of file serialize.h.

◆ owner

Module* Serialize::owner
private

Definition at line 125 of file serialize.h.

Referenced by GetOwner().

◆ timestamp

time_t Serialize::timestamp
private

Definition at line 131 of file serialize.h.

◆ TypeOrder

std::vector<Anope::string> Serialize::TypeOrder
staticprivate

Definition at line 116 of file serialize.h.

◆ Types

std::map<Anope::string, Serialize::Type *> Serialize::Types
staticprivate

Definition at line 117 of file serialize.h.

◆ unserialize

unserialize_func Serialize::unserialize
private

Definition at line 121 of file serialize.h.


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