fix some spelling and sync with changes to interface.h for RemoveCallback3

r1989 | dcl | 2007-05-25 16:36:47 +1000 (Fri, 25 May 2007) | 2 lines
This commit is contained in:
Douglas Clowes
2007-05-25 16:36:47 +10:00
parent 9438dc0973
commit 1b4bafbeb4

View File

@ -1,8 +1,8 @@
\subsection{Object interfaces}\label{inter} \subsection{Object interfaces}\label{inter}
In order to present themselves to the system SICS objects need to adhere to In order to present themselves to the system SICS objects need to adhere to
certyain interfaces. These interfaces are described in this certain interfaces. These interfaces are described in this
section. Thus this section is one of the most important sections of section. Thus this section is one of the most important sections of
theis document, read carefully! this document, read carefully!
A first A first
requirement was that it must be possible to inquire the capabilities of an requirement was that it must be possible to inquire the capabilities of an
@ -32,7 +32,7 @@ Let's start with the objectdescriptor:
object is capable of at runtime. If this has been done a general object is capable of at runtime. If this has been done a general
way to access those capabilities is needed. In order to do all way to access those capabilities is needed. In order to do all
this each SICS-object is required to carry an object descriptor this each SICS-object is required to carry an object descriptor
struct as first parameter in its class/object struct. Additionslly struct as first parameter in its class/object struct. Additionally
it is required to initialize this struct to something sensible. it is required to initialize this struct to something sensible.
This file defines this struct. Additionally a few functions of This file defines this struct. Additionally a few functions of
@ -40,7 +40,7 @@ Let's start with the objectdescriptor:
Mark Koennecke, June, 1997 Mark Koennecke, June, 1997
copyrigth: see implementation file copyright: see implementation file
----------------------------------------------------------------------------*/ ----------------------------------------------------------------------------*/
#ifndef SICSDESCRIPTOR #ifndef SICSDESCRIPTOR
#define SICSDESCRIPTOR #define SICSDESCRIPTOR
@ -102,17 +102,17 @@ It is {\bf important} to note, that the objects themselves are responsible
for allocating and freeing memory for the interface structures. Client never for allocating and freeing memory for the interface structures. Client never
should need to worry how to dispose of these structures. Moreover this should need to worry how to dispose of these structures. Moreover this
scheme ensures that changes to the interface due to some command given to scheme ensures that changes to the interface due to some command given to
the object are immediatetly visible through the whole system. the object are immediately visible through the whole system.
Additionally this header file defines a few relatively uninteresting Additionally this header file defines a few relatively uninteresting
functions for object descriptor maintainance. Slightly more interesting is functions for object descriptor maintenance. Slightly more interesting is
the Dummy structure, which will be used to find the object descriptor in a the Dummy structure, which will be used to find the object descriptor in a
given objects data structure. given objects data structure.
\subsubsection{The drivable interface} \subsubsection{The drivable interface}
As first example of an interface the drivable interface will be given. This As first example of an interface the drivable interface will be given. This
interface is implemented by all devices or varaibles which can be driven to interface is implemented by all devices or variables which can be driven to
a value. Most notable example are motors, but composite variables and a value. Most notable example are motors, but composite variables and
environment controllers fit this bill as well. environment controllers fit this bill as well.
@ -224,11 +224,11 @@ returned. NEVER free this pointer. If no countable interface exists, NULL
will be returned. will be returned.
\subsubsection{The Callback Interface} \subsubsection{The Callback Interface}
The Callback Interface is SICS suport for component behaviour for objects. The Callback Interface is SICS support for component behaviour for objects.
Consider objects A and B. A now is able to generate certain events when it's Consider objects A and B. A now is able to generate certain events when it's
state changes. For instance if A is a variable that its value is changed. state changes. For instance if A is a variable that its value is changed.
B may then choose to register a function with A which gets automatically B may then choose to register a function with A which gets automatically
called whenever A generates the apropriate event. B is thus automatically called whenever A generates the appropriate event. B is thus automatically
notified about A's status change and can act accordingly to it. In contrast notified about A's status change and can act accordingly to it. In contrast
to the interfaces defined above, this interface is defined in terms of a set to the interfaces defined above, this interface is defined in terms of a set
of functions which manipulate the interface and not as a data structure of of functions which manipulate the interface and not as a data structure of
@ -243,7 +243,7 @@ function:
@} @}
The callback function is meant to return 0 for failure or 1 for success. The callback function is meant to return 0 for failure or 1 for success.
This infomation may be needed by an event invoking object if to continue an This information may be needed by an event invoking object if to continue an
operation or not. The first parameter passed to {\bf SICSCallBack} is the id of operation or not. The first parameter passed to {\bf SICSCallBack} is the id of
the generated event. Clearly the communicating objects need to agree on the generated event. Clearly the communicating objects need to agree on
these event. In SICS events types will be held in an header file event.h. these event. In SICS events types will be held in an header file event.h.
@ -272,6 +272,8 @@ interface:
void *pUserData, KillFuncIT pKill); void *pUserData, KillFuncIT pKill);
int RemoveCallback(pICallBack pInterface, long iID); int RemoveCallback(pICallBack pInterface, long iID);
int RemoveCallback2(pICallBack pInterface, void *pUserData); int RemoveCallback2(pICallBack pInterface, void *pUserData);
int RemoveCallback3(pICallBack self, SICSCallBack pFunc,
int (*func)(const void* context, const void* pUserData), void *context);
int CallbackScript(SConnection *pCon, SicsInterp *pSics, void *pData, int CallbackScript(SConnection *pCon, SicsInterp *pSics, void *pData,
int argc, char *argv[]); int argc, char *argv[]);
@ -317,6 +319,13 @@ RegisterCallBack.
search key for deletion is the pointer to user data. All callbacks related search key for deletion is the pointer to user data. All callbacks related
to this user data in the interface specified will be removed. to this user data in the interface specified will be removed.
{\bf RemoveCallback3} is another variant for removing callbacks. This time the
search key for deletion is the pointer to user data, qualified by the callback
function and checked by the spuplied check function. If the callback function
matches the one given then the supplied function is called to determine if the
user data matches and return zero if it does. All callbacks related to this
user data in the interface specified will be removed.
{\bf CallbackScript} allows to connect callbacks to scripts. Please {\bf CallbackScript} allows to connect callbacks to scripts. Please
note, that those scripts will have a dummy connection to clients only note, that those scripts will have a dummy connection to clients only
and will not be able to write to clients. All output occurring in and will not be able to write to clients. All output occurring in
@ -351,7 +360,7 @@ controller. EVError is set if the controller is out of tolerances.
0 otherwise. 0 otherwise.
{\bf HandleError} will be automatically called when IsInTolerance returns 0. {\bf HandleError} will be automatically called when IsInTolerance returns 0.
Its purpose is to implemnt the error handling startegy for the controller Its purpose is to implement the error handling strategy for the controller
in question. in question.
@ -388,7 +397,7 @@ The environment interface has just one function associated with it:
For more documentation see interface.w, interface.tex For more documentation see interface.w, interface.tex
copyright: see SICS impelementation files copyright: see SICS implementation files
---------------------------------------------------------------------------*/ ---------------------------------------------------------------------------*/
#ifndef SICSINTERFACES #ifndef SICSINTERFACES