infoton Class Reference

An infoton is an individual request parcel with accompanying information. More...

#include <infoton.h>

Inheritance diagram for infoton:

Inheritance graph
[legend]
Collaboration diagram for infoton:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 infoton (const string_array &classifier)
 creates an infoton with the "classifier".
 infoton (const istring &class_1)
 infoton (const istring &class_1, const istring &class_2)
 infoton (const istring &class_1, const istring &class_2, const istring &cl_3)
 infoton (const infoton &to_copy)
 copies only the base class portion of the infoton.
virtual ~infoton ()
 IMPLEMENT_CLASS_NAME ("infoton")
infotonoperator= (const infoton &to_copy)
 assigns only the base class portion.
const string_arrayclassifier () const
 this array of strings is the "name" for this infoton.
void set_classifier (const string_array &new_classifier)
 sets the infoton's classifier to the "new_classifier".
void set_classifier (const istring &class_1)
void set_classifier (const istring &class_1, const istring &class_2)
void set_classifier (const istring &class_1, const istring &class_2, const istring &cl_3)
bool check_classifier (const istring &class_name, const istring &caller)
 checks that the classifier seems valid.
virtual void pack (byte_array &packed_form) const=0
 stuffs the data in the infoton into the "packed_form".
virtual bool unpack (byte_array &packed_form)=0
 restores an infoton from a packed form.
virtual clonableclone () const=0
 must be provided to allow creation of a copy of this object.
virtual int packed_size () const=0
 reports how large the infoton will be when packed.

Static Public Member Functions

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

Detailed Description

An infoton is an individual request parcel with accompanying information.

This is the unit of data exchange in the octopus scheme.

Definition at line 28 of file infoton.h.


Constructor & Destructor Documentation

infoton::infoton ( const string_array classifier  ) 

creates an infoton with the "classifier".

keep in mind that although anything can be passed in here, the consistency of one's collection of octopi depends on a regular classification scheme. it is recommended that the "classifier" be effectively constant. also, classifiers that begin with the octothorpe (aka the pound sign '#') are reserved for octopus internal usage.

Definition at line 36 of file infoton.cpp.

References FUNCDEF.

infoton::infoton ( const istring class_1  ) 

Definition at line 42 of file infoton.cpp.

References FUNCDEF.

infoton::infoton ( const istring class_1,
const istring class_2 
)

Definition at line 49 of file infoton.cpp.

References FUNCDEF.

infoton::infoton ( const istring class_1,
const istring class_2,
const istring cl_3 
)

Definition at line 57 of file infoton.cpp.

References FUNCDEF.

infoton::infoton ( const infoton to_copy  ) 

copies only the base class portion of the infoton.

clone() is the proper method for copying an instantiated infoton-- this constructor only supports copying the base's information.

Definition at line 67 of file infoton.cpp.

infoton::~infoton (  )  [virtual]

Definition at line 74 of file infoton.cpp.

References WHACK().


Member Function Documentation

infoton::IMPLEMENT_CLASS_NAME ( "infoton"   ) 

infoton & infoton::operator= ( const infoton to_copy  ) 

assigns only the base class portion.

clone() is the proper method for copying an instantiated infoton.

Definition at line 77 of file infoton.cpp.

References _classifier.

const string_array & infoton::classifier (  )  const

this array of strings is the "name" for this infoton.

the naming scheme for an infoton hierarchically and uniquely identifies the exact type of this object. the last string (at the end() index) is the most specific name for this object, while the preceding names describe the object's membership in groups. the outermost group name is at the zeroth index in the array. a classifier can have one or more elements.

Definition at line 80 of file infoton.cpp.

Referenced by octopus::evaluate(), fast_pack(), fast_pack_overhead(), fast_unpack(), security_infoton::operator=(), identity_infoton::operator=(), and tentacle::propel_arm().

void infoton::set_classifier ( const string_array new_classifier  ) 

sets the infoton's classifier to the "new_classifier".

do not do this unless you know what you're doing; changing the classifier may keep an infoton from being recognized properly.

Definition at line 99 of file infoton.cpp.

References check_classifier(), object_base::class_name(), and FUNCDEF.

Referenced by security_infoton::operator=(), identity_infoton::operator=(), and reconstituter().

