life_maintainer Class Reference

Provides a catalog service for living_items. More...

#include <life_maintainer.h>

Inheritance diagram for life_maintainer:

Inheritance graph
[legend]
Collaboration diagram for life_maintainer:

Collaboration graph
[legend]
List of all members.

Public Types

typedef bool apply_function (living_item &current, void *data_link)
 functions of this type can be applied to the entire list.

Public Member Functions

 life_maintainer ()
virtual ~life_maintainer ()
 IMPLEMENT_CLASS_NAME ("life_maintainer")
int_set valid_ids () const
 returns a list of the current living_item objects' ids.
bool add (living_item *to_add)
 lists an item "to_add" in the catalog.
bool zap (const unique_int &uid)
 whacks the item listed under "uid".
heartbeat get_liveness (const unique_int &uid)
bool set_liveness (const unique_int &uid, const heartbeat &new_beat)
 accesses the liveness state for the transport.
bool kabump (const unique_int &uid)
 resets heartbeat timer, reflecting that object is still alive.
bool made_request (const unique_int &uid)
 records that another heartbeat request has been submitted to "uid".
living_itemacquire (const unique_int &uid)
 removes and returns the item with "uid" from the table.
living_itemlocking_find (const unique_int &uid)
 allows an entry to be looked up and manipulated.
void unlock_find (living_item *to_close)
 closes down the object given by "locking_find".
void apply (apply_function *to_apply, void *datalink)
 applies the function "to_apply" to every entry in the life maintainer.

Detailed Description

Provides a catalog service for living_items.

Definition at line 32 of file life_maintainer.h.


Member Typedef Documentation

typedef bool life_maintainer::apply_function(living_item &current, void *data_link)

functions of this type can be applied to the entire list.

Definition at line 77 of file life_maintainer.h.


Constructor & Destructor Documentation

life_maintainer::life_maintainer (  ) 

Definition at line 49 of file life_maintainer.cpp.

life_maintainer::~life_maintainer (  )  [virtual]

Definition at line 54 of file life_maintainer.cpp.

References WHACK().


Member Function Documentation

life_maintainer::IMPLEMENT_CLASS_NAME ( "life_maintainer"   ) 

int_set life_maintainer::valid_ids (  )  const

returns a list of the current living_item objects' ids.

Definition at line 60 of file life_maintainer.cpp.

References AUTO_LOCK.

bool life_maintainer::add ( living_item to_add  ) 

lists an item "to_add" in the catalog.

if the object already exists under the identifier for "to_add", then it is whacked and replaced.

Definition at line 66 of file life_maintainer.cpp.

References AUTO_LOCK, nodes::catalogable::id(), and unique_id< uniquifier >::raw_id().

Referenced by user_zinger::add().

bool life_maintainer::zap ( const unique_int uid  ) 

whacks the item listed under "uid".

Definition at line 73 of file life_maintainer.cpp.

References acquire(), mutex_base::lock(), living_item::shut_down_safely(), mutex_base::unlock(), and WHACK().

heartbeat life_maintainer::get_liveness ( const unique_int uid  ) 

Definition at line 90 of file life_maintainer.cpp.

References living_item::liveness(), locking_find(), and unlock_find().

bool life_maintainer::set_liveness ( const unique_int uid,
const heartbeat new_beat 
)

accesses the liveness state for the transport.

this is more detailed than the kabump method.

Definition at line 100 of file life_maintainer.cpp.

References living_item::liveness(), locking_find(), and unlock_find().

bool life_maintainer::kabump ( const unique_int uid  ) 

resets heartbeat timer, reflecting that object is still alive.

Definition at line 110 of file life_maintainer.cpp.

References heartbeat::kabump(), living_item::liveness(), locking_find(), and unlock_find().

bool life_maintainer::made_request ( const unique_int uid  ) 

records that another heartbeat request has been submitted to "uid".

if the object doesn't kabump after a certain number of requests, it is considered dead.

Definition at line 119 of file life_maintainer.cpp.

References living_item::liveness(), locking_find(), heartbeat::made_request(), and unlock_find().

living_item * life_maintainer::acquire ( const unique_int uid  ) 

removes and returns the item with "uid" from the table.

if it cannot be found, then NIL is returned.

Definition at line 167 of file life_maintainer.cpp.

References AUTO_LOCK, and unique_id< uniquifier >::raw_id().

Referenced by zap().

living_item * life_maintainer::locking_find ( const unique_int uid  ) 

allows an entry to be looked up and manipulated.

the unlock method _must_ be invoked after finishing with the item. it is crucial that the item be unlocked before any other methods are invoked on the life_maintainer or a deadlock can result.

Definition at line 145 of file life_maintainer.cpp.

References mutex_base::lock(), NIL, unique_id< uniquifier >::raw_id(), and mutex_base::unlock().

Referenced by apply(), get_liveness(), kabump(), made_request(), and set_liveness().

void life_maintainer::unlock_find ( living_item to_close  ) 

closes down the object given by "locking_find".

Definition at line 161 of file life_maintainer.cpp.

References mutex_base::unlock().

Referenced by apply(), get_liveness(), kabump(), made_request(), and set_liveness().

void life_maintainer::apply ( apply_function to_apply,
void *  datalink 
)

applies the function "to_apply" to every entry in the life maintainer.

Definition at line 128 of file life_maintainer.cpp.

References AUTO_LOCK, FUNCDEF, array< contents >::length(), locking_find(), and unlock_find().


The documentation for this class was generated from the following files:
Generated on Fri Aug 29 04:30:35 2008 for HOOPLE Libraries by  doxygen 1.5.1