feisty meow concerns codebase  2.140
octopi::octopus_entity Class Reference

Provides a way of identifying users of an octopus object. More...

#include <entity_defs.h>

Inheritance diagram for octopi::octopus_entity:
Collaboration diagram for octopi::octopus_entity:

Public Member Functions

 octopus_entity ()
 blank constructor. More...
 
 octopus_entity (const basis::astring &hostname, int process_id, int sequencer, int add_in)
 constructor taking all the available parameters for an entity. More...
 
 octopus_entity (const octopus_entity &to_copy)
 
 ~octopus_entity ()
 
octopus_entityoperator= (const octopus_entity &to_copy)
 
 DEFINE_CLASS_NAME ("octopus_entity")
 
bool blank () const
 true if the entity is blank, as constructed by default constructor. More...
 
bool operator== (const octopus_entity &that) const
 
const basis::astringhostname () const
 returns the hostname portion of the id. More...
 
int process_id () const
 returns the process number in the id. More...
 
int sequencer () const
 returns the sequencing number from the id. More...
 
int add_in () const
 returns the random add-in from the id. More...
 
void hostname (const basis::astring &new_host)
 set the host. More...
 
void process_id (int id)
 set the process id. More...
 
void sequencer (int seq)
 set the sequencer value. More...
 
void add_in (int add)
 set the add-in value. More...
 
basis::astring mangled_form () const
 returns the combined string form of the identifier. More...
 
basis::astring text_form () const
 returns a readable form of the identifier. More...
 
virtual void text_form (basis::base_string &to_fill) const
 Provides a text view of all the important info owned by this object. More...
 
basis::astring to_text () const
 conversion to text format for display. More...
 
int packed_size () const
 reports how large the packed entity will be. More...
 
virtual void pack (basis::byte_array &packed_form) const
 Creates a packed form of the packable object in "packed_form". More...
 
virtual bool unpack (basis::byte_array &packed_form)
 Restores the packable from the "packed_form". 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...
 

Static Public Member Functions

static octopus_entity from_text (const basis::astring &to_convert)
 conversion from text format, parsing parameters out. More...
 
static void breakout (const basis::astring &mangled_form, basis::astring &hostname, int &process_id, int &sequencer, int &add_in)
 takes a "mangled_form" of an entity id and retrieves the components. More...
 

Detailed Description

Provides a way of identifying users of an octopus object.

NOTE: this is a heavy-weight header intended for forward declaration.

Definition at line 34 of file entity_defs.h.

Constructor & Destructor Documentation

◆ octopus_entity() [1/3]

octopi::octopus_entity::octopus_entity ( )

blank constructor.

Definition at line 35 of file entity_defs.cpp.

Referenced by from_text().

◆ octopus_entity() [2/3]

octopi::octopus_entity::octopus_entity ( const basis::astring hostname,
int  process_id,
int  sequencer,
int  add_in 
)

constructor taking all the available parameters for an entity.

produces an id in the proper format given all the components. note that the hostname must be some fully qualified name for the host, such that it is as unique as you want names within the system to be.

Definition at line 42 of file entity_defs.cpp.

◆ octopus_entity() [3/3]

octopi::octopus_entity::octopus_entity ( const octopus_entity to_copy)

Definition at line 50 of file entity_defs.cpp.

References operator=().

◆ ~octopus_entity()

octopi::octopus_entity::~octopus_entity ( )

Definition at line 55 of file entity_defs.cpp.

References basis::WHACK().

Member Function Documentation

◆ add_in() [1/2]

int octopi::octopus_entity::add_in ( ) const

returns the random add-in from the id.

Definition at line 88 of file entity_defs.cpp.

Referenced by breakout(), and from_text().

◆ add_in() [2/2]

void octopi::octopus_entity::add_in ( int  add)

set the add-in value.

Definition at line 94 of file entity_defs.cpp.

◆ blank()

bool octopi::octopus_entity::blank ( ) const

true if the entity is blank, as constructed by default constructor.

Definition at line 99 of file entity_defs.cpp.

References basis::astring::empty().

Referenced by octopi::octopus_request_id::blank().

◆ breakout()

void octopi::octopus_entity::breakout ( const basis::astring mangled_form,
basis::astring hostname,
int &  process_id,
int &  sequencer,
int &  add_in 
)
static