void infoton::set_classifier ( const istring class_1  ) 

Definition at line 108 of file infoton.cpp.

References check_classifier(), object_base::class_name(), FUNCDEF, and array< contents >::reset().

void infoton::set_classifier ( const istring class_1,
const istring class_2 
)

Definition at line 118 of file infoton.cpp.

References check_classifier(), object_base::class_name(), FUNCDEF, and array< contents >::reset().

void infoton::set_classifier ( const istring class_1,
const istring class_2,
const istring cl_3 
)

Definition at line 129 of file infoton.cpp.

References check_classifier(), object_base::class_name(), FUNCDEF, and array< contents >::reset().

bool infoton::check_classifier ( const istring class_name,
const istring caller 
)

checks that the classifier seems valid.

the "class_name" and "caller" should be set to the location where the check is being done.

Definition at line 83 of file infoton.cpp.

References array< contents >::length(), log_base::log(), and program_wide_logger().

Referenced by set_classifier().

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

Implemented in attribute_bundle, identity_infoton, unhandled_request, encryption_infoton, encryption_wrapper, file_transfer_infoton, security_infoton, and bubble.

Referenced by fast_pack().

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

Implemented in attribute_bundle, identity_infoton, unhandled_request, encryption_infoton, encryption_wrapper, file_transfer_infoton, security_infoton, and bubble.

virtual clonable* infoton::clone (  )  const [pure virtual]

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

Implements clonable.

Implemented in attribute_bundle, identity_infoton, unhandled_request, encryption_infoton, encryption_wrapper, file_transfer_infoton, security_infoton, and bubble.

virtual int infoton::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.

Reimplemented from packable.

Implemented in attribute_bundle, identity_infoton, unhandled_request, encryption_infoton, encryption_wrapper, file_transfer_infoton, security_infoton, and bubble.

Referenced by entity_data_bin::add_item(), and tentacle::enqueue().

void infoton::fast_pack ( byte_array packed_form,
const infoton to_pack 
) [static]

flattens an infoton "to_pack" into the byte array "packed_form".

Definition at line 149 of file infoton.cpp.

References basis::attach(), classifier(), FAST_PACK_VERSION, FUNCDEF, array< contents >::length(), pack(), and basis::pack().

Referenced by cromp_transaction::flatten(), and cromp_server::wrap_infoton().

bool infoton::fast_unpack ( byte_array packed_form,
string_array classifier,
byte_array info 
) [static]

undoes a previous fast_pack to restore the previous information.

extracts the data from a packed infoton in "packed_form" into the "classifier" and "info" that are contained therein.

Definition at line 214 of file infoton.cpp.

References classifier(), continuable_error, basis::detach(), FAST_PACK_VERSION, FUNCDEF, array< contents >::reset(), static_class_name, array< contents >::subarray(), basis::unpack(), and array< contents >::zap().

Referenced by cromp_client::decrypt_package_as_needed(), and octopus::evaluate().

bool infoton::test_fast_unpack ( const byte_array packed_form,
int &  packed_length 
) [static]

checks that the "packed_form" could hold a valid packed infoton.

tests that the smallest prefix of the "packed_form" looks like an appropriate packed classifier and packet length. the "packed_length" is set to the length found in the packet. note that the byte array does not need to contain the complete packed infoton yet; just the first portion where the header info is located must be present. this method does not disturb the data in the packed array.

Definition at line 172 of file infoton.cpp.

References basis::detach(), FAST_PACK_VERSION, FUNCDEF, array< contents >::length(), basis::obscure_detach(), array< contents >::observe(), and array< contents >::subarray().

int infoton::fast_pack_overhead ( const string_array classifier  )  [static]

reports how much space is needed to pack the "classifier".

returns the overhead in bytes that will be added to an infoton's packed size when it is packed with fast_pack(). the "classifier" is the name of the infoton in question and must be accurate or the overhead will not be calculated properly.

Definition at line 142 of file infoton.cpp.

References classifier(), and string_array::packed_size().

Referenced by cromp_transaction::minimum_flat_size().


The documentation for this class was generated from the following files:
Generated on Sat Oct 11 04:30:23 2008 for HOOPLE Libraries by  doxygen 1.5.1