version 1.1.2.9, 2007/10/04 22:25:54
|
version 1.1.2.10, 2007/10/22 22:17:30
|
|
|
# include <Pegasus/Common/ArrayImpl.h> | # include <Pegasus/Common/ArrayImpl.h> |
#undef PEGASUS_ARRAY_T | #undef PEGASUS_ARRAY_T |
| |
static const size_t _MAX_NAMESPACES = 32; |
// |
static const MetaNameSpace* _nameSpaces[_MAX_NAMESPACES]; |
// Callback function and client data used to obtain namespaces from client. |
static size_t _nameSpacesSize = 0; |
// |
|
static const MetaNameSpace* const* _nameSpaces; |
| |
static const size_t _MAX_FEATURES = 1024; | static const size_t _MAX_FEATURES = 1024; |
static const size_t _MAX_QUALIFIERS = 1024; | static const size_t _MAX_QUALIFIERS = 1024; |
|
|
| |
static const MetaNameSpace* _findNameSpace(const char* name) | static const MetaNameSpace* _findNameSpace(const char* name) |
{ | { |
for (size_t i = 0; i < _nameSpacesSize; i++) |
if (!_nameSpaces) |
|
return 0; |
|
|
|
for (const MetaNameSpace* const* p = _nameSpaces; *p; p++) |
{ | { |
if (_eqi(_nameSpaces[i]->name, name)) |
const MetaNameSpace* ns = *p; |
return _nameSpaces[i]; |
|
|
if (_eqi(ns->name, name)) |
|
return ns; |
} | } |
| |
// Not found! | // Not found! |
|
|
{ | { |
} | } |
| |
bool MetaRepository::addNameSpace(const MetaNameSpace* nameSpace) |
|
{ |
|
if (_nameSpacesSize == _MAX_NAMESPACES || !nameSpace) |
|
return false; |
|
|
|
for (size_t i = 0; i < _nameSpacesSize; i++) |
|
{ |
|
if (_eqi(_nameSpaces[i]->name, nameSpace->name)) |
|
return false; |
|
} |
|
|
|
_nameSpaces[_nameSpacesSize++] = nameSpace; |
|
return true; |
|
} |
|
|
|
CIMClass MetaRepository::getClass( | CIMClass MetaRepository::getClass( |
const CIMNamespaceName& nameSpace, | const CIMNamespaceName& nameSpace, |
const CIMName& className, | const CIMName& className, |
|
|
| |
Array<CIMNamespaceName> MetaRepository::enumerateNameSpaces() | Array<CIMNamespaceName> MetaRepository::enumerateNameSpaces() |
{ | { |
Array<CIMNamespaceName> nameSpaces; |
Array<CIMNamespaceName> result; |
|
|
for (size_t i = 0; i < _nameSpacesSize; i++) |
|
nameSpaces.append(_nameSpaces[i]->name); |
|
| |
|
if (!_nameSpaces) |
return Array<CIMNamespaceName>(); | return Array<CIMNamespaceName>(); |
|
|
|
for (const MetaNameSpace* const* p = _nameSpaces; *p; p++) |
|
{ |
|
const MetaNameSpace* ns = *p; |
|
result.append(ns->name); |
|
} |
|
|
|
return result; |
} | } |
| |
void MetaRepository::deleteNameSpace( | void MetaRepository::deleteNameSpace( |
|
|
return FindClass(ns, className); | return FindClass(ns, className); |
} | } |
| |
|
void MetaRepository::installNameSpaces(const MetaNameSpace* const* nameSpaces) |
|
{ |
|
_nameSpaces = nameSpaces; |
|
} |
|
|
PEGASUS_NAMESPACE_END | PEGASUS_NAMESPACE_END |