Cleaned up some more docs.
- TO-DO List
- ==========
+Topical To-Do List
+==================
- Instances:
- Run CIM/XML test suite.
+- Server
+
+ - Use Service class in cimserver
+
+ - Implement Service class on Unix (daemonization from Comer book).
+.PHONY: docxx
+
+DOC_ROOT = $(ROOT)/doc/reference
+DOC_DIR = $(DOC_ROOT)/$(DIR)
+
docxx:
- docxx -d ./doc -H *.h
+ $(MKDIRHIER) $(DOC_DIR)
+ docxx -d $(DOC_DIR) -H *.h
return _rep->findQualifier(name);
}
- /** CIMMethod FindQualifier - ATTN:
- @param name of the qualifier to be found
- @return ATTN: Define this
- */
Uint32 findQualifier(const String& name) const
{
_checkRep();
return _rep->findProperty(name);
}
- /// CIMMethod findProperty
Uint32 findProperty(const String& name) const
{
_checkRep();
return _rep->findMethod(name);
}
- /// CIMMethod findMethod - ATTN:
Uint32 findMethod(const String& name) const
{
_checkRep();
return _rep->findQualifier(name);
}
- /** findQualifier - Searches the instance for the qualifier object
- defined by the input parameter.
- @param String defining the qualifier to be found
- @return - Index of the qualifier to be used in subsequent
- operations or -1 if the qualifier is not found.
- */
Uint32 findQualifier(const String& name) const
{
_checkRep();
return _rep->findProperty(name);
}
- /** findProperty - Searches the property objects installed in the
- CIMInstance for property objects with the name defined by the
- input
- @param String with the name of the property object to be found
- @return Index in the CIM Instance to the property object if found or
- -1 if no property object found with the name defined by the input.
- */
Uint32 findProperty(const String& name) const
{
_checkRep();
//
//%/////////////////////////////////////////////////////////////////////////////
-/*
- CIMMethod.h - This header file defines the method class.
-*/
-
#ifndef Pegasus_Method_h
#define Pegasus_Method_h
PEGASUS_NAMESPACE_BEGIN
-
class CIMConstMethod;
/** Class CIMMethod - This class defines the operations associated with
-manipulation of the Pegasus implementation of the CIM CIMMethod. Within this
-class, methods are provides for creation, deletion, and manipulation of method
-declarations.
+ manipulation of the Pegasus implementation of the CIM CIMMethod. Within
+ this class, methods are provides for creation, deletion, and manipulation
+ of method declarations.
+ // ATTN: remove the classOrigin and propagated parameters.
*/
-
class PEGASUS_COMMON_LINKAGE CIMMethod
{
public:
- /// Creates and instantiates a CIM method.
+
+ /** Creates and instantiates a CIM method. */
CIMMethod() : _rep(0)
{
}
+
/** Creates and instantiates a CIM method from another method instance
- @return pointer to the new method instance
+ @return pointer to the new method instance
*/
CIMMethod(const CIMMethod& x)
{
Inc(_rep = x._rep);
}
- ///
+
+ /** Assignment operator */
CIMMethod& operator=(const CIMMethod& x)
{
if (x._rep != _rep)
return *this;
}
- // ATTN: remove the classOrigin and propagated parameters.
-
/** Creates a CIM method with the specified name, type, and classOrigin
- @param name for the method
- @param type ATTN
- @param classOrigin
- @param propagated
- @return Throws IllegalName if name argument not legal CIM identifier.
+ @param name for the method
+ @param type ATTN
+ @param classOrigin
+ @param propagated
+ @return Throws IllegalName if name argument not legal CIM identifier.
*/
CIMMethod(
const String& name,
_rep = new CIMMethodRep(name, type, classOrigin, propagated);
}
- /// CIMMethod desctructor
+ /** Desctructor. */
~CIMMethod()
{
Dec(_rep);
}
+
/** CIMMethod getName - Gets the name of the method
- @return String with the name of the method
+ @return String with the name of the method
*/
const String& getName() const
{
}
/** CIMMethod setName - Set the method name
- @parm name ATTN (make reference to name defintion here)
- @return Throws IllegalName if name argument not legal CIM identifier.
+ @param name
+ @exception IllegalName if name argument not legal CIM identifier.
*/
void setName(const String& name)
{
_checkRep();
_rep->setName(name);
}
+
/** CIMMethod getType - gets the method type
- @return The CIM method type for this method.
+ @return The CIM method type for this method.
*/
-
CIMType getType() const
{
_checkRep();
return _rep->getType();
}
+
/** CIMMethod setType - Sets the method type to the specified CIM method
- type as defined in CIMType /Ref{TYPE}
+ type as defined in CIMType /Ref{TYPE}
*/
void setType(CIMType type)
{
_checkRep();
_rep->setType(type);
}
+
/** CIMMethod getClassOrigin - Returns the class in which this method
- was defined.
- @return ATTN:
+ was defined.
+ @return ATTN:
*/
const String& getClassOrigin() const
{
_checkRep();
return _rep->getClassOrigin();
}
- /** CIMMethod setClassOrigin - ATTN:
- */
+
+ /** CIMMethod setClassOrigin - ATTN: */
void setClassOrigin(const String& classOrigin)
{
_checkRep();
_rep->setClassOrigin(classOrigin);
}
- /// method getPropagated - ATTN:
+
+ /** method getPropagated - ATTN: */
Boolean getPropagated() const
{
_checkRep();
return _rep->getPropagated();
}
- /// method setPropagated - ATTN:
+
+ /** method setPropagated - ATTN: */
void setPropagated(Boolean propagated)
{
_checkRep();
_rep->setPropagated(propagated);
}
+
/** CIMMethod addQualifier -
- @parm CIMQualifier to add
- @param CIMQualifier to be added
- @return Throws AlreadyExists excetpion if the qualifier already exists in
- the method
- @exception AlreadyExists exception of CIMQualifier already exists.
+ @parm CIMQualifier to add
+ @param CIMQualifier to be added
+ @return Throws AlreadyExists excetpion if the qualifier already exists
+ in the method
+ @exception AlreadyExists exception
*/
CIMMethod& addQualifier(const CIMQualifier& x)
{
_rep->addQualifier(x);
return *this;
}
- /** CIMMethod findQualifier - Finds the CIMQualifier named by the input string.
- @param String defining the name of the parameter to be found
- @return Index to the parameter found or -1 if not found
- The -1 must be converted to a Unit32 as follows:
- <PRE>
- Uint32 pos = myClass.findProperty("name");
- if (pos == Uint32(-1))
- {
- // Not found!
- }
- </PRE>
+
+ /** CIMMethod findQualifier - returns the position of the qualifier with
+ the given name.
+ @param name - name of qualifier to be found.
+ @return index of the parameter if found; otherwise Uint32(-1).
*/
Uint32 findQualifier(const String& name)
{
_checkRep();
return _rep->findQualifier(name);
}
- /** CIMMethod findQualifier - Find the qualifier with the name defined on
- input
- @param String with the name of the parameter to be found.
- @return - index to the qualifier found or -1 if no qualifier found.
- */
+
Uint32 findQualifier(const String& name) const
{
_checkRep();
return _rep->findQualifier(name);
}
- /** CIMMethod getQualifier - Gets the CIMQualifier defined by the index input
- as a parameter.
- @param Index of the qualifier requested.
- @return CIMQualifier object or exception
- @exception OutOfBounds exception if the index is outside the range of
- parameters available from the CIMMethod.
+
+ /** CIMMethod getQualifier - Gets the CIMQualifier defined by the index
+ input as a parameter.
+ @param Index of the qualifier requested.
+ @return CIMQualifier object or exception
+ @exception OutOfBounds exception if the index is outside the range of
+ parameters available from the CIMMethod.
*/
CIMQualifier getQualifier(Uint32 pos)
{
_checkRep();
return _rep->getQualifier(pos);
}
- /** CIMMethod getQualifierCount - Returns count of the number of Qualifiers
- attached to the CIMMethod
- @return integer representing number of Qualifiers.
+
+ /** CIMMethod getQualifierCount - Returns the number of Qualifiers attached
+ to this method.
+ @return integer representing number of Qualifiers.
*/
Uint32 getQualifierCount() const
{
_checkRep();
return _rep->getQualifierCount();
}
- /** CIMMethod addParameter - Adds the parameter defined by the input to the
- CIMMethod
- Param - ATTN:
+
+ /** CIMMethod addParameter - Adds the parameter defined by the input
+ to the CIMMethod
*/
CIMMethod& addParameter(const CIMParameter& x)
{
_rep->addParameter(x);
return *this;
}
- /// CIMMethod findParameter - ATTN:
+
+ /** CIMMethod findParameter - Finds the parameter whose name is given
+ by the name parameter.
+ @param name - name of parameter to be found.
+ @return index of the parameter if found; otherwise Uint32(-1).
+ */
Uint32 findParameter(const String& name)
{
_checkRep();
return _rep->findParameter(name);
}
- /** CIMMethod findParameter - Finds the parameter defined by the name input
- and returns an index to the CIMParameter
- @param String defining the parameter to be found
- @return index to the parameter if found. Returns -1 if parameter not
- found
- */
- Uint32 findParameter(const String& name) const
+ Uint32 findParameter(const String& name) const
{
_checkRep();
return _rep->findParameter(name);
}
- /// CIMMethod getParameter - ATTN:
+
+ /** CIMMethod getParameter - ATTN: */
CIMParameter getParameter(Uint32 pos)
{
_checkRep();
}
/** CIMMethod getParameter - Gets the parameter defined by the index
- input as a parameter.
- @param index for the parameter to be returned.
- @return CIMParameter requested.
- @Exception OutOfBounds exception is thrown if the index is outside the
- range of available parameters
+ input as a parameter.
+ @param index for the parameter to be returned.
+ @return CIMParameter requested.
+ @Exception OutOfBounds exception is thrown if the index is outside the
+ range of available parameters
*/
CIMConstParameter getParameter(Uint32 pos) const
{
return _rep->getParameter(pos);
}
- /** CIMMethod getParameterCount - Gets the count of the numbeer of Parameters
- attached to the CIMMethod.
- @retrun - count of the number of parameters attached to the CIMMethod.
+ /** CIMMethod getParameterCount - Gets the count of the numbeer of
+ Parameters attached to the CIMMethod.
+ @retrun - count of the number of parameters attached to the CIMMethod.
*/
Uint32 getParameterCount() const
{
_checkRep();
return _rep->getParameterCount();
}
- /// method resolve - ATTN:
+
+ /** method resolve - ATTN: */
void resolve(
DeclContext* declContext,
const String& nameSpace,
_checkRep();
_rep->resolve(declContext, nameSpace, method);
}
- /// CIMMethod resolve
+
+ /** CIMMethod resolve */
void resolve(
DeclContext* declContext,
const String& nameSpace)
_checkRep();
_rep->resolve(declContext, nameSpace);
}
- /// operator
- operator int() const { return _rep != 0; }
- /// method toXML - ATTN:
+
+ /** Returns zero if CIMMethod refers to a null pointer */
+ operator int() const
+ {
+ return _rep != 0;
+ }
+
+ /** method toXML - placing XML encoding of this object into out arguemnt. */
void toXml(Array<Sint8>& out) const
{
_checkRep();
_rep->toXml(out);
}
- /// method print - ATTN:
+
+ /** method print - prints this method (in CIM encoded form). */
void print(std::ostream &o=std::cout) const
{
_checkRep();
_rep->print(o);
}
- /// CIMMethod identical - ATTN
+
+ /** CIMMethod identical - Returns true if this method is identical to the
+ one given by the argument x.
+ */
Boolean identical(const CIMConstMethod& x) const;
- /// CIMMethod clone - ATTN
+
+ /** CIMMethod clone - makes a distinct replica of this method */
CIMMethod clone() const
{
return CIMMethod(_rep->clone());
friend class CIMClassRep;
};
-////////////////////////////////////////////////////////////////////////////////
-//
-// CIMConstMethod
-//
-////////////////////////////////////////////////////////////////////////////////
-
class PEGASUS_COMMON_LINKAGE CIMConstMethod
{
public:
return _rep->findQualifier(name);
}
- /// CIMMethod findQualifier - ATTN
Uint32 findQualifier(const String& name) const
{
_checkRep();
#include <cctype>
#include <cstring>
+#include "HashTable.h"
#include "CIMReference.h"
#include "Indentor.h"
#include "CIMName.h"
return "unknown";
}
-static inline Uint32 _Hash(const String& str)
-{
- Uint32 h = 0;
-
- for (Uint32 i = 0, n = str.getLength(); i < n; i++)
- h = 5 * h + str[i];
-
- return h;
-}
-
Uint32 CIMReference::makeHashCode() const
{
CIMReference ref = *this;
for (Uint32 i = 0, n = ref._keyBindings.getSize(); i < n; i++)
ref._keyBindings[i]._name.toLower();
- return _Hash(ref.toString());
+ return Hash(ref.toString());
}
PEGASUS_NAMESPACE_END
--- /dev/null
+//%/////////////////////////////////////////////////////////////////////////////
+//
+// Copyright (c) 2000 The Open Group, BMC Software, Tivoli Systems, IBM
+//
+// Permission is hereby granted, free of charge, to any person obtaining a
+// copy of this software and associated documentation files (the "Software"),
+// to deal in the Software without restriction, including without limitation
+// the rights to use, copy, modify, merge, publish, distribute, sublicense,
+// and/or sell copies of the Software, and to permit persons to whom the
+// Software is furnished to do so, subject to the following conditions:
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+// DEALINGS IN THE SOFTWARE.
+//
+//==============================================================================
+//
+// Author: Mike Brasher (mbrasher@bmc.com)
+//
+// Modified By:
+//
+//%/////////////////////////////////////////////////////////////////////////////
+
+#include <cstring>
+#include "HashTable.h"
+
+PEGASUS_NAMESPACE_BEGIN
+
+////////////////////////////////////////////////////////////////////////////////
+//
+// Hash()
+//
+////////////////////////////////////////////////////////////////////////////////
+
+Uint32 Hash(const String& str)
+{
+ Uint32 h = 0;
+
+ for (Uint32 i = 0, n = str.getLength(); i < n; i++)
+ h = 5 * h + str[i];
+
+ return h;
+}
+
+////////////////////////////////////////////////////////////////////////////////
+//
+// HashTableBase::BucketBase
+//
+////////////////////////////////////////////////////////////////////////////////
+
+BucketBase::~BucketBase()
+{
+
+}
+
+////////////////////////////////////////////////////////////////////////////////
+//
+// HashTableIteratorBase
+//
+////////////////////////////////////////////////////////////////////////////////
+
+HashTableIteratorBase HashTableIteratorBase::operator++(int)
+{
+ HashTableIteratorBase tmp = *this;
+ operator++();
+ return tmp;
+}
+
+HashTableIteratorBase& HashTableIteratorBase::operator++()
+{
+ // At the end?
+
+ if (!_bucket)
+ return *this;
+
+ // More buckets this chain?
+
+ if ((_bucket = _bucket->next))
+ return *this;
+
+ // Find the next non-empty chain:
+
+ _bucket = 0;
+
+ while (_first != _last)
+ {
+ if (*_first)
+ {
+ _bucket = *_first++;
+ break;
+ }
+
+ _first++;
+ }
+
+ return *this;
+}
+
+HashTableIteratorBase::HashTableIteratorBase(
+ BucketBase** first,
+ BucketBase** last) : _first(first), _last(last)
+{
+ while (_first != last)
+ {
+ if (*_first)
+ {
+ _bucket = *_first++;
+ break;
+ }
+
+ _first++;
+ }
+}
+
+////////////////////////////////////////////////////////////////////////////////
+//
+// HashTableBase
+//
+////////////////////////////////////////////////////////////////////////////////
+
+HashTableBase::HashTableBase(Uint32 numChains) : _size(0), _numChains(numChains)
+{
+ if (numChains < 8)
+ numChains = 8;
+
+ _chains = new BucketBase*[_numChains];
+ memset(_chains, 0, sizeof(BucketBase*) * _numChains);
+}
+
+HashTableBase::~HashTableBase()
+{
+ clear();
+}
+
+void HashTableBase::clear()
+{
+ for (Uint32 i = 0; i < _numChains; i++)
+ {
+ for (BucketBase* bucket = _chains[i]; bucket; )
+ {
+ BucketBase* next = bucket->next;
+ delete bucket;
+ bucket = next;
+ }
+ }
+
+ _size = 0;
+ memset(_chains, 0, sizeof(BucketBase*) * _numChains);
+}
+
+Boolean HashTableBase::insert(
+ Uint32 hashCode,
+ BucketBase* bucket,
+ const void* key)
+{
+ // Check for duplicate entry with same key:
+
+ Uint32 i = hashCode % _numChains;
+ BucketBase* last = 0;
+
+ for (BucketBase* bucket = _chains[i]; bucket; bucket = bucket->next)
+ {
+ if (bucket->equal(key))
+ {
+ delete bucket;
+ return false;
+ }
+
+ last = bucket;
+ }
+
+ // Insert bucket:
+
+ bucket->next = 0;
+
+ if (last)
+ last->next = bucket;
+ else
+ _chains[i] = bucket;
+
+ _size++;
+ return true;
+}
+
+const BucketBase* HashTableBase::lookup(
+ Uint32 hashCode,
+ const void* key)
+{
+ Uint32 i = hashCode % _numChains;
+
+ for (BucketBase* bucket = _chains[i]; bucket; bucket = bucket->next)
+ {
+ if (bucket->equal(key))
+ return bucket;
+ }
+
+ // Not found!
+ return 0;
+}
+
+Boolean HashTableBase::remove(Uint32 hashCode, const void* key)
+{
+ for (Uint32 i = 0; i < _numChains; i++)
+ {
+ BucketBase* prev = 0;
+
+ for (BucketBase* bucket = _chains[i]; bucket; bucket = bucket->next)
+ {
+ if (bucket->equal(key))
+ {
+ if (prev)
+ prev->next = bucket->next;
+ else
+ _chains[i] = bucket->next;
+
+ delete bucket;
+ _size--;
+ return true;
+ }
+ prev = bucket;
+ }
+ }
+
+ return false;
+}
+
+PEGASUS_NAMESPACE_END
--- /dev/null
+//%/////////////////////////////////////////////////////////////////////////////
+//
+// Copyright (c) 2000 The Open Group, BMC Software, Tivoli Systems, IBM
+//
+// Permission is hereby granted, free of charge, to any person obtaining a
+// copy of this software and associated documentation files (the "Software"),
+// to deal in the Software without restriction, including without limitation
+// the rights to use, copy, modify, merge, publish, distribute, sublicense,
+// and/or sell copies of the Software, and to permit persons to whom the
+// Software is furnished to do so, subject to the following conditions:
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+// DEALINGS IN THE SOFTWARE.
+//
+//==============================================================================
+//
+// Author: Mike Brasher (mbrasher@bmc.com)
+//
+// Modified By:
+//
+//%/////////////////////////////////////////////////////////////////////////////
+
+#ifndef Pegasus_HashTable_h
+#define Pegasus_HashTable_h
+
+#include <Pegasus/Common/Config.h>
+#include <Pegasus/Common/String.h>
+
+PEGASUS_NAMESPACE_BEGIN
+
+PEGASUS_COMMON_LINKAGE inline Uint32 Hash(const String& str);
+
+/** Representation for a bucket. The HashTable class derives from this
+ bucket to append a key and value. This base class just defines
+ the pointer to the next bucket in the chain.
+*/
+class PEGASUS_COMMON_LINKAGE BucketBase
+{
+public:
+
+ /** Virtual destructor to ensure destruction of derived class
+ elements.
+ */
+ virtual ~BucketBase();
+
+ /** returns true if the key pointed to by the key argument is equal
+ to the internal key of this bucket. This method must be overridden
+ by the derived class.
+ */
+ virtual Boolean equal(const void* key) const = 0;
+
+ BucketBase* next;
+};
+
+class HashTableBase;
+
+/** This class implements a simple hash table forward iterator. */
+class PEGASUS_COMMON_LINKAGE HashTableIteratorBase
+{
+public:
+
+ HashTableIteratorBase() : _first(0), _last(0), _bucket(0) { }
+
+ operator Boolean() const { return _bucket != 0; }
+
+ HashTableIteratorBase operator++(int);
+
+ HashTableIteratorBase& operator++();
+
+ HashTableIteratorBase(BucketBase** first, BucketBase** last);
+
+protected:
+
+ BucketBase** _first;
+ BucketBase** _last;
+ BucketBase* _bucket;
+ friend HashTableBase;
+};
+
+/** The HashTableBase class is the base class which HashTable derives from.
+
+ This code is primarily an internal class used to implement the HashTable.
+ But there may be occasions to use it directly.
+
+ HashTableBase parcels out much of the large code so that that code is not
+ instantiated by the HashTable template class many times. This scheme helps
+ reduce code bloat caused by templates. The HashTable template class below
+ acts as kind of a wrapper around this class.
+
+ HashTableBase is implemented as an array of pointers to chains of hash
+ buckets. The table initially allocates some number of chains (which can
+ be controlled by the constructor) and then may increase the number of
+ chains later (resulting in a reorganization of the hash table).
+
+ ATTN: reorganization not supported yet.
+*/
+class PEGASUS_COMMON_LINKAGE HashTableBase
+{
+public:
+
+ /** This constructor allocates an array of pointers to chains of buckets,
+ which of course are all empty at this time. The numChains argument
+ If the numChains argument is less than eight, then eight chains will
+ be created.
+ @param numChains - specifies the initial number of chains.
+ */
+ HashTableBase(Uint32 numChains);
+
+ /** Destructor. */
+ ~HashTableBase();
+
+ /** Returns the size of this hash table (the number of entries). */
+ Uint32 getSize() const { return _size; }
+
+ /** Clears the contents of this hash table. After this is called, the
+ getSize() method returns zero.
+ */
+ void clear();
+
+ /** Inserts new key-value pair into hash table. Deletes the bucket on
+ failure so caller need not.
+ @param hashCode - hash code generated by caller's hash function.
+ @param bucket - bucket to be inserted.
+ @param key - pointer to key.
+ @return true if insertion successful; false if duplicate key.
+ */
+ Boolean insert(Uint32 hashCode, BucketBase* bucket, const void* key);
+
+ /** Finds the bucket with the given key. This method uses the
+ BucketBase::equal() method to compare keys.
+ @param hashCode - hash code generated by caller's hash function.
+ @param key - void pointer to key.
+ @return pointer to bucket with that key or zero otherwise.
+ */
+ const BucketBase* lookup(Uint32 hashCode, const void* key);
+
+ /** Removes the bucket with the given key. This method uses the
+ BucketBase::equal() method to compare keys.
+ @param hashCode - hash code generated by caller's hash function.
+ @param key - void pointer to key.
+ @return true if entry found and removed and false otherwise.
+ */
+ Boolean remove(Uint32 hashCode, const void* key);
+
+protected:
+
+ Uint32 _size;
+ Uint32 _numChains;
+ BucketBase** _chains;
+};
+
+/** The Bucket class is used to implement the HashTable class.
+*/
+template<class K, class V>
+class Bucket : public BucketBase
+{
+public:
+
+ Bucket(const K& key, const V& value) : _key(key), _value(value) { }
+
+ virtual ~Bucket();
+
+ virtual Boolean equal(const void* key) const;
+
+ K& getKey() { return _key; }
+
+ V& getValue() { return _value; }
+
+private:
+
+ K _key;
+ V _value;
+};
+
+template<class K, class V>
+Boolean Bucket<K,V>::equal(const void* key) const
+{
+ return *((K*)key) == _key;
+}
+
+template<class K, class V>
+Bucket<K,V>::~Bucket()
+{
+
+}
+
+/** Iterator for HashTable class. */
+template<class K, class V>
+class HashTableIterator : public HashTableIteratorBase
+{
+public:
+
+ HashTableIterator()
+ : HashTableIteratorBase() { }
+
+ HashTableIterator(BucketBase** first, BucketBase** last)
+ : HashTableIteratorBase(first, last) { }
+
+ const K& key() const { return ((Bucket<K,V>*)_bucket)->getKey(); }
+
+ const V& value() const { return ((Bucket<K,V>*)_bucket)->getValue(); }
+};
+
+/** HashTable provides a simple hash table implementation which associates
+ key-value pairs.
+*/
+template<class K, class V>
+class HashTable : public HashTableBase
+{
+public:
+
+ typedef HashTableIterator<K,V> Iterator;
+
+ /** By default, we create this many chains initially */
+ enum { DEFAULT_NUM_CHAINS = 32 };
+
+ /** Constructor.
+ @param numChains - number of chains to create.
+ */
+ HashTable(Uint32 numChains = DEFAULT_NUM_CHAINS)
+ : HashTableBase(numChains)
+ {
+ }
+
+ /** Inserts new key-value pair into hash table.
+ @param key - key component.
+ @param value - value component.
+ @return true on success; false if duplicate key.
+ */
+ Boolean insert(const K& key, const V& value)
+ {
+ return HashTableBase::insert(
+ Hash(key), new Bucket<K,V>(key, value), &key);
+ }
+
+ /** Looks up the entry with the given key.
+ @param key - key of entry to be located.
+ @param value - output value.
+ @return true if found; false otherwise.
+ */
+ Boolean lookup(const K& key, V& value);
+
+ /** Removes the entry with the given key.
+ @param key - key of entry to be removed.
+ @return true on success; false otherwise.
+ */
+ Boolean remove(const K& key)
+ {
+ return HashTableBase::remove(Hash(key), &key);
+ }
+
+ /** Obtains an iterator for this object. */
+ Iterator start() const
+ {
+ return Iterator(_chains, _chains + _numChains);
+ }
+};
+
+template<class K, class V>
+inline Boolean HashTable<K,V>::lookup(const K& key, V& value)
+{
+ Bucket<K,V>* bucket = (Bucket<K,V>*)HashTableBase::lookup(Hash(key), &key);
+
+ if (bucket)
+ {
+ value = bucket->getValue();
+ return true;
+ }
+
+ return false;
+}
+
+PEGASUS_NAMESPACE_END
+
+#endif /* Pegasus_HashTable_h */
LIBRARY = pegcommon
SOURCES = \
+ HashTable.cpp \
Service.cpp \
OptionManager.cpp \
CGIQueryString.cpp \
CIMReference instanceName = newInstance.getInstanceName(cimClass);
Uint32 index;
+ // ATTN: Should throw "object already exists" exception!
+
if (!InstanceIndexFile::insert(indexFilePath, instanceName, index))
throw CIMException(CIMException::FAILED);
// Recall flavor defaults: TOSUBCLASS | OVERRIDABLE
+#if 0
+
void CIMRepository::_createMetaQualifiers(const String& nameSpace)
{
// CIMQualifier CimType : string = null,
CIMScope::PROPERTY));
}
+#endif
+
PEGASUS_NAMESPACE_END
advent of the MOF compiler/loader. The XML Schema had no qualifiers
included in it so the XML loader needed a way to create them.
*/
+#if 0
void _createMetaQualifiers(const String& nameSpace);
+#endif
String _root;
RepositoryDeclContext* _context;
OVERVIEW
========
-This utility emulates on NT the JDPATH behavior of the Unix C-Shell. Its use
+This utility emulates on NT the CDPATH behavior of the Unix C-Shell. Its use
is trivial:
1. Copy jdath.exe and jd.bat to a directory on your path.