Main Page   Compound List   File List   Compound Members   File Members  

lib/gobj/object.h File Reference

Common object type implementation. More...

#include <gobjconfig.h>
#include <gobj/decls.h>
#include <gobj/id.h>
#include <gobj/context.h>
#include <gobj/nativetypes.h>
#include <stdio.h>

Go to the source code of this file.

Compounds

struct  Gj_Object_struct
struct  gj_Linkrecord_struct

Functions

Gj_ObjectGj_object_new (Gj_Ctx* ctx, Gj_Id* type, char* name)
 Create a new object. More...

Gj_ObjectGj_object_duplicate (Gj_Ctx* ctx, Gj_Object* obj)
 Create a new object as a copy of existing object. More...

Gj_ObjectGj_object_create (Gj_Ctx* ctx, Gj_Stream* stream, Gj_Object* update)
 Create a object form a stream. More...

int Gj_object_delete (Gj_Ctx* ctx, Gj_Object* ptr)
 Delete an object. More...

int Gj_object_deleteLocal (Gj_Ctx* ctx, Gj_Object* ptr)
 Delete an object without following links. More...

int Gj_object_write (Gj_Ctx* ctx, Gj_Object* obj, Gj_Stream* stream)
 Write an object to a stream. More...

void gj_object_initLocks (Gj_Object* obj)
 Initialize the locking system of the given object. More...

void gj_object_finalizeLocks (Gj_Object* obj)
 Finalize the locking system. More...

void gj_object_lockShared (Gj_Object* obj)
 Aquire a shared lock for the object. More...

void Gj_object_unlockShared (Gj_Object* obj)
 Release a shared lock. More...

int Gj_object_release (Gj_Ctx* ctx, Gj_Object* obj)
 Releases an object. More...

void Gj_object_lockExcl (Gj_Object* obj)
 Aquire an exclusive lock for the object. More...

void Gj_object_unlockExcl (Gj_Object* obj)
 Release an exclusive lock. More...

Gj_IdGj_object_assignId (Gj_Ctx* ctx, Gj_Object* obj)
 Assign an id to this object. More...

void Gj_object_markTemp (Gj_Object* obj)
 Mark the object as temporary. More...

Gj_Bool Gj_object_isTemp (Gj_Object* obj)
 Get the temp flag. More...

int Gj_object_getName (Gj_Ctx* ctx, Gj_Object* obj, char** name)
 Get the name of the object. More...

int Gj_object_setName (Gj_Ctx* ctx, Gj_Object* obj, char* name)
Gj_Nativetype Gj_object_getNativetype (Gj_Ctx* ctx, Gj_Object* obj)
int Gj_object_setByName (Gj_Ctx* ctx, Gj_Object* obj, char* name, Gj_Object* value)
int Gj_object_setByNumber (Gj_Ctx* ctx, Gj_Object* obj, int index, Gj_Object* value)
int Gj_object_getByName (Gj_Ctx* ctx, Gj_Object* obj, char* name, Gj_Object** value, Gj_Bool convert)
int Gj_object_getByNumber (Gj_Ctx* ctx, Gj_Object* obj, int index, Gj_Object** value, Gj_Bool convert)
int Gj_object_nextChild (Gj_Ctx* ctx, Gj_Object* obj, Gj_Object** last, Gj_Bool convert)
int Gj_object_getChildCount (Gj_Ctx* ctx, Gj_Object* obj)
int Gj_object_add (Gj_Ctx* ctx, Gj_Object* obj, Gj_Object* value)
int gj_object_add (Gj_Ctx* ctx, Gj_Object* obj, Gj_Object* value)
int Gj_object_removeByNumber (Gj_Ctx* ctx, Gj_Object* obj, int index)
Gj_ObjectGj_object_convert (Gj_Ctx* ctx, Gj_Object* obj, Gj_Id* type)
int Gj_object_addViewer (Gj_Ctx* ctx, Gj_Object* obj, Gj_Viewer* viewer)
int Gj_object_deleteViewers (Gj_Ctx* ctx, Gj_Object* obj)
void Gj_object_dump (Gj_Ctx* ctx, Gj_Object* obj, FILE* s, int* indent)


