Main Page   Compound List   File List   Compound Members   File Members  

lib/gobj/model.h File Reference

The model object type. More...

#include <gobjconfig.h>
#include <gobj/types.h>
#include <gobj/context.h>
#include <gobj/id.h>
#include <gobj/view.h>
#include <gobj/nativemgr.h>
#include <gobj/object.h>
#include <gobj/nativetypes.h>
#include <stdio.h>

Go to the source code of this file.

Compounds

struct  gj_Property_struct
struct  gj_Inheritance_struct
struct  Gj_Model_struct

Typedefs

typedef struct gj_Property_struct  gj_Property
 Property structure. More...

typedef struct gj_Inheritance_struct  gj_Inheritance
 Inheritance structure. More...


Functions

Gj_ModelGj_model_new (Gj_Ctx* ctx, char* name, Gj_Id* id, Gj_Model* hardinheritance)
 Create a new model. More...

Gj_ModelGj_model_create (Gj_Ctx* ctx, Gj_Stream* stream)
 Create a model form a given stream. More...

int Gj_model_write (Gj_Ctx* ctx, Gj_Model* model, Gj_Stream* stream)
 Write a model to a given stream. More...

int Gj_model_delete (Gj_Ctx* ctx, Gj_Model* ptr)
 Delete a model. More...

int Gj_model_register (Gj_Ctx* ctx, Gj_Model* model)
 Register a model. More...

int Gj_model_finish (Gj_Ctx* ctx, Gj_Model* model)
 Finish a model. More...

Gj_Bool Gj_model_isRegistered (Gj_Model* model)
 Check whether a model has been registered.

Gj_Bool Gj_model_isFinished (Gj_Model* model)
 Check whether a model has been finished.

Gj_Bool Gj_model_hasFixedProperties (Gj_Model* model)
 Check whether the model has fixed properties.

Gj_IdGj_model_getId (Gj_Ctx* ctx, Gj_Model* model)
 Get the id of the model. More...

char* Gj_model_getName (Gj_Model* model)
 Get the name of the model. More...

void Gj_model_instanceCreated (Gj_Model* model)
 Say to the model that it is being instantiated.

void Gj_model_instanceDeleted (Gj_Model* model)
 Say to the model that a instance of it is being deleted.

int Gj_model_getPropertyCount (Gj_Ctx* ctx, Gj_Model* model)
 Return the property count (only used for models with fixed properties). More...

int Gj_model_getPropertyNumber (Gj_Ctx* ctx, Gj_Model* model, char* name)
 Get the number of a property given by its name (only used for models with fixed properties). More...

Gj_IdGj_model_getPropertyType (Gj_Ctx* ctx, Gj_Model* model, int index)
 Get the type of a property given by its index (only used for models with fixed properties). More...

int Gj_model_getPropertyName (Gj_Ctx* ctx, Gj_Model* model, int index, char** name)
 Get the name of a property given by its index. More...

int Gj_model_addProperty (Gj_Ctx* ctx, Gj_Model* model, char* name, Gj_Id* type, Gj_Object* std)
 Add a property (only used for models with fixed properties). More...

int gj_model_fillProperties (Gj_Ctx* ctx, Gj_Model* model, Gj_Object** list)
 Fill the given property list with duplicates of the standard values. More...

int Gj_model_addView (Gj_Ctx* ctx, Gj_Model* model, Gj_View* view)
 Add a view. More...

int Gj_model_deleteViews (Gj_Ctx* ctx, Gj_Model* model)
 Delete all views. More...

int Gj_model_inherit (Gj_Ctx* ctx, Gj_Model* model, Gj_Id* id)
 Add an interheritance entry.

int Gj_model_isCompatible (Gj_Ctx* ctx, Gj_Model* model, Gj_Id* type, Gj_Bool* flag)
 Check if the model is compatible with the given type (that means it is inherited from the type). More...

int Gj_model_setChildType (Gj_Ctx* ctx, Gj_Model* model, Gj_Id* type)
 Set the child type (only used for models with non-fixed properties). More...

