feisty meow concerns codebase  2.140
synchronic::synchronizable Class Referenceabstract

Encapsulates all of the attributes known for an object. More...

#include <synchronizable.h>

Inheritance diagram for synchronic::synchronizable:
Collaboration diagram for synchronic::synchronizable:

Public Types

enum  modifications { ADDED , CHANGED , DELETED }
 
enum  outcomes { OKAY = basis::common::OKAY , BAD_TYPE = basis::common::BAD_TYPE , EMPTY = basis::common::IS_EMPTY }
 

Public Member Functions

 synchronizable (const structures::string_array &object_id)
 
void pack_mod (basis::byte_array &packed_form) const
 
bool unpack_mod (basis::byte_array &packed_form)
 
int packed_mod_size () const
 returns the size of the packed modifier. More...
 
virtual basis::outcome merge (const synchronizable &to_merge)=0
 
virtual basis::astring text_form () const =0
 local version just makes text_form() more functional. More...
 
virtual void pack (basis::byte_array &packed_form) const =0
 stuffs the data in the infoton into the "packed_form". More...
 
virtual bool unpack (basis::byte_array &packed_form)=0
 restores an infoton from a packed form. More...
 
virtual clonable * clone () const =0
 must be provided to allow creation of a copy of this object. More...
 
virtual int packed_size () const =0
 reports how large the infoton will be when packed. More...
 
- Public Member Functions inherited from octopi::infoton
 infoton (const structures::string_array &classifier)
 creates an infoton with the "classifier". More...
 
 infoton (const basis::astring &class_1)
 
 infoton (const basis::astring &class_1, const basis::astring &class_2)
 
 infoton (const basis::astring &class_1, const basis::astring &class_2, const basis::astring &cl_3)
 
 infoton (const infoton &to_copy)
 copies only the base class portion of the infoton. More...
 
virtual ~infoton ()
 
 DEFINE_CLASS_NAME ("infoton")
 
infotonoperator= (const infoton &to_copy)
 assigns only the base class portion. More...
 
const structures::string_arrayclassifier () const
 this array of strings is the "name" for this infoton. More...
 
void set_classifier (const structures::string_array &new_classifier)
 sets the infoton's classifier to the "new_classifier". More...
 
void set_classifier (const basis::astring &class_1)
 
void set_classifier (const basis::astring &class_1, const basis::astring &class_2)
 
void set_classifier (const basis::astring &class_1, const basis::astring &class_2, const basis::astring &cl_3)
 
bool check_classifier (const basis::astring &class_name, const basis::astring &caller)
 checks that the classifier seems valid. More...
 
virtual void text_form (basis::base_string &state_fill) const =0
 requires derived infotons to be able to show their state as a string. More...
 
- Public Member Functions inherited from basis::text_formable
virtual const char * class_name () const =0
 Returns the bare name of this class as a constant character pointer. More...
 

Public Attributes

modifications _mod
 
timely::time_stamp _updated
 

Additional Inherited Members

- Static Public Member Functions inherited from octopi::infoton
static void fast_pack (basis::byte_array &packed_form, const infoton &to_pack)
 flattens an infoton "to_pack" into the byte array "packed_form". More...
 
static bool fast_unpack (basis::byte_array &packed_form, structures::string_array &classifier, basis::byte_array &info)
 undoes a previous fast_pack to restore the previous information. More...
 
static bool test_fast_unpack (const basis::byte_array &packed_form, int &packed_length)
 checks that the "packed_form" could hold a valid packed infoton. More...
 
static int fast_pack_overhead (const structures::string_array &classifier)
 reports how much space is needed to pack the "classifier". More...
 

Detailed Description

Encapsulates all of the attributes known for an object.

This relies on the naming scheme for infotons, so objects are unique only so far as their classifiers are different. For example, if the objects are to be differentiated by the computer that they run on, then some unique form of that computer's name should be used as one of the components of the classifier. Each object can hold a variety of information which is not defined here. Instead, we require the merge() method that performs object specific reconciliation when an update arrives.

Definition at line 32 of file synchronizable.h.

Member Enumeration Documentation

◆ modifications

Enumerator
ADDED 
CHANGED 
DELETED 

Definition at line 35 of file synchronizable.h.

◆ outcomes

Enumerator
OKAY 
BAD_TYPE 
EMPTY 

Definition at line 57 of file synchronizable.h.

Constructor & Destructor Documentation

◆ synchronizable()

synchronic::synchronizable::synchronizable ( const structures::string_array object_id)
inline

Definition at line 51 of file synchronizable.h.

Member Function Documentation

◆ clone()

virtual clonable* synchronic::synchronizable::clone ( ) const
pure virtual

must be provided to allow creation of a copy of this object.

Implements octopi::infoton.

Referenced by synchronic::list_manager::consume().

◆ merge()

virtual basis::outcome synchronic::synchronizable::merge ( const synchronizable to_merge)
pure virtual

◆ pack()

virtual void synchronic::synchronizable::pack ( basis::byte_array packed_form) const
pure virtual

stuffs the data in the infoton into the "packed_form".

the derived method must know how to pack this particular type of infoton.

Implements octopi::infoton.

◆ pack_mod()

void synchronic::synchronizable::pack_mod ( basis::byte_array packed_form) const

Definition at line 87 of file synchronizable.h.

References _mod, and structures::attach().

◆ packed_mod_size()

int synchronic::synchronizable::packed_mod_size ( ) const
inline

returns the size of the packed modifier.

Definition at line 66 of file synchronizable.h.

◆ packed_size()

virtual int synchronic::synchronizable::packed_size ( ) const
pure virtual

reports how large the infoton will be when packed.

must be overridden by derived classes to provide a guess at how large the packed size of this will be. this is important to estimate accurately.

Implements octopi::infoton.

◆ text_form()

virtual basis::astring synchronic::synchronizable::text_form ( ) const
pure virtual

local version just makes text_form() more functional.

Reimplemented from octopi::infoton.

Referenced by synchronic::list_manager::consume().

◆ unpack()

virtual bool synchronic::synchronizable::unpack ( basis::byte_array packed_form)
pure virtual

restores an infoton from a packed form.

the unpack() method will be utilized by tentacles that support this type of object.

Implements octopi::infoton.

◆ unpack_mod()

bool synchronic::synchronizable::unpack_mod ( basis::byte_array packed_form)

Definition at line 90 of file synchronizable.h.

References _mod, and structures::detach().

Member Data Documentation

◆ _mod

modifications synchronic::synchronizable::_mod

Definition at line 41 of file synchronizable.h.

Referenced by synchronic::list_manager::consume(), pack_mod(), and unpack_mod().

◆ _updated

timely::time_stamp synchronic::synchronizable::_updated

Definition at line 47 of file synchronizable.h.

Referenced by synchronic::list_manager::clean().


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