Detailed Description

Common object type implementation.


Function Documentation

Gj_Object * Gj_object_new ( Gj_Ctx * ctx,
Gj_Id * type,
char * name )
 

Create a new object.

Parameters:
ctx   The context.
type   Model id.
name   Object name (is being DUPLICATED, may be 0).

Returns:
The pointer to the new object on success, 0 otherwise.

Gj_Object * Gj_object_duplicate ( Gj_Ctx * ctx,
Gj_Object * obj )
 

Create a new object as a copy of existing object.

Parameters:
ctx   The context.
obj   The source object.

Returns:
The pointer to the new object on success, 0 otherwise.

Gj_Object * Gj_object_create ( Gj_Ctx * ctx,
Gj_Stream * stream,
Gj_Object * update )
 

Create a object form a stream.

Parameters:
ctx   The context.
stream   The stream.
update   A pointer to the object that is to be called on update (may be 0).

Returns:
The pointer to the object on success, 0 otherwise.

int Gj_object_delete ( Gj_Ctx * ctx,
Gj_Object * ptr )
 

Delete an object.

Parameters:
ctx   The context.
ptr   The object.

Returns:
0 on success, -1 otherwise.

int Gj_object_deleteLocal ( Gj_Ctx * ctx,
Gj_Object * ptr )
 

Delete an object without following links.

Parameters:
ctx   The context.
ptr   The object.

Returns:
0 on success, -1 otherwise.

int Gj_object_write ( Gj_Ctx * ctx,
Gj_Object * obj,
Gj_Stream * stream )
 

Write an object to a stream.

Parameters:
ctx   The context.
obj   The object.
stream   The stream.

Returns:
0 on success, -1 otherwise.

void gj_object_initLocks ( Gj_Object * obj )
 

Initialize the locking system of the given object.

Parameters:
obj   The object.

void gj_object_finalizeLocks ( Gj_Object * obj )
 

Finalize the locking system.

Parameters:
obj   The object.

void gj_object_lockShared ( Gj_Object * obj )
 

Aquire a shared lock for the object.

Parameters:
obj   The object.

void Gj_object_unlockShared ( Gj_Object * obj )
 

Release a shared lock.

Destroy the object if that was the last shared lock and it is temporary.

Parameters:
obj   The object.

int Gj_object_release ( Gj_Ctx * ctx,
Gj_Object * obj )
 

Releases an object.

Release one shared lock. Destroy the object if that was the last shared lock and it is temporary.

Parameters:
ctx   The context.
obj   The object.

Returns:
0 on success, -1 otherwise.

void Gj_object_lockExcl ( Gj_Object * obj )
 

Aquire an exclusive lock for the object.

The object must have one shared lock.

Parameters:
obj   The object.

void Gj_object_unlockExcl ( Gj_Object * obj )
 

Release an exclusive lock.

Parameters:
obj   The object.

Gj_Id * Gj_object_assignId ( Gj_Ctx * ctx,
Gj_Object * obj )
 

Assign an id to this object.

Parameters:
ctx   The context.
obj   The object.

Returns:
A pointer to this id on success (OWNED by the object), 0 otherwise.

void Gj_object_markTemp ( Gj_Object * obj )
 

Mark the object as temporary.

Does not follow links.

Parameters:
obj   The object.

Gj_Bool Gj_object_isTemp ( Gj_Object * obj )
 

Get the temp flag.

Parameters:
obj   The object.

Returns:
Whether the object is temporary or not.

int Gj_object_getName ( Gj_Ctx * ctx,
Gj_Object * obj,
char ** name )
 

Get the name of the object.

Returns the name in *name, this value is STILL OWNED by the object.

Returns:
0 on success, -1 otherwise.


Generated at Fri Aug 17 18:28:57 2001 for Gobj by doxygen1.2.1 written by Dimitri van Heesch, © 1997-2000