Gj_IdGj_model_getChildType (Gj_Ctx* ctx, Gj_Model* model)
 Get the child type (only used for models with non-fixed properties). More...

int Gj_model_setVaccessfunc (Gj_Ctx* ctx, Gj_Model* model, Gj_Path* vaccessfunc)
 Set the "virtual child access"-function. More...

int Gj_model_setNativetype (Gj_Ctx* ctx, Gj_Model* model, Gj_Nativetype type)
 Set the native type. More...

Gj_Nativetype Gj_model_getNativetype (Gj_Model* model)
 Get the native type.

Gj_IdGj_model_getViewId (Gj_Ctx* ctx, Gj_Model* model, char* name)
 Get the id of the view given by its name. More...

Gj_ViewGj_model_getView (Gj_Ctx* ctx, Gj_Model* model, Gj_Id* id)
 Get the pointer of the view given by its id. More...

Gj_ViewGj_model_getConverter (Gj_Ctx* ctx, Gj_Model* model, Gj_Id* type)
 Get the pointer of a view able to convert this model to the given type (without parameters). More...

Gj_ViewGj_model_nextView (Gj_Model* model, void** ptr)
 Get the next element of the view walkthrough. More...

void Gj_model_dump (Gj_Ctx* ctx, Gj_Model* model, FILE* s, int* indent)
 Dump a model onto the given stream. More...


Detailed Description

The model object type.


Typedef Documentation

typedef struct gj_Property_struct gj_Property
 

Property structure.

For internal use only.

typedef struct gj_Inheritance_struct gj_Inheritance
 

Inheritance structure.

For internal use only.


Function Documentation

Gj_Model * Gj_model_new ( Gj_Ctx * ctx,
char * name,
Gj_Id * id,
Gj_Model * hardinheritance )
 

Create a new model.

If id is 0, a new id is automatically assigned, else the given id is used. If hardinheritance is given property mode and type (if appropriate), the vaccessfunc and the nativetype are copied from that model.

Returns:
A pointer to the new created model on success, 0 otherwise.

Gj_Model * Gj_model_create ( Gj_Ctx * ctx,
Gj_Stream * stream )
 

Create a model form a given stream.

Returns:
A pointer to the model on success, 0 otherwise.

int Gj_model_write ( Gj_Ctx * ctx,
Gj_Model * model,
Gj_Stream * stream )
 

Write a model to a given stream.

Returns:
0 on success, -1 otherwise.

int Gj_model_delete ( Gj_Ctx * ctx,
Gj_Model * ptr )
 

Delete a model.

Does not unregister it.

Returns:
0 on success, -1 otherwise.

int Gj_model_register ( Gj_Ctx * ctx,
Gj_Model * model )
 

Register a model.

The model is not being registered to any modelmgr (do this via Gj_modelmgr_registerModel()), i.e. only the registered flag is set.

Returns:
0 on success, -1 otherwise.

int Gj_model_finish ( Gj_Ctx * ctx,
Gj_Model * model )
 

Finish a model.

The model cannot be changed anymore and can now be exported.

Returns:
0 on success, -1 otherwise.

Gj_Id * Gj_model_getId ( Gj_Ctx * ctx,
Gj_Model * model )
 

Get the id of the model.

The returned id is STILL OWNED by the model.

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

char * Gj_model_getName ( Gj_Model * model )
 

Get the name of the model.

The returned name is STILL OWNED by the model.

int Gj_model_getPropertyCount ( Gj_Ctx * ctx,
Gj_Model * model )
 

Return the property count (only used for models with fixed properties).

Returns:
The property count on success, -1 otherwise.

int Gj_model_getPropertyNumber ( Gj_Ctx * ctx,
Gj_Model * model,
char * name )
 

Get the number of a property given by its name (only used for models with fixed properties).

Returns:
The property number on success, -1 otherwise.

Gj_Id * Gj_model_getPropertyType ( Gj_Ctx * ctx,
Gj_Model * model,
int index )
 

