feisty meow concerns codebase  2.140
octopi::octopus_request_id Class Reference

Identifies requests made on an octopus by users. More...

#include <entity_defs.h>

Inheritance diagram for octopi::octopus_request_id:
Collaboration diagram for octopi::octopus_request_id:

Public Member Functions

 octopus_request_id ()
 
 octopus_request_id (const octopus_entity &entity, int request_num)
 
bool operator== (const octopus_request_id &that) const
 
bool blank () const
 returns true if this is a blank id (as constructed by default ctor). More...
 
int packed_size () const
 reports how large the packed id will be. More...
 
basis::astring mangled_form () const
 similar to entity id. More...
 
basis::astring text_form () const
 human readable form of the request. More...
 
basis::astring to_text () const
 
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...
 

Static Public Member Functions

static octopus_request_id randomized_id ()
 provides a pre-randomized request id. More...
 
static octopus_request_id from_text (const basis::astring &to_convert)
 

Public Attributes

octopus_entity _entity
 the entity. More...
 
int _request_num
 the item number from the entity. More...
 

Detailed Description

Identifies requests made on an octopus by users.

Uniquely identifies a request passed to an octopus server given that the number of requests from one entity can be contained within the range of signed integers. if the requests come fast enough for the request numbers to wrap around, and if the requests can remain outstanding for a really long time, it may be wise to create a new login.

Definition at line 113 of file entity_defs.h.

Constructor & Destructor Documentation

◆ octopus_request_id() [1/2]

octopi::octopus_request_id::octopus_request_id ( )
inline

Definition at line 119 of file entity_defs.h.

Referenced by from_text(), and randomized_id().

◆ octopus_request_id() [2/2]

octopi::octopus_request_id::octopus_request_id ( const octopus_entity entity,
int  request_num 
)
inline

Definition at line 121 of file entity_defs.h.

Member Function Documentation

◆ blank()

bool octopi::octopus_request_id::blank ( ) const

returns true if this is a blank id (as constructed by default ctor).

Definition at line 179 of file entity_defs.cpp.

References _entity, _request_num, and octopi::octopus_entity::blank().

◆ from_text()

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

◆ mangled_form()

astring octopi::octopus_request_id::mangled_form ( ) const

◆ operator==()

bool octopi::octopus_request_id::operator== ( const octopus_request_id that) const
inline

Definition at line 129 of file entity_defs.h.

References _entity, and _request_num.

◆ pack()

void octopi::octopus_request_id::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 202 of file entity_defs.cpp.

References _entity, _request_num, basis::attach(), and octopi::octopus_entity::pack().

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

◆ packed_size()

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

reports how large the packed id will be.

Implements basis::packable.

Definition at line 170 of file entity_defs.cpp.

References _entity, and octopi::octopus_entity::packed_size().

Referenced by octopi::unhandled_request::packed_size(), and cromp::cromp_transaction::unflatten().

◆ randomized_id()

octopus_request_id octopi::octopus_request_id::randomized_id ( )
static

provides a pre-randomized request id.

this should only be used for the very first request made to an octopus, in order to obtain a valid identity.

Definition at line 182 of file entity_defs.cpp.

References mathematics::chaos::inclusive(), MAXINT32, and octopus_request_id().

◆ text_form()

astring octopi::octopus_request_id::text_form ( ) const

◆ to_text()

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

Definition at line 143 of file entity_defs.h.

References mangled_form().

◆ unpack()

bool octopi::octopus_request_id::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 208 of file entity_defs.cpp.

References _entity, _request_num, basis::detach(), and octopi::octopus_entity::unpack().

Referenced by cromp::cromp_transaction::unflatten(), and octopi::unhandled_request::unpack().

Member Data Documentation

◆ _entity

◆ _request_num

int octopi::octopus_request_id::_request_num

the item number from the entity.

Definition at line 117 of file entity_defs.h.

Referenced by blank(), create_request_id(), mangled_form(), operator==(), pack(), text_form(), and unpack().


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