17#include "IException.h" 
   19#include <gsl/gsl_math.h> 
   88      return (gsl_fcmp(v1, v2, -1.0E-6) < 0);
 
 
 
  192      const T &
copy(
const T &src)
 const {
 
 
 
  238      template <
typename P>
 
 
  414  template < 
typename K, 
typename T,
 
  415           template <
class> 
class ComparePolicy = SimpleCompare,
 
  416           template <
class> 
class RemovalPolicy = NoopRemoval,
 
  417           template <
class> 
class CopyPolicy = DefaultCopy
 
  475        for(cItr = cmap._list.begin() ; cItr != cmap._list.end() ; cItr++) {
 
  476          _list.insert(std::make_pair(cItr->first, cmap.copy(cItr->second)));
 
 
  500          for(cItr = cmap._list.begin() ; cItr != cmap._list.end() ; cItr++) {
 
  501            _list.insert(std::make_pair(cItr->first, cmap.copy(cItr->second)));
 
 
  513        return (
_list.size());
 
 
  542        _list.insert(std::make_pair(
key, value));
 
 
  553        return (cItr != 
_list.end());
 
 
  569        if(cItr == 
_list.end()) {
 
  570          QString mess = 
"Requested value does not exist!";
 
  573        return (cItr->second);
 
 
  585        if(cItr == 
_list.end()) {
 
  586          QString mess = 
"Requested value does not exist!";
 
  589        return (cItr->second);
 
 
  606        if(cItr == 
_list.end()) {
 
  610          return (std::distance(
_list.begin(), cItr));
 
 
  627        for(cItr = 
_list.begin(), i = 0 ; cItr != 
_list.end() ; ++cItr, i++) {
 
  631        if(cItr == 
_list.end()) {
 
  632          std::ostringstream mess;
 
  633          mess << 
"Requested index (" << nth << 
") out of range" << std::endl;
 
  636        return (cItr->second);
 
 
  652        for(cItr = 
_list.begin(), i = 0 ; cItr != 
_list.end() ; ++cItr, i++) {
 
  655        if(cItr == 
_list.end()) {
 
  656          std::ostringstream mess;
 
  657          mess << 
"Requested index (" << nth << 
") out of range" << std::endl;
 
  660        return (cItr->second);
 
 
  673      const K &
key(
int nth)
 const {
 
  676        for(cItr = 
_list.begin(), i = 0 ; cItr != 
_list.end() ; ++cItr, i++) {
 
  679        if(cItr == 
_list.end()) {
 
  680          std::ostringstream mess;
 
  681          mess << 
"Requested key index (" << nth << 
") out of range" << std::endl;
 
  684        return (cItr->first);
 
 
  696        if(Itr1 == 
_list.end()) 
return (0);
 
  699        while(Itr1 != Itr2) {
 
  700          this->destroy(&Itr1->second);
 
 
  712        return _list.begin();
 
 
  730        return _list.begin();
 
 
  756        for(itr = 
_list.begin() ; itr != 
_list.end() ; itr++) {
 
  757          this->destroy(&itr->second);
 
 
 
Collector/container for arbitrary items.
 
const K & key(int nth) const
Returns the nth key in the collection.
 
virtual ~CollectorMap()
Destructor handles removal of the elements within the collection.
 
CollectorMap & operator=(const CollectorMap &cmap)
Assignment operator for the CollectorMap class object.
 
int size() const
Returns the size of the collection.
 
std::multimap< K, CollectorType, ComparePolicy< K > > CollectorList
A multimap attacking a key to a CollectorType and a ComparePolicy<CollectorType>
 
CollectorList::const_iterator CollectorConstIter
CollectorList constant iterator type declaration.
 
int remove(const K &key)
Removes and entry from the list.
 
CollectorMap()
Constructor.
 
T & get(const K &key)
Returns the value associated with the name provided.
 
bool exists(const K &key) const
Checks the existance of a particular key in the list.
 
KeyPolicy
Enumerated selection of key behaviour.
 
@ UniqueKeys
Constrain keys to be unique.
 
@ DuplicateKeys
Allow duplication of keys.
 
CollectorMap(const KeyPolicy &keyPolicy)
Allows the user to choose if keys can be duplicated.
 
CollectorList _list
The list.
 
int index(const K &key) const
Returns the index of the first occuring element in the list.
 
CollectorIter end()
Returns the end of the list.
 
const T & get(const K &key) const
Const version returning the value associated with the given name.
 
CollectorIter begin()
Returns the start of the list for iterating purposes.
 
const T & getNth(int nth) const
Returns the nth value in the collection.
 
CollectorConstIter begin() const
Const iterator into list.
 
CollectorConstIter end() const
Const iterator to end of list.
 
KeyPolicy _keyPolicy
Unique or duplicate key constraint.
 
CollectorMap(const CollectorMap &cmap)
Copy constructor invokes the copy policy as provided by the users.
 
T CollectorType
Data type.
 
void add(const K &key, const T &value)
Adds the element to the list.
 
int count(const K &key) const
Returns the number of keys found in the list.
 
T & getNth(int nth)
Returns the nth value in the collection.
 
CollectorList::iterator CollectorIter
CollectorList iterator type declaration.
 
void selfDestruct()
Thourough destruction of list.
 
@ Programmer
This error is for when a programmer made an API call that was illegal.
 
IString DownCase()
Converts all upper case letters in the object IString into lower case characters.
 
This is free and unencumbered software released into the public domain.
 
Policy for deleting arrays that CollectorMap owns.
 
void destroy(T *element)
Destroys the array of CollectorMaps.
 
(Default) Policy for copying map elements
 
const T & copy(const T &src) const
Returns a copy of the input.
 
Provides a case insensitive string comparison.
 
bool operator()(const K &v1, const K &v2) const
Compares v1 and v2 as case insensitive strings, and returns true of v1 is less than v2 (as those stri...
 
Supplies a NOOP default for removal of a CollectorMap entry.
 
void destroy(T *element)
Destroys the CollectorMap entry.
 
Pointer to object policy for copying map elements.
 
T copy(const T &src) const
Allocate new object using copy construtor and new pointer.
 
P * allocate(const P &obj) const
Allocate new object using copy constructor.
 
Supplies a policy for deleting pointers that CollectorMap owns.
 
void destroy(T *element)
Destroys the CollectorMap pointer's CollectorMap.
 
Provides a robust comparison of double/float values.
 
bool operator()(const K &v1, const K &v2) const
Compares v1 and v2 as floating point values.
 
Provides a simple comparison between two values.
 
bool operator()(const K &v1, const K &v2) const
Returns true if v1 is less than v2.