zing_table Class Reference

The manager of zings that are awaiting delivery to zingable objects. More...

#include <zing_table.h>

Inheritance diagram for zing_table:

Inheritance graph
[legend]
Collaboration diagram for zing_table:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 zing_table (int overall_memory, int per_user_memory)
 creates a new zing table.
 ~zing_table ()
 IMPLEMENT_CLASS_NAME ("zing_table")
bool add_client (int new_client_id)
 lists a new client that could have items held here.
bool remove_client (int outgoing_client_id)
 delists a client that has been shut down.
void zing_event (int client_id, int event, const byte_array &data)
void zing_event (int client_id, int event, const byte_array &data, const int_set &targets)
 zings a record of an "event" at our destination.
int show_events (int client_id, const istring &name, istring &output, int indentation)
 lists out the events currently held.
bool pop_event (int client_id, int &event, byte_array &event_data, int_set &targets)
 retrieves the next "event" for this object, if one exists.
bool peek_event (int client_id, int &event, int &data_length, int_set &targets) const
 looks at the top "event", if one exists.
bool pop_events (int client_id, int &count, byte_array &event_data, int max_size)
 retrieves all of the events waiting for the object with "client_id".
bool peek_events (int client_id, int &count, int &data_length) const
 reports how many events are waiting in "count".
void flush_events (int client_id)
 removes all events stored for this object.

Detailed Description

The manager of zings that are awaiting delivery to zingable objects.

This is separate from the zingables to avoid massive locking requirements to get to the repository for data.

Definition at line 36 of file zing_table.h.


Constructor & Destructor Documentation

zing_table::zing_table ( int  overall_memory,
int  per_user_memory 
)

creates a new zing table.

the table is allowed to have "overall_memory" currently occupied with zings. the "per_user_memory" specifies how much memory any individual identifier is allowed to possess.

Definition at line 58 of file zing_table.cpp.

zing_table::~zing_table (  ) 

Definition at line 64 of file zing_table.cpp.

References WHACK().


Member Function Documentation

zing_table::IMPLEMENT_CLASS_NAME ( "zing_table"   ) 

bool zing_table::add_client ( int  new_client_id  ) 

lists a new client that could have items held here.

Definition at line 71 of file zing_table.cpp.

Referenced by zingable::zingable().

bool zing_table::remove_client ( int  outgoing_client_id  ) 

delists a client that has been shut down.

Definition at line 82 of file zing_table.cpp.

Referenced by zingable::~zingable().

void zing_table::zing_event ( int  client_id,
int  event,
const byte_array data 
)

Definition at line 91 of file zing_table.cpp.

void zing_table::zing_event ( int  client_id,
int  event,
const byte_array data,
const int_set targets 
)

zings a record of an "event" at our destination.

the zing may optionally have some "data". the destination can later communicate to receive the "data".

Definition at line 96 of file zing_table.cpp.

References FUNCDEF, array< contents >::length(), LOG, memory_limiter::okay_allocation(), event_record::pack(), and ZING_COMPLAINT_INTERVAL.

int zing_table::show_events ( int  client_id,
const istring name,
istring output,
int  indentation 
)

lists out the events currently held.

uses the "indentation" as the number of spaces to indent. the number of records printed is returned.

Definition at line 139 of file zing_table.cpp.

References system_values::EVENT_VALUES(), string_manipulation::indentation(), system_values::lookup(), log_base::platform_ending(), and istring::s().

Referenced by zingable::show_events().

bool zing_table::pop_event ( int  client_id,
int &  event,
byte_array event_data,
int_set targets 
)

retrieves the next "event" for this object, if one exists.

true is returned if one was waiting. "event_data" contains the extra info for the event, if it is not NIL.

Definition at line 169 of file zing_table.cpp.

References event_record::_data, event_record::_event, event_record::_targets, FUNCDEF, array< contents >::length(), LOG, NIL, and memory_limiter::record_deletion().

bool zing_table::peek_event ( int  client_id,
int &  event,
int &  data_length,
int_set targets 
) const

looks at the top "event", if one exists.

true is returned if one was waiting. if "data_length" is non-zero, then the event has some data.

Definition at line 199 of file zing_table.cpp.

References event_record::_data, event_record::_event, event_record::_targets, and array< contents >::length().

bool zing_table::pop_events ( int  client_id,
int &  count,
byte_array event_data,
int  max_size 
)

retrieves all of the events waiting for the object with "client_id".

this packs the events into the "event_data" with the event number first and the data length and data next. the number of chunks is set in "count". if the "max_size" is non-zero, then it specifies how much space can be used for event packing. this is measured against the current size of "event_data" as well; it is not how much can be added now, but how much overall.

Definition at line 227 of file zing_table.cpp.

References basis::attach(), FUNCDEF, array< contents >::length(), LOG, array< contents >::overwrite(), memory_limiter::record_deletion(), and istring::SPRINTF.

bool zing_table::peek_events ( int  client_id,
int &  count,
int &  data_length 
) const

reports how many events are waiting in "count".

also reports the full size needed to hold all of the ones so far in "data_length". this returns true if any were waiting.

Definition at line 317 of file zing_table.cpp.

Referenced by zingable::text_form().

void zing_table::flush_events ( int  client_id  ) 

removes all events stored for this object.

Definition at line 219 of file zing_table.cpp.


The documentation for this class was generated from the following files:
Generated on Tue Aug 19 05:12:44 2008 for HOOPLE Libraries by  doxygen 1.5.1