MysoreScript
Public Member Functions | List of all members
Interpreter::Value Class Reference

Value wraps an object pointer. More...

#include <interpreter.hh>

Public Member Functions

Obj * address ()
 Returns the address of the object. More...
 
 Value ()
 Default constructor, the value is null. More...
 
 Value (Obj o)
 Construct a new value from an object pointer. More...
 
 Value (Value &o)
 Copy constructor. More...
 
 Value (Value &&o)
 Move constructor. More...
 
 ~Value ()
 Destructor, responsible for removing the reference from the GC's view. More...
 
void operator= (Obj o)
 
void operator= (Value &o)
 
 operator Obj ()
 
bool isInteger ()
 Returns true if this object is a small integer, false otherwise. More...
 
int getIntValue ()
 Returns the integer value of this object, if it is a small integer. More...
 

Detailed Description

Value wraps an object pointer.

It is responsible for informing the garbage collector that the object is referenced outside of the GC'd heap and so should not be deallocated.

Note that the GC tracks the stack, so it is not necessary to use this class for object pointers stored purely on the stack.

Definition at line 25 of file interpreter.hh.

Constructor & Destructor Documentation

§ Value() [1/4]

Interpreter::Value::Value ( )
inline

Default constructor, the value is null.

Definition at line 57 of file interpreter.hh.

§ Value() [2/4]

Interpreter::Value::Value ( Obj  o)
inline

Construct a new value from an object pointer.

Definition at line 61 of file interpreter.hh.

§ Value() [3/4]

Interpreter::Value::Value ( Value o)
inline

Copy constructor.

Definition at line 65 of file interpreter.hh.

§ Value() [4/4]

Interpreter::Value::Value ( Value &&  o)
inline

Move constructor.

Definition at line 69 of file interpreter.hh.

Here is the call graph for this function:

§ ~Value()

Interpreter::Value::~Value ( )

Destructor, responsible for removing the reference from the GC's view.

Definition at line 313 of file interpreter.cc.

Here is the call graph for this function:
Here is the caller graph for this function:

Member Function Documentation

§ address()

Obj* Interpreter::Value::address ( )
inline

Returns the address of the object.

This is used so that the storage can be used for values in a symbol table. All globals are handled by creating an instance of this class and then adding the address to the symbol table.

Definition at line 50 of file interpreter.hh.

§ getIntValue()

int Interpreter::Value::getIntValue ( )
inline

Returns the integer value of this object, if it is a small integer.

Definition at line 94 of file interpreter.hh.

Here is the call graph for this function:

§ isInteger()

bool Interpreter::Value::isInteger ( )
inline

Returns true if this object is a small integer, false otherwise.

Definition at line 87 of file interpreter.hh.

Here is the caller graph for this function:

§ operator Obj()

Interpreter::Value::operator Obj ( )
inline

Definition at line 80 of file interpreter.hh.

§ operator=() [1/2]

void Interpreter::Value::operator= ( Obj  o)
inline

Definition at line 78 of file interpreter.hh.

§ operator=() [2/2]

void Interpreter::Value::operator= ( Value o)
inline

Definition at line 79 of file interpreter.hh.


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