Commit d97cfadb authored by Florian Prill's avatar Florian Prill
Browse files

[cdi-tiles] implemented auxiliary routine which simply checks if resource...

[cdi-tiles] implemented auxiliary routine which simply checks if resource handle exists (without error message).
parent 4411e0c3
...@@ -423,12 +423,36 @@ reshGetElem(const char *caller, const char* expressionString, cdiResH resH, cons ...@@ -423,12 +423,36 @@ reshGetElem(const char *caller, const char* expressionString, cdiResH resH, cons
return listElem; return listElem;
} }
void *reshGetValue(const char * caller, const char* expressionString, cdiResH resH, const resOps * ops) void *reshGetValue(const char * caller, const char* expressionString, cdiResH resH, const resOps * ops)
{ {
return reshGetElem(caller, expressionString, resH, ops)->res.v.val; return reshGetElem(caller, expressionString, resH, ops)->res.v.val;
} }
int
reshEntryExists(const char * caller, const char* expressionString, cdiResH resH, const resOps * ops)
{
int nsp;
namespaceTuple_t nspT;
listElem_t *listElem;
xassert ( ops );
LIST_INIT(1);
LIST_LOCK();
nsp = namespaceGetActive ();
nspT = namespaceResHDecode ( resH );
LIST_UNLOCK();
int found = 0;
if (nspT.nsp == nsp &&
nspT.idx < resHList[nsp].size)
listElem = resHList[nsp].resources + nspT.idx;
LIST_UNLOCK();
if ( listElem && (listElem->res.v.ops == ops) ) found = 1;
return found;
}
/**************************************************************/ /**************************************************************/
void reshGetResHListOfType(unsigned numIDs, int resHs[numIDs], const resOps *ops) void reshGetResHListOfType(unsigned numIDs, int resHs[numIDs], const resOps *ops)
......
...@@ -62,6 +62,9 @@ unsigned reshCountType(const resOps *resTypeOps); ...@@ -62,6 +62,9 @@ unsigned reshCountType(const resOps *resTypeOps);
void * reshGetValue(const char* caller, const char* expressionString, cdiResH id, const resOps* ops); void * reshGetValue(const char* caller, const char* expressionString, cdiResH id, const resOps* ops);
#define reshGetVal(resH, ops) reshGetValue(__func__, #resH, resH, ops) #define reshGetVal(resH, ops) reshGetValue(__func__, #resH, resH, ops)
int reshEntryExists(const char* caller, const char* expressionString, cdiResH id, const resOps* ops);
#define reshExists(resH, ops) reshEntryExists(__func__, #resH, resH, ops)
void reshGetResHListOfType(unsigned numIDs, int IDs[numIDs], const resOps *ops); void reshGetResHListOfType(unsigned numIDs, int IDs[numIDs], const resOps *ops);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment