FTS object
[FTS Basic Data Structures]


Detailed Description

The FTS object


Typedefs

typedef void(* fts_object_listener_callback_t )(fts_object_t *o, void *l, fts_symbol_t s, int ac, const fts_atom_t *at)
 FTS object listener callback function data type.
typedef struct fts_context fts_context_t
 FTS object context base type.
typedef struct fts_object_listener fts_object_listener_t
 FTS object listener type.
typedef struct fts_object fts_object_t
 FTS object data type.
typedef struct fts_safeobject fts_safeobject_t
 FTS (thread-safe) shared object data type.

Functions

FTS_API fts_object_tfts_object_create (fts_class_t *cl, int ac, const fts_atom_t *at)
 Create an instance of the given class.
FTS_API void fts_object_destroy (fts_object_t *o)
 Destroy object.
void fts_object_refer (fts_object_t *o)
 Add a reference to an object (increment reference count).
void fts_object_release (fts_object_t *o)
 Remove a reference from an object (decrement reference count).
FTS_API void fts_object_set_persistence (fts_object_t *o, int persistence)
 Set the name of an object.
FTS_API fts_class_tfts_object_get_class (fts_object_t *o)
 Get the class of an object.
FTS_API fts_symbol_t fts_object_get_class_name (fts_object_t *o)
 Get the class name of an object.
FTS_API int fts_object_is_a (fts_object_t *o, fts_class_t *c)
 Check whether an object is an instance of a given class.
FTS_API fts_context_tfts_object_get_context (fts_object_t *o)
 Get the context of an object.
FTS_API void fts_object_set_context (fts_object_t *o, fts_context_t *c)
 Set the context of an object.
FTS_API fts_object_tfts_object_get_container (fts_object_t *o)
 Get the container of an object.
FTS_API fts_symbol_t fts_object_get_name (fts_object_t *o)
 Get the name of an object (if available in the given context).
FTS_API void fts_object_add_listener (fts_object_t *o, void *listener, fts_object_listener_callback_t callback)
 Add a listener to an object.
FTS_API void fts_object_remove_listener (fts_object_t *o, void *listener)
 Remove a listener from an object.
FTS_API void fts_object_call_listeners (fts_object_t *o, fts_symbol_t s, int ac, const fts_atom_t *at)
 Call the listeners of an object.
FTS_API void fts_object_changed (fts_object_t *o)
 Notify listeners that an object has changed.
FTS_API fts_method_t fts_send_message (fts_object_t *o, fts_symbol_t s, int ac, const fts_atom_t *at, fts_atom_t *ret)
 Send an arbitrary message to an object (invoke method).
FTS_API void fts_method_invoke (fts_method_t method, fts_object_t *o, int ac, const fts_atom_t *at, fts_atom_t *ret)
 Invoke a method.
FTS_API fts_status_t fts_method_call (fts_object_t *o, fts_symbol_t selector, int ac, const fts_atom_t *at, fts_atom_t *ret)
 Invoke a method (by name) of a given object.


Typedef Documentation

typedef void(* fts_object_listener_callback_t)(fts_object_t *o, void *l, fts_symbol_t s, int ac, const fts_atom_t *at)

FTS object listener callback function data type.

Parameters:
o the object
l the listener
s selector
ac args count
at arguments


Function Documentation

FTS_API fts_status_t fts_method_call ( fts_object_t o,
fts_symbol_t  selector,
int  ac,
const fts_atom_t *  at,
fts_atom_t *  ret 
)

Invoke a method (by name) of a given object.

Parameters:
o the target object
selector the selector
ac argument count
at argument values
ret pointer to return value

FTS_API void fts_method_invoke ( fts_method_t  method,
fts_object_t o,
int  ac,
const fts_atom_t *  at,
fts_atom_t *  ret 
)

Invoke a method.

Parameters:
method the method
o the target object
ac argument count
at argument values
ret pointer to return value

FTS_API void fts_object_add_listener ( fts_object_t o,
void *  listener,
fts_object_listener_callback_t  callback 
)

Add a listener to an object.

Parameters:
o the object
listener the object listener
callback the fts_object_listener_callaback

FTS_API void fts_object_call_listeners ( fts_object_t o,
fts_symbol_t  s,
int  ac,
const fts_atom_t *  at 
)

Call the listeners of an object.

Parameters:
o the object
s selector
ac arguments count
at arguments

FTS_API void fts_object_changed ( fts_object_t o  ) 

Notify listeners that an object has changed.

Parameters:
o the object

FTS_API fts_object_t* fts_object_create ( fts_class_t cl,
int  ac,
const fts_atom_t *  at 
)

Create an instance of the given class.

Parameters:
cl the class to instantiate
ac argument count
at the arguments
Returns:
the created object, NULL if instantiation failed
A new instance of the class is created and initialized. If parent is not NULL, the created instance will be added as child to the parent object.

Make sure that the object has a reference (e.g. by fts_object_refer) before calling any other function.

FTS_API void fts_object_destroy ( fts_object_t o  ) 

Destroy object.

This function is called by fts_object_release() when the last object reference is removed. It shouldn't ever be called directly.

Parameters:
o the object

FTS_API fts_class_t* fts_object_get_class ( fts_object_t o  ) 

Get the class of an object.

Parameters:
o the object
Returns:
object class

FTS_API fts_symbol_t fts_object_get_class_name ( fts_object_t o  ) 

Get the class name of an object.

Parameters:
o the object
Returns:
object class name

FTS_API fts_object_t* fts_object_get_container ( fts_object_t o  ) 

Get the container of an object.

Parameters:
o the object
Returns:
object container

FTS_API fts_context_t* fts_object_get_context ( fts_object_t o  ) 

Get the context of an object.

Parameters:
o the object
Returns:
object context

FTS_API fts_symbol_t fts_object_get_name ( fts_object_t o  ) 

Get the name of an object (if available in the given context).

Parameters:
o the object
Returns:
object name

FTS_API int fts_object_is_a ( fts_object_t o,
fts_class_t c 
)

Check whether an object is an instance of a given class.

Parameters:
o the object
c the class
Returns:
1 if true, 0 if false

void fts_object_refer ( fts_object_t o  ) 

Add a reference to an object (increment reference count).

Parameters:
o the object

void fts_object_release ( fts_object_t o  ) 

Remove a reference from an object (decrement reference count).

Parameters:
o the object
if reference count become negative the object is destroyed ...

FTS_API void fts_object_remove_listener ( fts_object_t o,
void *  listener 
)

Remove a listener from an object.

Parameters:
o the object
listener the listener

FTS_API void fts_object_set_context ( fts_object_t o,
fts_context_t c 
)

Set the context of an object.

Parameters:
o the object
c the context

FTS_API void fts_object_set_persistence ( fts_object_t o,
int  persistence 
)

Set the name of an object.

Parameters:
o the object
persistence 

FTS_API fts_method_t fts_send_message ( fts_object_t o,
fts_symbol_t  s,
int  ac,
const fts_atom_t *  at,
fts_atom_t *  ret 
)

Send an arbitrary message to an object (invoke method).

Parameters:
o the target object
s the message symbol
ac argument count
at argument values
ret pointer to return value
Returns:
non-zero if succeeded, NULL if no method found for given arguments


Generated on Wed Aug 24 18:28:43 2011 for FTM API by  doxygen 1.5.6