Get the type of a property given by its index (only used for models with fixed properties).

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

int Gj_model_getPropertyName ( Gj_Ctx * ctx,
Gj_Model * model,
int index,
char ** name )
 

Get the name of a property given by its index.

The name is still OWNED by the model.

Returns:
0 on success, -1 otherwise.

int Gj_model_addProperty ( Gj_Ctx * ctx,
Gj_Model * model,
char * name,
Gj_Id * type,
Gj_Object * std )
 

Add a property (only used for models with fixed properties).

Std is standard value that is assigned on instantiation. If std is 0, no standard value is set. Std is NOT being DUPLICATED.

Returns:
0 on success, -1 otherwise.

int gj_model_fillProperties ( Gj_Ctx * ctx,
Gj_Model * model,
Gj_Object ** list )
 

Fill the given property list with duplicates of the standard values.

Returns:
0 on success, -1 otherwise.

For internal use only.

int Gj_model_addView ( Gj_Ctx * ctx,
Gj_Model * model,
Gj_View * view )
 

Add a view.

This functions may be used after the Gj_model_finish() call. The view structure is NOT duplicated, the model overtakes the OWNERSHIP of the view.

Returns:
0 on success, -1 otherwise.

int Gj_model_deleteViews ( Gj_Ctx * ctx,
Gj_Model * model )
 

Delete all views.

Returns:
0 on success, -1 otherwise.

int Gj_model_isCompatible ( Gj_Ctx * ctx,
Gj_Model * model,
Gj_Id * type,
Gj_Bool * flag )
 

Check if the model is compatible with the given type (that means it is inherited from the type).

Returns:
0 on success, -1 otherwise.

int Gj_model_setChildType ( Gj_Ctx * ctx,
Gj_Model * model,
Gj_Id * type )
 

Set the child type (only used for models with non-fixed properties).

Returns:
0 on success, -1 otherwise.

Gj_Id * Gj_model_getChildType ( Gj_Ctx * ctx,
Gj_Model * model )
 

Get the child type (only used for models with non-fixed properties).

The returned id is STILL OWNED by the model.

Returns:
the pointer to the id on success, 0 otherwise.

int Gj_model_setVaccessfunc ( Gj_Ctx * ctx,
Gj_Model * model,
Gj_Path * vaccessfunc )
 

Set the "virtual child access"-function.

The path structure is NOT DUPLICATED, the model will overtake the OWNERSHIP of the path.

Returns:
0 on success, -1 otherwise.

int Gj_model_setNativetype ( Gj_Ctx * ctx,
Gj_Model * model,
Gj_Nativetype type )
 

Set the native type.

Returns:
0 on success, -1 otherwise.

Gj_Id * Gj_model_getViewId ( Gj_Ctx * ctx,
Gj_Model * model,
char * name )
 

Get the id of the view given by its name.

The returned id is STILL OWNED by the model.

Returns:
the pointer to the id on success, 0 otherwise.

Gj_View * Gj_model_getView ( Gj_Ctx * ctx,
Gj_Model * model,
Gj_Id * id )
 

Get the pointer of the view given by its id.

The returned view is STILL OWNED by the model.

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

Gj_View * Gj_model_getConverter ( Gj_Ctx * ctx,
Gj_Model * model,
Gj_Id * type )
 

Get the pointer of a view able to convert this model to the given type (without parameters).

The returned view is STILL OWNED by the model.

Returns:
the pointer to the view on success, 0 otherwise.

Gj_View * Gj_model_nextView ( Gj_Model * model,
void ** ptr )
 

Get the next element of the view walkthrough.

If *ptr is 0, the first element is returned. The returned view is STILL OWNED by the model. A null pointer is returned if the last element was already reached.

void Gj_model_dump ( Gj_Ctx * ctx,
Gj_Model * model,
FILE * s,
int * indent )
 

Dump a model onto the given stream.

If you call this function yourself *indent should be 0.


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