octopus_request_id Class Reference

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

#include <entity_defs.h>

Inheritance diagram for octopus_request_id:

Inheritance graph
[legend]
Collaboration diagram for octopus_request_id:

Collaboration graph
[legend]
List of all members.

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 operator!= (const octopus_request_id &that) const
bool blank () const
 returns true if this is a blank id (as constructed by default ctor).
int packed_size () const
 reports how large the packed id will be.
istring mangled_form () const
 similar to entity id.
istring text_form () const
 human readable form of the request.
istring to_text () const
virtual void pack (byte_array &packed_form) const
 Creates a packed form of the packable object in "packed_form".
virtual bool unpack (byte_array &packed_form)
 Restores the packable from the "packed_form".

Static Public Member Functions

static octopus_request_id randomized_id ()
 provides a pre-randomized request id.
static octopus_request_id from_text (const istring &to_convert)

Public Attributes

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

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 108 of file entity_defs.h.


Constructor & Destructor Documentation

octopus_request_id::octopus_request_id (  )  [inline]

Definition at line 114 of file entity_defs.h.

Referenced by from_text(), and randomized_id().

octopus_request_id::octopus_request_id ( const octopus_entity entity,
int  request_num 
) [inline]

Definition at line 116 of file entity_defs.h.


Member Function Documentation

octopus_request_id 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 179 of file entity_defs.cpp.

References chaos::inclusive(), string_manipulation::make_random_name(), MAXINT, octopus_request_id(), and portable::process_id().

Referenced by cromp_client::login().

bool octopus_request_id::operator== ( const octopus_request_id that  )  const [inline]

Definition at line 124 of file entity_defs.h.

References _entity, and _request_num.

bool octopus_request_id::operator!= ( const octopus_request_id that  )  const [inline]

Definition at line 127 of file entity_defs.h.

References _entity, and _request_num.

bool octopus_request_id::blank (  )  const

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

Definition at line 176 of file entity_defs.cpp.

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

int octopus_request_id::packed_size (  )  const [virtual]

reports how large the packed id will be.

Reimplemented from packable.

Definition at line 167 of file entity_defs.cpp.

References _entity, and octopus_entity::packed_size().

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

istring octopus_request_id::mangled_form (  )  const

similar to entity id.

Definition at line 170 of file entity_defs.cpp.

References _entity, _request_num, and octopus_entity::mangled_form().

Referenced by identity_tentacle::consume(), and cromp_common::pack_and_ship().

istring octopus_request_id::text_form (  )  const

human readable form of the request.

Definition at line 173 of file entity_defs.cpp.

References _entity, _request_num, and octopus_entity::text_form().

Referenced by cromp_client::decrypt_package_as_needed(), and cromp_client::login().

istring octopus_request_id::to_text (  )  const [inline]

Definition at line 141 of file entity_defs.h.

octopus_request_id octopus_request_id::from_text ( const istring to_convert  )  [static]

Definition at line 189 of file entity_defs.cpp.

References earth_time::convert(), istring::end(), istring::find(), octopus_entity::from_text(), negative(), octopus_request_id(), and istring::substring().

void octopus_request_id::pack ( 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 packable.

Definition at line 199 of file entity_defs.cpp.

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

Referenced by unhandled_request::pack().

bool octopus_request_id::unpack ( 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 packable.

Definition at line 205 of file entity_defs.cpp.

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

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


Member Data Documentation

octopus_entity octopus_request_id::_entity

the entity.

Definition at line 111 of file entity_defs.h.

Referenced by entity_data_bin::add_item(), blank(), login_tentacle::consume(), encryption_tentacle::consume(), cromp_client::login(), mangled_form(), operator!=(), operator==(), pack(), packed_size(), text_form(), and unpack().

int octopus_request_id::_request_num

the item number from the entity.

Definition at line 112 of file entity_defs.h.

Referenced by blank(), cromp_client::decrypt_package_as_needed(), mangled_form(), operator!=(), operator==(), pack(), text_form(), and unpack().


The documentation for this class was generated from the following files:
Generated on Fri Oct 10 04:30:25 2008 for HOOPLE Libraries by  doxygen 1.5.1