core/object.h File Reference


Detailed Description

Id
object.h 1207 2009-01-12 22:47:29Z d3p988
Copyright (C) 2008 Battelle Memorial Institute

Definition in file object.h.

Go to the source code of this file.

Classes

struct  s_namespace
 Full object name (including space name). More...

Defines

#define GETADDR(O, P)   (O?((void*)((char*)(O+1)+(unsigned int64)((P)->addr))):NULL)
 get the addr of an object's property
#define MYPARENT   ((((OBJECT*)this)-1)->parent)
 get the parent from the object's data structure
#define object_id(X)   ((X)?(X)->id:-1)
 get the id of the object X
#define object_parent(X)   ((X)?(X)->parent:NULL)
 get the parent of the object
#define object_rank(X)   ((X)?(X)->name:-1)
 get the rank of the object
#define object_size(X)   ((X)?(X)->size:-1)
 get the size of the object X
#define OBJECTDATA(X, T)   ((T*)((X)?((X)+1):NULL))
 get the object data structure
#define OBJECTHDR(X)   ((X)?(((OBJECT*)X)-1):NULL)
 get the header from the object's data structure
#define OF_FOREIGN   0x0010
 Object flag; indicates that object was created in a DLL and memory cannot be freed by core.
#define OF_HASPLC   0x0001
 Object flag; external PLC is attached, disables local PLC.
#define OF_LOCKED   0x0002
 Object flag; data write pending, reread recommended after lock clears.
#define OF_NONE   0x0000
 Full object name (including space name).
#define OF_RECALC   0x0008
 Object flag; recalculation of derived values is needed.
#define OF_RERANK   0x4000
 Internal use only.
#define OF_SKIPSAFE   0x0020
 Object flag; indicates that skipping updates is safe.

Typedefs

typedef struct s_callbacks CALLBACKS
 core callback function table
typedef char FULLNAME [1024]
 Object name.
typedef struct s_object_list OBJECT
 Object header structure.
typedef char * OBJECTNAME
 Object id number.
typedef unsigned int OBJECTNUM
 Object data size.
typedef unsigned int OBJECTRANK
 Object rank number.

Functions

int object_close_namespace ()
 Closes the current namespace.
OBJECTobject_create_array (CLASS *oclass, unsigned int n_objects)
 Create multiple objects.
OBJECTobject_create_foreign (OBJECT *obj)
 Create a foreign object.
OBJECTobject_create_single (CLASS *oclass)
 Create a single object.
NAMESPACEobject_current_namespace ()
 Get the current namespace.
int object_dump (char *outbuffer, int size, OBJECT *obj)
 Dump an object to a buffer.
OBJECTobject_find_by_id (OBJECTNUM id)
 Find an object by its id number.
OBJECTobject_find_name (OBJECTNAME name)
 Find an object from a name.
void * object_get_addr (OBJECT *obj, char *name)
 Get the address of a property value.
unsigned int object_get_count ()
 Get the number of objects defined.
OBJECTobject_get_first ()
 Get the first object in the model.
int object_get_namespace (OBJECT *obj, char *buffer, int size)
 Get full namespace of object's space.
OBJECTobject_get_next (OBJECT *obj)
 Get the next object in the model.
PROPERTY * object_get_property (OBJECT *obj, PROPERTYNAME name)
 Get a named property of an object.
OBJECTobject_get_reference (OBJECT *obj, char *name)
 Get a reference to another object.
char * object_get_unit (OBJECT *obj, char *name)
 Get the unit of an object, if any.
int object_get_value_by_addr (OBJECT *obj, void *addr, char *value, int size, PROPERTY *prop)
 Get a property value by reference to its physical address.
int object_get_value_by_name (OBJECT *obj, PROPERTYNAME name, char *value, int size)
 Get a value by reference to its property name.
int object_init (OBJECT *obj)
 Initialize an object.
int object_isa (OBJECT *obj, char *type)
 Tests the type of an object.
int object_locate_property (void *addr, OBJECT **pObj, PROPERTY **pProp)
 Locate the object and property corresponding the address of data.
char * object_name (OBJECT *obj)
 Get the name of an object.
void object_namespace (char *buffer, int size)
 Get the full namespace of current space.
int object_open_namespace (char *space)
 Opens a new namespace within the current name space.
NAMESPACEobject_pop_namespace ()
 restore the previous namespace from stack
int object_push_namespace (char *space)
 change to another namespace and push the one onto a stack
OBJECTobject_remove_by_id (OBJECTNUM id)
 Removes a single object.
int object_saveall (FILE *fp)
 Save all the objects in the model to the stream fp in the .GLM format.
int object_saveall_xml (FILE *fp)
 Save all the objects in the model to the stream fp in the .XML format.
int object_select_namespace (char *space)
 Makes the namespace active.
int object_set_dependent (OBJECT *obj, OBJECT *dependent)
 Set the dependent of an object.
OBJECTNAME object_set_name (OBJECT *obj, OBJECTNAME name)
 Sets the name of an object.
int object_set_parent (OBJECT *obj, OBJECT *parent)
 Set the parent of an object.
int object_set_rank (OBJECT *obj, OBJECTRANK rank)
 Set the rank of an object but forcing it's parent to increase rank if necessary.
int object_set_value_by_addr (OBJECT *obj, void *addr, char *value, PROPERTY *prop)
 Set a property value by reference to its physical address.
int object_set_value_by_name (OBJECT *obj, PROPERTYNAME name, char *value)
 Set a property value by reference to its name.
TIMESTAMP object_sync (OBJECT *obj, TIMESTAMP ts, PASSCONFIG pass)
 Synchronize an object.


GridLAB-DTM Version 2.0
An open-source project initiated by the US Department of Energy