- Fixed a couple of Hipadaba Issues

- Added properties to Hipadaba Nodes
- Made Morpheus Hipadaba aware and implemented scans
  for Morpheus and Hipadaba


SKIPPED:
	psi/tecs/make_crv
This commit is contained in:
koennecke
2007-01-18 04:58:50 +00:00
parent b79958a864
commit 60c2b58c95
12 changed files with 307 additions and 37 deletions

View File

@@ -39,6 +39,9 @@ static void DeleteNodeData(pHdb node){
DeleteCallbackChain(node->updateCallbacks);
DeleteCallbackChain(node->readCallbacks);
DeleteCallbackChain(node->treeChangeCallbacks);
if(node->properties != NULL){
DeleteStringDict(node->properties);
}
if(node->name != NULL){
free(node->name);
@@ -352,6 +355,7 @@ hdbValue MakeHdbInt(int initValue){
hdbValue result;
result.dataType = HIPINT;
result.arrayLength = 1;
result.v.intValue = initValue;
return result;
}
@@ -360,6 +364,7 @@ hdbValue MakeHdbFloat(double initValue){
hdbValue result;
result.dataType = HIPFLOAT;
result.arrayLength = 1;
result.v.doubleValue = initValue;
return result;
}
@@ -529,6 +534,10 @@ pHdb MakeHipadabaNode(char *name, int datatype, int length){
pNew->magic = HDBMAGICK;
pNew->name = strdup(name);
pNew->value.dataType = datatype;
pNew->properties = CreateStringDict();
if(pNew->properties == NULL || pNew->name == NULL){
return NULL;
}
switch(datatype){
case HIPINTAR:
case HIPINTVARAR:
@@ -1049,3 +1058,35 @@ int GetHdbPar(pHdb node, int dataType, void *data, int length,
}
return 1;
}
/*============================= Property Functions ==========================*/
void SetHdbProperty(pHdb node, char *key, char *value){
if(node != NULL && key != NULL && node->properties != NULL){
if(StringDictExists(node->properties, key)){
StringDictUpdate(node->properties,key,value);
} else {
StringDictAddPair(node->properties,key,value);
}
}
}
/*---------------------------------------------------------------------------*/
int GetHdbProperty(pHdb node, char *key, char *value, int len){
if(node != NULL && node->properties != NULL){
return StringDictGet(node->properties,key,value,len);
} else {
return 0;
}
}
/*---------------------------------------------------------------------------*/
void InitHdbPropertySearch(pHdb node){
if(node != NULL && node->properties != NULL){
StringDictKillScan(node->properties);
}
}
/*--------------------------------------------------------------------------*/
const char *GetNextHdbProperty(pHdb node, char *value ,int len){
if(node != NULL && node->properties != NULL) {
return StringDictGetNext(node->properties, value, len);
} else {
return NULL;
}
}