- replaced locateSICSNode by FindHdbNode

This commit is contained in:
zolliker
2008-02-13 09:58:08 +00:00
parent 5ee27af961
commit 327f595fa6
3 changed files with 259 additions and 140 deletions

View File

@@ -1,4 +1,4 @@
/**
/** @file
* This is a set of helper functions for SICS to work with the hierarchical parameter
* database hipadaba. In SICS, the calldata associated with any callback will always
* be the connection object.
@@ -115,7 +115,7 @@ pHdbCallback MakeMemSetCallback(float *address);
/**
* make a tree chnage callback
* @param pCon The connection to notfy on tree chnages
* @id The ID of this callback
* @param id The ID of this callback
* @return a suitable callback for notififications about tree changes.
*/
pHdbCallback MakeTreeChangeCallback(SConnection *pCon, int id);
@@ -154,7 +154,7 @@ pHdb CreateSICSHdbPar(char *name, int priv, int dataType,
* @param name The name of the parameter
* @param priv The privilege required to change that parameter
* @param sicsObject The object corresponding to this parameter.
* @param dataType The datatype of this variable
* @param datatype The datatype of this variable
* @return A new suitably configured Hdb parameter or NULL when out of memory.
*/
pHdb MakeSICSHdbDriv(char *name, int priv,void *sicsObject, int datatype);
@@ -187,6 +187,9 @@ pHdb MakeSICSScriptPar(char *name, char *setScript, char *readScript, hdbValue v
* make a SICS scriptable parameter. I.e. when this parameter is set or read,
* appropriate scripts are invoked.
* @param name The name of the parameter
* @param setScript
* @param readScript
* @param name The name of the parameter
* @param dataType The datatype for the new parameter.
* @param length The length of any arrays
* @param data Data to initalise the parameter with. Can be NULL, then
@@ -208,6 +211,7 @@ void RemoveSICSPar(pHdb node, void *callData);
/**
* add a new simple hdb parameter as child to node
* @param node The node to add the new node too.
* @param name The name of the new node
* @param priv The privilege required to change that parameter
* @param v The initial value and datatype of this parameter
* @return 1 on success, 0 else
@@ -216,6 +220,7 @@ int AddSICSHdbPar(pHdb node, char *name, int priv, hdbValue v);
/**
* add a new read only hdb parameter as child to node
* @param node The node to add the new node too.
* @param name The name of the new node
* @param v The initial value and datatype of this parameter
* @return 1 on success, 0 else
*/
@@ -226,6 +231,7 @@ int AddSICSHdbROPar(pHdb node, char *name, hdbValue v);
* arrays and fixed sized strings. This does not work for dynamically sized
* arrays or strings.
* @param node The node to add the new node too.
* @param name The name of the new node
* @param priv The privilege required to change that parameter
* @param data The pointer to map this parameter too. This must be in
* dynamically allocated memory.
@@ -237,6 +243,48 @@ int AddSICSHdbROPar(pHdb node, char *name, hdbValue v);
int AddSICSHdbMemPar(pHdb node, char *name, int priv,
void *data, int datalength, int type, int length);
/*============== access support functions =================================*/
/** Find the parent of a node to be created
* @param rootpath the root path (where to start). May be NULL for absolute paths
* @param relpath an absolute or relative path
* @param namePtr (output) a pointer to a name. Will be the last element of
* the path if the parent was found. If namePtr is NULL, the routine does
* the same as FindHdbNode(root, relpath, pCon)
* @param pCon a connection for writing the error messages (may be NULL)
* @return the parent node or NULL on failure
*
* An abolute path starts with a slash, else it is a relative path.
* If the node exists already, an error message is emitted (node exists already)
* and NULL is returned.
*
* Nodes anchored in the sics object list are also found when
* the path starts with "/sics/"
*/
pHdb FindHdbParent(char *rootpath, char *relpath, char **namePtr, SConnection *pCon);
/** FindHdbNode finds a node
* @param rootpath the root path (where to start). May be NULL for absolute paths.
* @param relpath an absolute or relative path
* @param pCon a connection for writing the error messages (may be NULL)
* @return the found node or NULL on failure
*
* An abolute path starts with a slash, else it is a relative path.
* If relpath if a single dot ('.') root is returned.
*
* Nodes anchored in the sics object list are also found when
* the path starts with "/sics/"
*/
pHdb FindHdbNode(char *rootpath, char *relpath, SConnection *pCon);
/** Get the absolute path of a node anchored in the
* Hipadaba root or in a sics object
* @param nodeArg the input node
* @param path the result
* @param pathlen length of the result
* @return 1 on success, 0 on failure
*/
int GetHdbPath(pHdb nodeArg, char *path, size_t pathlen);
/** Remove all Callbacks rooted in the main root _and_ in sics objects
* @param internalID the internalID to be looked for
*/
void RemoveSICSInternalCallback(void *internalID);
/**
* SICSHdbGetPar returns the value of a parameter.
* @param obj The object for which to get a parameter.
@@ -280,14 +328,6 @@ int SICSHdbSetPar(void *obj, SConnection *pCon,
*/
int isSICSHdbRO(pHdb node);
/*============= common SICS Interactions ===================================*/
/**
* locate a SICS Hdb node, thereby honouring the /sics/object/par syntax
* @param pSics, the SICS interpreter
* @param pCon A connection to report errors too
* @param path The path to locate
* @return The demanded node or NULL in case of failure
*/
pHdb locateSICSNode(SicsInterp *pSics, SConnection *pCon, char *path);
/**
* Install a SICS automatic notification callback on the node. This is
* a default callback using the current connection with its current
@@ -317,9 +357,9 @@ int ProcessSICSHdbPar(pHdb root, SConnection *pCon, char *printPrefix,
/**
* print a listing of the parameters of node to pCon, using the
* specified prefix.
* @param The node to print
* @pCon The connection to print too
* @prefix The prefix to use for printing
* @param node The node to print
* @param pCon The connection to print too
* @param prefix The prefix to use for printing
*/
void PrintSICSParList(pHdb node, SConnection *pCon, char *prefix);
/**