Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members

zeitgeist::GCValue Class Reference

ruby VALUE wrapper. More...

#include <gcvalue.h>

List of all members.

Public Member Functions

 GCValue ()
 GCValue (const GCValue &value)
 GCValue (VALUE v)
 GCValue (bool b)
 constructs the corresponding ruby boolean
 GCValue (const std::string &str)
 constructs a new ruby string object
 GCValue (const char *str)
 constructs a new ruby string object
 GCValue (float f)
 constructs a new ruby float object
 GCValue (int i)
 constructs a new riby int object
 ~GCValue ()
void operator= (const GCValue &value)
void operator= (const VALUE &value)
VALUE Get ()
 returns the stored ruby VALUE
void Set (VALUE v)
 sets the setored value to v.
bool IsNil ()
 returns true if the stored value equals QNil
bool GetInt (int &value)
 tries to convert the stored value to an integer value, returns true on success
bool GetFloat (float &value)
 tries to convert the stored value to a float value, returns true on success
bool GetBool (bool &value)
 tries to convert the stored value to a bool value, returns true on success
bool GetString (std::string &value)
 tries to convert the stored value to a string, returns true on success

Protected Member Functions

void GC_Unregister ()
 unregisters the stored VALUE from the ruby garbage collector, i.e marks mValue no longer as busy
void GC_Register ()
 registers the stored VALUE to the ruby garbage collector, i.e.

Protected Attributes

VALUE mValue
 the wrapped ruby VALUE


Detailed Description

ruby VALUE wrapper.

It is responsible to register and unregister the wrapped value as busy with the ruby garbage collector. The ruby garbage collector might be transparently invoked on any call to ruby. If a returned VALUE must stay valid during a series of ruby function calls you should use this wrapper. A simple use case is a VALUE returned from ruby that is used as an argument in a subsequent function call. This wrapper also provides some helpers to access and convert the stored value.

Definition at line 40 of file gcvalue.h.


Constructor & Destructor Documentation

GCValue::GCValue  ) 
 

Definition at line 28 of file gcvalue.cpp.

References mValue.

GCValue::GCValue const GCValue value  ) 
 

Definition at line 33 of file gcvalue.cpp.

References mValue, and Set().

Here is the call graph for this function:

GCValue::GCValue VALUE  v  ) 
 

Definition at line 39 of file gcvalue.cpp.

References mValue, and Set().

Here is the call graph for this function:

GCValue::GCValue bool  b  ) 
 

constructs the corresponding ruby boolean

Definition at line 45 of file gcvalue.cpp.

References mValue, and Set().

Here is the call graph for this function:

zeitgeist::GCValue::GCValue const std::string &  str  ) 
 

constructs a new ruby string object

GCValue::GCValue const char *  str  ) 
 

constructs a new ruby string object

Definition at line 57 of file gcvalue.cpp.

References mValue, and Set().

Here is the call graph for this function:

GCValue::GCValue float  f  ) 
 

constructs a new ruby float object

Definition at line 63 of file gcvalue.cpp.

References mValue, and Set().

Here is the call graph for this function:

GCValue::GCValue int  i  ) 
 

constructs a new riby int object

Definition at line 69 of file gcvalue.cpp.

References mValue, and Set().

Here is the call graph for this function:

GCValue::~GCValue  ) 
 

Definition at line 75 of file gcvalue.cpp.

References GC_Unregister().

Here is the call graph for this function:


Member Function Documentation

void GCValue::GC_Register  )  [protected]
 

registers the stored VALUE to the ruby garbage collector, i.e.

marks it as busy

Definition at line 199 of file gcvalue.cpp.

References IsNil(), and mValue.

Referenced by Set().

Here is the call graph for this function:

void GCValue::GC_Unregister  )  [protected]
 

unregisters the stored VALUE from the ruby garbage collector, i.e marks mValue no longer as busy

Definition at line 191 of file gcvalue.cpp.

References IsNil(), and mValue.

Referenced by Set(), and ~GCValue().

Here is the call graph for this function:

VALUE GCValue::Get  ) 
 

returns the stored ruby VALUE

Definition at line 92 of file gcvalue.cpp.

References mValue.

Referenced by getObject(), newObject(), selectCall(), selectObject(), and thisCall().

bool GCValue::GetBool bool &  value  ) 
 

tries to convert the stored value to a bool value, returns true on success

Definition at line 131 of file gcvalue.cpp.

References IsNil(), and mValue.

Here is the call graph for this function:

bool GCValue::GetFloat float &  value  ) 
 

tries to convert the stored value to a float value, returns true on success

Definition at line 120 of file gcvalue.cpp.

References IsNil(), and mValue.

Here is the call graph for this function:

bool GCValue::GetInt int &  value  ) 
 

tries to convert the stored value to an integer value, returns true on success

Definition at line 109 of file gcvalue.cpp.

References IsNil(), and mValue.

Here is the call graph for this function:

bool GCValue::GetString std::string &  value  ) 
 

tries to convert the stored value to a string, returns true on success

Definition at line 153 of file gcvalue.cpp.

References IsNil(), and mValue.

Here is the call graph for this function:

bool GCValue::IsNil  ) 
 

returns true if the stored value equals QNil

Definition at line 104 of file gcvalue.cpp.

References mValue.

Referenced by GC_Register(), GC_Unregister(), GetBool(), GetFloat(), GetInt(), and GetString().

void GCValue::operator= const VALUE &  value  ) 
 

Definition at line 86 of file gcvalue.cpp.

References mValue, and Set().

Here is the call graph for this function:

void GCValue::operator= const GCValue value  ) 
 

Definition at line 80 of file gcvalue.cpp.

References mValue, and Set().

Here is the call graph for this function:

void GCValue::Set VALUE  v  ) 
 

sets the setored value to v.

Any previously stored value is properly unregistered

Definition at line 97 of file gcvalue.cpp.

References GC_Register(), GC_Unregister(), and mValue.

Referenced by GCValue(), and operator=().

Here is the call graph for this function:


Member Data Documentation

VALUE zeitgeist::GCValue::mValue [protected]
 

the wrapped ruby VALUE

Definition at line 111 of file gcvalue.h.

Referenced by GC_Register(), GC_Unregister(), GCValue(), Get(), GetBool(), GetFloat(), GetInt(), GetString(), IsNil(), operator=(), and Set().


The documentation for this class was generated from the following files:
Generated on Thu Apr 6 15:51:11 2006 for rcssserver3d by  doxygen 1.4.4