PnSymbolTable

Name

PnSymbolTable -- an object for managing in-script variables

Synopsis


#include <pn/pn.h>


struct      PnSymbolTable;
PnSymbolTable* pn_symbol_table_new          (void);
PnVariable* pn_symbol_table_ref_variable_by_name
                                            (PnSymbolTable *symbol_table,
                                             const gchar *name);
void        pn_symbol_table_ref_variable    (PnSymbolTable *symbol_table,
                                             PnVariable *variable);
struct      PnVariable;
void        pn_symbol_table_unref_variable  (PnSymbolTable *symbol_table,
                                             PnVariable *variable);

Object Hierarchy


  GObject
   +----PnObject
         +----PnSymbolTable

Description

PnSymbolTable objects manage a list of in-script variables. A reference counting system is used to allow user-created variables to be freed when no longer needed, while keeping variables needed by the actuator.

Details

struct PnSymbolTable

struct PnSymbolTable;


pn_symbol_table_new ()

PnSymbolTable* pn_symbol_table_new          (void);

Creates a new PnSymbolTable object.

Returns : The newly created PnSymbolTable object


pn_symbol_table_ref_variable_by_name ()

PnVariable* pn_symbol_table_ref_variable_by_name
                                            (PnSymbolTable *symbol_table,
                                             const gchar *name);

Retrieves an in-script variable contained within a symbol table and increments the variable's reference count. If the variable is not yet in the symbol table, it is added (with a value of 0.0).

symbol_table : a PnSymbolTable
name : the name a an in-script variable
Returns : A pointer to the variable object


pn_symbol_table_ref_variable ()

void        pn_symbol_table_ref_variable    (PnSymbolTable *symbol_table,
                                             PnVariable *variable);

Increments the reference count of an in-script variable contained within a symbol table.

symbol_table : a PnSymbolTable
variable : an in-script variable belonging to symbol_table


struct PnVariable

struct PnVariable
{
  /*< public >*/
  gdouble value; /* read-write */
  gchar *name;   /* read-only */

  /*< private >*/
  guint refs;
};


pn_symbol_table_unref_variable ()

void        pn_symbol_table_unref_variable  (PnSymbolTable *symbol_table,
                                             PnVariable *variable);

Decrements the reference count of an in-script variable. If the reference count becomes 0, the variable is freed from memory.

symbol_table : a PnSymbolTable
variable : an in-script variable belonging to symbol_table