libglass::_Shared Class Reference

#include <shared.h>

Inheritance diagram for libglass::_Shared:

libglass::PluginInterface libglass::Shared< T, T, T >

List of all members.

Public Types

enum  UpdateMode { NEVER, NEXT_ONLY, CHANGED, FORCED }

Public Member Functions

void setUpdateMode (UpdateMode updatemode)
UpdateMode getUpdateMode (void) const
bool hasChanged (void) const
bool sendUpdate (void)
bool getUpdate (void)

Static Public Member Functions

static bool sendUpdateAll (void)

Protected Member Functions

 _Shared (const string &name) throw (Exception)
virtual ~_Shared ()
virtual chain pack (void)
virtual bool unpack (chain &s, unsigned int &used)

Protected Attributes

SharedBasesb
string name
bool changed
UpdateMode updatemode
boost::condition_variable trigger
nodeId lastchanged
std::set< nodeIdowners
chain currentdata
chain nextdata

Friends

class SharedBase
class SharedPacket


Detailed Description

Abstract base class for shared variables.

Todo:
Prefetch new values, presend updates.

Definition at line 139 of file shared.h.


Member Enumeration Documentation

Enumerator:
NEVER 
NEXT_ONLY 
CHANGED 
FORCED 

Definition at line 141 of file shared.h.


Constructor & Destructor Documentation

libglass::_Shared::_Shared ( const string name  )  throw (Exception) [protected]

Constructor.

Parameters:
name The variable name.
Exceptions:
Exception. 

virtual libglass::_Shared::~_Shared (  )  [protected, virtual]

Destructor.


Member Function Documentation

bool libglass::_Shared::getUpdate ( void   ) 

Synchronizes this variable.

Return values:
True If successful.
false Otherwise.

UpdateMode libglass::_Shared::getUpdateMode ( void   )  const [inline]

Definition at line 194 of file shared.h.

bool libglass::_Shared::hasChanged ( void   )  const [inline]

Has the value changed since last update?

Return values:
True if changed.
False otherwise.

Definition at line 202 of file shared.h.

virtual chain libglass::_Shared::pack ( void   )  [inline, protected, virtual]

Pack function. Serializes the variable to a string.

Returns:
The variable, serialized to a string.

Reimplemented in libglass::Shared< T, T, T >.

Definition at line 179 of file shared.h.

bool libglass::_Shared::sendUpdate ( void   ) 

static bool libglass::_Shared::sendUpdateAll ( void   )  [static]

Synchronizes all variables.

All updates are sent as one, saving bandwidth and cutting the delay.

Warning:
IMPORTANT! Since this method is static, it guesses that the variable you want to synchronize are those of the current Glass class. You only have to care about this if you instantiate more than one Glass derived class in the same application, which you are almost certainly not doing. If you don't know for sure, you are not doing it; go worry about something else.
See also:
Glass.
Return values:
True If successful.
false Otherwise.

void libglass::_Shared::setUpdateMode ( UpdateMode  updatemode  )  [inline]

Definition at line 190 of file shared.h.

virtual bool libglass::_Shared::unpack ( chain s,
unsigned int &  used 
) [inline, protected, virtual]

Unpack function. Unserializes the string to a variable.

Parameters:
s The string.
used The number of bytes used by the unserialization.
Returns:

Reimplemented in libglass::Shared< T, T, T >.

Definition at line 187 of file shared.h.


Friends And Related Function Documentation

friend class SharedBase [friend]

Definition at line 144 of file shared.h.

friend class SharedPacket [friend]

Definition at line 145 of file shared.h.


Member Data Documentation

bool libglass::_Shared::changed [protected]

have we changed since the last update?

Definition at line 153 of file shared.h.

Referenced by libglass::Shared< T, T, T >::assign(), and libglass::Shared< T, T, T >::operator=().

serialized data

Definition at line 160 of file shared.h.

who was the last to change this variable?

Definition at line 158 of file shared.h.

the variable name.

Definition at line 148 of file shared.h.

value for next update

Definition at line 161 of file shared.h.

std::set<nodeId> libglass::_Shared::owners [protected]

owner list

Definition at line 159 of file shared.h.

our owner plugin.

Definition at line 147 of file shared.h.

boost::condition_variable libglass::_Shared::trigger [protected]

to guarantee that an update arrived

Definition at line 155 of file shared.h.

our update mode. Default is always.

Definition at line 154 of file shared.h.


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

Generated on Fri May 28 13:19:01 2010 for libGlass by  doxygen 1.5.8