Persistent Class Referenceabstract

Semi-abstract class for Items with an id; can be persisted i.e. serialized. More...

#include <Persistent.h>

Inheritance diagram for Persistent:

Public Member Functions

 Persistent (const std::string &tag, const std::string &description, Persistent *parent, uint32_t id)
 main constructor More...
 
 Persistent (const Persistent &)
 copy constructor More...
 
Persistentoperator= (const Persistent &)
 copy assignment More...
 
 Persistent (Persistent &&other)
 move constructor More...
 
Persistentoperator= (Persistent &&other)
 move assignment More...
 
 ~Persistent (void)
 
uint32_t id (void) const
 
std::string uuid (void) const
 
uint32_t parentId (void) const
 
virtual uint32_t rootId (void) const =0
 
virtual uint32_t range (void) const =0
 
virtual uint32_t getId (void)=0
 returns the next available id and increments the internal counter More...
 
double created_at (void) const
 
double updated_at (void) const
 
void updated_at (double u) const
 
virtual int insert (Persistency *persistency) const =0
 
virtual int update (Persistency *persistency) const =0
 
virtual void restore (Persistency *persistency)=0
 
virtual void remove (Persistency *persistency) const =0
 
- Public Member Functions inherited from Item
 Item (const Item &other)
 copy constructor copies all elements but parent which is set to nullptr More...
 
Itemoperator= (const Item &other)
 copy assignment operator copies all elements but parent which is set to nullptr More...
 
 Item (const std::string &tag, const std::string &description, Persistent *parent)
 
 Item (Item &&other)
 move constructor More...
 
Itemoperator= (Item &&other)
 move assignment operator More...
 
virtual ~Item ()
 
const std::string & tag () const
 
const std::string & description () const
 
std::string fullTag () const
 
const Persistentparent () const
 
virtual const std::string & type () const =0
 
void setTag (const std::string &tag)
 
void setDescription (const std::string &description)
 
void setWideTag (const std::wstring &tag)
 wide-character variant, More...
 
void setWideDescription (const std::wstring &description)
 wide-character variant, More...
 
bool operator!= (const Item &rhs) const
 
bool operator== (const Item &rhs) const
 

Friends

class Node
 

Additional Inherited Members

- Protected Attributes inherited from Item
Persistentparent_
 pointer to the parent Persistent; set to this by the constructor if Item is self-standing or a root Persistent of a tree More...
 

Detailed Description

Semi-abstract class for Items with an id; can be persisted i.e. serialized.

#include <libpf/persistency/Persistent.h>

Constructor & Destructor Documentation

◆ Persistent() [1/3]

Persistent::Persistent ( const std::string &  tag,
const std::string &  description,
Persistent parent,
uint32_t  id 
)

main constructor

◆ Persistent() [2/3]

Persistent::Persistent ( const Persistent )

copy constructor

◆ Persistent() [3/3]

Persistent::Persistent ( Persistent &&  other)

move constructor

◆ ~Persistent()

Persistent::~Persistent ( void  )
inline

Member Function Documentation

◆ created_at()

double Persistent::created_at ( void  ) const

◆ getId()

virtual uint32_t Persistent::getId ( void  )
pure virtual

returns the next available id and increments the internal counter

Implemented in Node.

◆ id()

uint32_t Persistent::id ( void  ) const
Returns
the progressive counter, unique within the scope of the root and all its descendants

◆ insert()

virtual int Persistent::insert ( Persistency persistency) const
pure virtual

auto-determine the offset and recursively insert Node into persistency

Returns
the database id of the inserted Node
Parameters
persistencydatabase connection

Implemented in Node.

◆ operator=() [1/2]

Persistent & Persistent::operator= ( const Persistent )

copy assignment

◆ operator=() [2/2]

Persistent & Persistent::operator= ( Persistent &&  other)

move assignment

◆ parentId()

uint32_t Persistent::parentId ( void  ) const
Returns
unique integer identifier of the parent item

◆ range()

virtual uint32_t Persistent::range ( void  ) const
pure virtual
Returns
the range of ids required to save to persistency this Node and all its descendants; minimum value is 0
Note
the maximum id among this Node and all its descendants = range() + id() - 1

Implemented in Node.

◆ remove()

virtual void Persistent::remove ( Persistency persistency) const
pure virtual

remove object from persistency database

Parameters
persistencydatabase connection

Implemented in Node.

◆ restore()

virtual void Persistent::restore ( Persistency persistency)
pure virtual

recursively restore Node variable values from persistency

Parameters
persistencydatabase connection

Implemented in Node.

◆ rootId()

virtual uint32_t Persistent::rootId ( void  ) const
pure virtual
Returns
the unique integer identifier of the root item

Implemented in Node.

◆ update()

virtual int Persistent::update ( Persistency persistency) const
pure virtual

recursively update Node into persistency

Returns
the database id of the updated Node
Parameters
persistencydatabase connection

Implemented in Node.

◆ updated_at() [1/2]

void Persistent::updated_at ( double  u) const

◆ updated_at() [2/2]

double Persistent::updated_at ( void  ) const

◆ uuid()

std::string Persistent::uuid ( void  ) const

returns a UUIDs (Universally Unique Identifier) Version 4 as defined by RFC 4122 in its canonical form, represented with a 36-character string containing 32 lowercase hexadecimal digits, displayed in five groups separated by hyphens, in the form 8-4-4-4-12

Friends And Related Function Documentation

◆ Node

friend class Node
friend

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