takes a "mangled_form" of an entity id and retrieves the components.

Definition at line 129 of file entity_defs.cpp.

References add_in(), basis::astring::find(), hostname(), mangled_form(), process_id(), basis::astring::s(), sequencer(), and basis::astring::zap().

Referenced by from_text().

◆ DEFINE_CLASS_NAME()

octopi::octopus_entity::DEFINE_CLASS_NAME ( "octopus_entity"  )

◆ from_text()

octopus_entity octopi::octopus_entity::from_text ( const basis::astring to_convert)
static

conversion from text format, parsing parameters out.

Definition at line 57 of file entity_defs.cpp.

References add_in(), breakout(), basis::array< contents >::observe(), octopus_entity(), process_id(), and sequencer().

Referenced by octopi::octopus_request_id::from_text().

◆ hostname() [1/2]

const astring & octopi::octopus_entity::hostname ( ) const

returns the hostname portion of the id.

Definition at line 82 of file entity_defs.cpp.

Referenced by breakout().

◆ hostname() [2/2]

void octopi::octopus_entity::hostname ( const basis::astring new_host)

set the host.

Definition at line 96 of file entity_defs.cpp.

◆ mangled_form()

◆ operator=()

octopus_entity & octopi::octopus_entity::operator= ( const octopus_entity to_copy)

Definition at line 72 of file entity_defs.cpp.

Referenced by octopus_entity().

◆ operator==()

bool octopi::octopus_entity::operator== ( const octopus_entity that) const

Definition at line 143 of file entity_defs.cpp.

◆ pack()

void octopi::octopus_entity::pack ( basis::byte_array packed_form) const
virtual

Creates a packed form of the packable object in "packed_form".

This must append to the data in "packed_form" rather than clearing prior contents.

Implements basis::packable.

Definition at line 151 of file entity_defs.cpp.

References basis::attach(), and basis::astring::pack().

Referenced by octopi::octopus_request_id::pack().

◆ packed_size()

int octopi::octopus_entity::packed_size ( ) const
virtual

reports how large the packed entity will be.

Implements basis::packable.

Definition at line 102 of file entity_defs.cpp.

References basis::astring::length().

Referenced by octopi::octopus_request_id::packed_size(), and octopi::SAFE_STATIC_CONST().

◆ process_id() [1/2]

int octopi::octopus_entity::process_id ( ) const

returns the process number in the id.

Definition at line 84 of file entity_defs.cpp.

Referenced by breakout(), and from_text().

◆ process_id() [2/2]

void octopi::octopus_entity::process_id ( int  id)

set the process id.

Definition at line 90 of file entity_defs.cpp.

◆ sequencer() [1/2]

int octopi::octopus_entity::sequencer ( ) const

returns the sequencing number from the id.

Definition at line 86 of file entity_defs.cpp.

Referenced by breakout(), and from_text().

◆ sequencer() [2/2]

void octopi::octopus_entity::sequencer ( int  seq)

set the sequencer value.

Definition at line 92 of file entity_defs.cpp.

◆ text_form() [1/2]

◆ text_form() [2/2]

virtual void octopi::octopus_entity::text_form ( basis::base_string state_fill) const
inlinevirtual

Provides a text view of all the important info owned by this object.

It is understood that there could be a large amount of information and that this function might take a relatively long time to complete.

Implements basis::text_formable.

Definition at line 76 of file entity_defs.h.

References basis::base_string::assign(), and text_form().

◆ to_text()

basis::astring octopi::octopus_entity::to_text ( ) const
inline

conversion to text format for display.

Definition at line 80 of file entity_defs.h.

References mangled_form().

◆ unpack()

bool octopi::octopus_entity::unpack ( basis::byte_array packed_form)
virtual

Restores the packable from the "packed_form".

This object becomes the unpacked form, and therefore must lose any of its prior contents that depend on the data in "packed_form". This is up to the derived unpack function to figure out. The "packed_form" is modified by extracting all of the pieces that are used for this object; the remainder stays in "packed_form". true is returned if the unpacking was successful.

Implements basis::packable.

Definition at line 159 of file entity_defs.cpp.

References basis::detach(), and basis::astring::unpack().

Referenced by octopi::octopus_request_id::unpack().


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