golib
0.5
|
Base class for golib objects. More...
#include <goobjectbase.h>
Public Member Functions | |
goObjectBase () | |
Constructor. | |
virtual | ~goObjectBase () |
Destructor. More... | |
const char * | getClassName () const |
Returns the class name. More... | |
int | getClassID () const |
virtual goSize_t | memoryUsage () const |
Returns the size of this object or some measure of its memory consumption. More... | |
void | setObjectName (const char *name) |
Set name string for an object. More... | |
void | setObjectName (const goString &name) |
Set name string for an object. More... | |
const goString & | getObjectName () const |
Get the object name. More... | |
virtual bool | writeObjectFile (FILE *) const |
Write object to a file. More... | |
virtual bool | readObjectFile (FILE *) |
Read object from a file. More... | |
void | connectObject (goObjectBase *object) |
Connects an object to this object. More... | |
void | disconnectObject (const goObjectBase *object) |
Disconnects an object from this object. | |
virtual bool | callObjectMethod (int methodID, goObjectMethodParameters *param=NULL) |
Call an object method by identifier. More... | |
virtual bool | queueObjectMethod (int methodID, goObjectMethodParameters *param=NULL, bool blocking=false) |
Enqueue a method call to an internal list of methods. More... | |
bool | callQueuedMethods () |
Call all queued methods. More... | |
Protected Member Functions | |
void | setClassID (int id) |
Sets the class name. | |
void | printClassMessage (const char *msg) |
Sets the class name. More... | |
void | printClassMessage (goString &msg) |
Prints an informational message to the calling console. More... | |
void | sendObjectMessage (int messageID, void *data=NULL) |
Sends a message to all connected objects. | |
void | sendObjectMessage (goObjectBase *object, int messageID, void *data=NULL) |
Sends a message to a specific object. | |
virtual void | receiveObjectMessage (const goObjectMessage &message) |
Receive a message. More... | |
Base class for golib objects.
This is a base for all objects that we felt needed a common base. It implements class names, class message printing, and inter-object communication.
|
virtual |
Destructor.
The destructor sends a GO_OBJECTMESSAGE_DESTRUCTING message to all connected objects.
|
virtual |
Call an object method by identifier.
See the file goobjectmessage.h for messages and add messages there if needed. External applications building on this class should use identifiers starting with GO_OBJECTMETHOD_USER.
methodID | ID of the method. See goobjectmethod.h |
param | Pointer to parameters for the method, if any. |
Reimplemented in goMatlab, goPointCloud< T >, and goCurve< T >.
bool goObjectBase::callQueuedMethods | ( | ) |
Call all queued methods.
Calls all methods queued with queueObjectMethod().
void goObjectBase::connectObject | ( | goObjectBase * | object | ) |
Connects an object to this object.
Connected objects will receive messages sent by this object. So when you say
object1.connectObject (anotherobject)
then anotherobject will receive messages from object1.
const char * goObjectBase::getClassName | ( | ) | const |
Returns the class name.
const goString & goObjectBase::getObjectName | ( | ) | const |
|
virtual |
Returns the size of this object or some measure of its memory consumption.
Overload this function as you please and as it makes sense.
Reimplemented in goSignal2D< T >, goSignal3DBase< T >, goSignal2D< goFloat >, goSignal3DBase< void >, goSignal3D< T >, and goSignal3D< void >.
|
protected |
Sets the class name.
Prints an informational message to the calling console.
Prints messages of the form "<classname> message: <your message>".
|
protected |
Prints an informational message to the calling console.
Prints messages of the form "<classname> message: <your message>".
|
virtual |
Enqueue a method call to an internal list of methods.
The queued methods can be called in one go by a call to callQueuedMethods().
methodID | ID of the method. See goobjectmethod.h |
param | Pointer to a parameter structure, if any. The parameters will be deep-copied, so there is no need to worry about keeping them after the method returned. |
|
virtual |
Read object from a file.
Reimplement this in sub-classes.
f | Valid C file pointer. |
Reimplemented in goCurve< T >, and goPointCloud< T >.
|
protectedvirtual |
Receive a message.
This function gets called each time another object "sends" a message to this object. Reimplement this in order to allow derived classes to react to messages.
Reimplemented in goPointCloud< T >, and goCurve< T >.
void goObjectBase::setObjectName | ( | const char * | name | ) |
Set name string for an object.
name | Name of the object. |
void goObjectBase::setObjectName | ( | const goString & | name | ) |
Set name string for an object.
name | Name of the object. |
|
virtual |
Write object to a file.
Reimplement this in sub-classes.
f | Valid C file pointer. |
Reimplemented in goCurve< T >, and goPointCloud< T >.