Main Page | Data Structures | File List | Data Fields | Globals | Related Pages

kobjects.h File Reference

Declaration of the "defines" for implementation of iKlax structures. More...


Defines

#define IKX_DECLARE_OBJECT_BEGIN(obj)   typedef struct {
 Beginning of an object declaration.
#define IKX_DECLARE_OBJECT_FIELD(type, field)   type field;
 Object attribute declaration.
#define IKX_DECLARE_OBJECT_END(obj)
 End of an object declaration.
#define IKX_DECLARE_HIDED_OBJECT(obj)
 Declaration of an hidden object.
#define IKX_IMPLEMENT_HIDED_OBJECT_BEGIN(obj)   struct _##obj {
 Beginning of an hidden object declaration.
#define IKX_IMPLEMENT_OBJECT_NEW(obj)
 Implementation of the new function.
#define IKX_IMPLEMENT_OBJECT_INIT_BEGIN(obj)   void obj##_init (obj* object) {
 Beginning of the implementation of the init function.
#define IKX_IMPLEMENT_OBJECT_INIT(field, value)   object->field = value;
 Implementation of the init function.
#define IKX_IMPLEMENT_OBJECT_INIT_KOBJECT(field, type)   object->field = type##_new ();
 Implementation of the init function for the object type KOBJECT.
#define IKX_IMPLEMENT_OBJECT_INIT_END   };
 End of the implementation of the init function.
#define IKX_IMPLEMENT_OBJECT_BEGIN(obj)   IKX_IMPLEMENT_OBJECT_NEW(obj)
 General implementation of an object.
#define IKX_IMPLEMENT_OBJECT_DELETE_BEGIN(obj)
 Implementation of the delete function.
#define IKX_IMPLEMENT_OBJECT_DELETE_END
 End of the general implementation of an object.
#define IKX_IMPLEMENT_OBJECT_END   IKX_IMPLEMENT_OBJECT_DELETE_END
 End of the general implementation of an object.
#define IKX_IMPLEMENT_OBJECT_INIT_STRING_HT(field)   object->field = g_hash_table_new(g_str_hash,g_str_equal);
 Creation of an hash table for an object attribute.
#define IKX_IMPLEMENT_OBJECT_INIT_STRING_DELHT(field, fDeleteKey, fDeleteValue)   object->field=g_hash_table_new_full(g_str_hash, g_str_equal, fDeleteKey, fDeleteValue);
 Destruction of an hash table for an object attribute.
#define IKX_IMPLEMENT_OBJECT_DELETE_KOBJECT(field, type)
 Destruction of an object attribute.
#define IKX_IMPLEMENT_OBJECT_DELETE_MALLOC(field)
 Free memory of an object attribute.
#define IKX_IMPLEMENT_OBJECT_DELETE_KLIST(field)
 Deletes an object attribute of KLIST type.
#define IKX_IMPLEMENT_OBJECT_DELETE_GHASHTABLE(field)
 Deletes an object attribute of GHASHTABLE type.
#define KOBJECT_DECLARES_STRUCT(kobject)
 Declaration of a structure.
#define KOBJECT_DECLARES_FUNTION(kobject)
 Declaration of the main functions of an object.
#define KOBJECT_DECLARATION(kobject)
 Declaration of both the structure the main functions of an object.
#define KOBJECT_DECLARES_FUNTION_DYNLIB(kobject, macro_api)
 Declaration of the main functions of an object.
#define KOBJECT_DECLARATION_DYNLIB(kobject, macro_api)
 Declaration of both the structure the main functions of an object.
#define KOBJECT_IMLEMENTATION(kobject)
 Implementation of the main functions for KOBJECT.


Detailed Description

Declaration of the "defines" for implementation of iKlax structures.

Macros to use

Version:
KToolLib-1.0
Author:
Fabien Gallot
Date:
22/01/2008
Note:
Copyright © 2008-2010 iKlax Media SAS (www.iklaxmedia.com). All rights reserved.

Define Documentation

#define IKX_DECLARE_HIDED_OBJECT obj   ) 
 

Value:

struct _##obj; \ typedef struct _##obj obj; \ obj* obj##_new (); \ void obj##_delete (obj** object); \ void obj##_init (obj* object);
Declaration of an hidden object.

Parameters:
obj the object to be declared

#define IKX_DECLARE_OBJECT_BEGIN obj   )     typedef struct {
 

Beginning of an object declaration.

Parameters:
obj the object to be declared

#define IKX_DECLARE_OBJECT_END obj   ) 
 

Value:

} obj; \ obj* obj##_new (); \ void obj##_delete (obj** object); \ void obj##_init (obj* object);
End of an object declaration.

Parameters:
obj the object to be declared

#define IKX_DECLARE_OBJECT_FIELD type,
field   )     type field;
 

Object attribute declaration.

Parameters:
type the type of the attribute to be declared
field the name of the attribute to be declared

#define IKX_IMPLEMENT_HIDED_OBJECT_BEGIN obj   )     struct _##obj {
 

Beginning of an hidden object declaration.

Parameters:
obj the object to be declared

#define IKX_IMPLEMENT_OBJECT_BEGIN obj   )     IKX_IMPLEMENT_OBJECT_NEW(obj)
 

General implementation of an object.

Implementation of the new function. End of the implementation of the init function

Parameters:
obj the object to be declared

#define IKX_IMPLEMENT_OBJECT_DELETE_BEGIN obj   ) 
 

