libglass::Remote< T, T, T > Class Template Reference

#include <remotevar.h>

Inheritance diagram for libglass::Remote< T, T, T >:

libglass::_Remote libglass::PluginInterface

List of all members.

Public Member Functions

 Remote (const char *name, T data=T()) throw (Exception)
bool setData (T &b, nodeId id=nobodyId)
const T & getData (nodeId id=nobodyId) const throw (Exception)
T & operator* (void) const
void lock (void)
void unlock (void)

Protected Member Functions

chain pack (void)
bool unpack (chain &c, unsigned int &used)

Protected Attributes

data


Detailed Description

template<typename T, Serializer *, T = rawPack<T>, Unserializer *, T = rawUnpack<T>>
class libglass::Remote< T, T, T >

Remote variables base template.
See also:
_Remote.

Definition at line 188 of file remotevar.h.


Constructor & Destructor Documentation

template<typename T , Serializer *, T = rawPack<T>, Unserializer *, T = rawUnpack<T>>
libglass::Remote< T, T, T >::Remote ( const char *  name,
data = T() 
) throw (Exception) [inline]

Constructor.

Parameters:
name The variable name.
data The variable data.

Definition at line 228 of file remotevar.h.


Member Function Documentation

template<typename T , Serializer *, T = rawPack<T>, Unserializer *, T = rawUnpack<T>>
const T& libglass::Remote< T, T, T >::getData ( nodeId  id = nobodyId  )  const throw (Exception) [inline]

Returns the variable value.

Parameters:
id The id to
Returns:
The variable value.
Warning:
If you use this function to get a reference to the value, take care because the value can change asynchronously.

Definition at line 258 of file remotevar.h.

References libglass::_Remote::_getValue(), libglass::Remote< T, T, T >::data, libglass::nobodyId, and libglass::Remote< T, T, T >::unpack().

template<typename T , Serializer *, T = rawPack<T>, Unserializer *, T = rawUnpack<T>>
void libglass::Remote< T, T, T >::lock ( void   )  [inline]

Lock this variable.

Bug:
While the variable is locked, the entire Glass instance is locked. Fix unpack() later to store the new value in a temporary slot while this is locked instead.

Definition at line 287 of file remotevar.h.

References libglass::_Remote::mutex.

template<typename T , Serializer *, T = rawPack<T>, Unserializer *, T = rawUnpack<T>>
T& libglass::Remote< T, T, T >::operator* ( void   )  const [inline]

Value operator.

Returns:
A reference to this instance.

Definition at line 277 of file remotevar.h.

References libglass::Remote< T, T, T >::data.

template<typename T , Serializer *, T = rawPack<T>, Unserializer *, T = rawUnpack<T>>
chain libglass::Remote< T, T, T >::pack ( void   )  [inline, protected, virtual]

Pack function. Serializes the variable to a string.

Returns:
The variable, serialized to a string.

Reimplemented from libglass::_Remote.

Definition at line 192 of file remotevar.h.

References libglass::Remote< T, T, T >::data.

template<typename T , Serializer *, T = rawPack<T>, Unserializer *, T = rawUnpack<T>>
bool libglass::Remote< T, T, T >::setData ( T &  b,
nodeId  id = nobodyId 
) [inline]

Assignment operator.

Parameters:
b The value to assign.
id The node to assign to.
Returns:

Definition at line 239 of file remotevar.h.

References libglass::_Remote::_setValue(), libglass::Remote< T, T, T >::data, and libglass::nobodyId.

template<typename T , Serializer *, T = rawPack<T>, Unserializer *, T = rawUnpack<T>>
void libglass::Remote< T, T, T >::unlock ( void   )  [inline]

Unlock this variable.

Definition at line 294 of file remotevar.h.

References libglass::_Remote::mutex.

template<typename T , Serializer *, T = rawPack<T>, Unserializer *, T = rawUnpack<T>>
bool libglass::Remote< T, T, T >::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 unserializer.
Returns:

Reimplemented from libglass::_Remote.

Definition at line 198 of file remotevar.h.

References libglass::Remote< T, T, T >::data, libglass::chain::find(), libglass::_Remote::mutex, and libglass::chain::npos.

Referenced by libglass::Remote< T, T, T >::getData().


Member Data Documentation

template<typename T , Serializer *, T = rawPack<T>, Unserializer *, T = rawUnpack<T>>
T libglass::Remote< T, T, T >::data [protected]


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