Value:

IKX_IMPLEMENT_OBJECT_INIT_END \ void obj##_delete (obj** object) { \ if (*object == knull) \ return;
Implementation of the delete function.

Parameters:
obj the object to be declared

#define IKX_IMPLEMENT_OBJECT_DELETE_GHASHTABLE field   ) 
 

Value:

if ((*object)->field) { \ g_hash_table_remove_all ((*object)->field); \ g_hash_table_destroy ((*object)->field); \ (*object)->field = knull; \ }
Deletes an object attribute of GHASHTABLE type.

Parameters:
field the attribute name

#define IKX_IMPLEMENT_OBJECT_DELETE_KLIST field   ) 
 

Value:

if ((*object)->field) \ g_slist_free ((*object)->field);
Deletes an object attribute of KLIST type.

Parameters:
field the attribute name

#define IKX_IMPLEMENT_OBJECT_DELETE_KOBJECT field,
type   ) 
 

Value:

if ((*object)->field) \ type##_delete (&(*object)->field);
Destruction of an object attribute.

Parameters:
field the attribute name
type the attribute type

#define IKX_IMPLEMENT_OBJECT_DELETE_MALLOC field   ) 
 

Value:

if ((*object)->field) \ k_free ((*object)->field);
Free memory of an object attribute.

Parameters:
field the attribute name

#define IKX_IMPLEMENT_OBJECT_INIT field,
value   )     object->field = value;
 

Implementation of the init function.

Parameters:
field the name of the attribute to be initialized
value the value of the attribute

#define IKX_IMPLEMENT_OBJECT_INIT_BEGIN obj   )     void obj##_init (obj* object) {
 

Beginning of the implementation of the init function.

Parameters:
obj the object to be declared

#define IKX_IMPLEMENT_OBJECT_INIT_KOBJECT field,
type   )     object->field = type##_new ();
 

Implementation of the init function for the object type KOBJECT.

Parameters:
field the name of the attribute to be initialized
type the type of the attribute

#define IKX_IMPLEMENT_OBJECT_INIT_STRING_DELHT field,
fDeleteKey,
fDeleteValue   )     object->field=g_hash_table_new_full(g_str_hash, g_str_equal, fDeleteKey, fDeleteValue);
 

Destruction of an hash table for an object attribute.

Parameters:
field the attribute name
fDeleteKey the key to be deleted
fDeleteValue the value to be deleted

#define IKX_IMPLEMENT_OBJECT_INIT_STRING_HT field   )     object->field = g_hash_table_new(g_str_hash,g_str_equal);
 

Creation of an hash table for an object attribute.

Parameters:
field the attribute name

#define IKX_IMPLEMENT_OBJECT_NEW obj   ) 
 

Value:

obj* obj##_new () { \ obj* object = k_malloc (sizeof (obj)); \ if (knull == object) return k_error_null; \ obj##_init (object); \ return object; \ }
Implementation of the new function.

Parameters:
obj the object to be declared

#define KOBJECT_DECLARATION kobject   ) 
 

Value:

Declaration of both the structure the main functions of an object.

Parameters:
kobject the object to be declared

#define KOBJECT_DECLARATION_DYNLIB kobject,
macro_api   ) 
 

Value:

KOBJECT_DECLARES_STRUCT ( kobject ) \ KOBJECT_DECLARES_FUNTION_DYNLIB ( kobject , macro_api )
Declaration of both the structure the main functions of an object.

This macro concerns the dynamic library

Parameters:
kobject the object to be declared
macro_api API macro used

#define KOBJECT_DECLARES_FUNTION kobject   ) 
 

Value:

kobject * kobject##_new (); \ void kobject##_init ( kobject * ); \ void kobject##_delete ( kobject ** ); \ kobject * kobject##_copy ( const kobject * src , kobject * dst ); \ kobject * kobject##_clone ( kobject * src );
Declaration of the main functions of an object.

Parameters:
kobject the object to be declared

#define KOBJECT_DECLARES_FUNTION_DYNLIB kobject,
macro_api   ) 
 

Value:

macro_api kobject * kobject##_new (); \ macro_api void kobject##_init ( kobject * ); \ macro_api void kobject##_delete ( kobject ** ); \ macro_api kobject * kobject##_copy ( kobject * src , kobject * dst ); \ macro_api kobject * kobject##_clone ( kobject * src );
Declaration of the main functions of an object.

This macro concerns the dynamic library

Parameters:
kobject the object to be declared
macro_api macro de l'api

#define KOBJECT_DECLARES_STRUCT kobject   ) 
 

Value:

struct _##kobject; \ typedef struct _##kobject kobject ;
Declaration of a structure.

Parameters:
kobject the object to be declared

#define KOBJECT_IMLEMENTATION kobject   ) 
 

Value:

kobject * kobject##_new () { \ kobject * obj = k_malloc (sizeof ( kobject )); \ if (knull == obj) \ return k_error_null; \ kobject##_init (obj); \ return obj; \ } \ kobject* kobject##_clone ( kobject * src ) { \ kobject * obj = kobject##_new (); \ if (knull == obj) \ return k_error_null; \ obj = kobject##_copy (src, obj); \ return obj; \ }
Implementation of the main functions for KOBJECT.

Parameters:
kobject the object to be declared


Generated on Tue Mar 9 10:49:30 2010 for iKlax Tools Library (KToolLib) by doxygen 1.3.8