|
Isis Developer Reference
|
Go to the documentation of this file.
19 #include <gsl/gsl_math.h>
88 return (gsl_fcmp(v1, v2, -1.0
E-6) < 0);
192 const T &
copy(
const T &src)
const {
227 return (allocate(*(src)));
238 template <
typename P>
239 P *allocate(
const P &obj)
const {
414 template <
typename K,
typename T,
415 template <
class>
class ComparePolicy = SimpleCompare,
416 template <
class>
class RemovalPolicy = NoopRemoval,
417 template <
class>
class CopyPolicy = DefaultCopy
473 _keyPolicy = cmap._keyPolicy;
475 for(cItr = cmap._list.begin() ; cItr != cmap._list.end() ; cItr++) {
476 _list.insert(std::make_pair(cItr->first, cmap.
copy(cItr->second)));
498 _keyPolicy = cmap._keyPolicy;
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());
527 return (_list.count(
key));
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) {
703 return (_list.erase(
key));
712 return _list.begin();
730 return _list.begin();
754 void selfDestruct() {
756 for(itr = _list.begin() ; itr != _list.end() ; itr++) {
T copy(const T &src) const
Allocate new object using copy construtor and new pointer.
Definition: CollectorMap.h:226
CollectorIter begin()
Returns the start of the list for iterating purposes.
Definition: CollectorMap.h:729
CollectorConstIter begin() const
Const iterator into list.
Definition: CollectorMap.h:711
Provides a simple comparison between two values.
Definition: CollectorMap.h:30
int index(const K &key) const
Returns the index of the first occuring element in the list.
Definition: CollectorMap.h:604
Provides a case insensitive string comparison.
Definition: CollectorMap.h:53
IString DownCase()
Converts all upper case letters in the object IString into lower case characters.
Definition: IString.cpp:644
@ DuplicateKeys
Allow duplication of keys.
Definition: CollectorMap.h:437
T & getNth(int nth)
Returns the nth value in the collection.
Definition: CollectorMap.h:624
(Default) Policy for copying map elements
Definition: CollectorMap.h:182
CollectorMap()
Constructor.
Definition: CollectorMap.h:441
T & get(const K &key)
Returns the value associated with the name provided.
Definition: CollectorMap.h:567
int size() const
Returns the size of the collection.
Definition: CollectorMap.h:512
void destroy(T *element)
Destroys the CollectorMap entry.
Definition: CollectorMap.h:117
int remove(const K &key)
Removes and entry from the list.
Definition: CollectorMap.h:694
CollectorList::iterator CollectorIter
CollectorList iterator type declaration.
Definition: CollectorMap.h:425
CollectorList::const_iterator CollectorConstIter
CollectorList constant iterator type declaration.
Definition: CollectorMap.h:427
int count(const K &key) const
Returns the number of keys found in the list.
Definition: CollectorMap.h:526
virtual ~CollectorMap()
Destructor handles removal of the elements within the collection.
Definition: CollectorMap.h:459
bool operator()(const K &v1, const K &v2) const
Compares v1 and v2 as floating point values.
Definition: CollectorMap.h:87
const T & get(const K &key) const
Const version returning the value associated with the given name.
Definition: CollectorMap.h:583
const T & copy(const T &src) const
Returns a copy of the input.
Definition: CollectorMap.h:192
CollectorMap(const CollectorMap &cmap)
Copy constructor invokes the copy policy as provided by the users.
Definition: CollectorMap.h:472
bool operator()(const K &v1, const K &v2) const
Returns true if v1 is less than v2.
Definition: CollectorMap.h:40
std::multimap< K, CollectorType, ComparePolicy< K > > CollectorList
A multimap attacking a key to a CollectorType and a ComparePolicy<CollectorType>
Definition: CollectorMap.h:423
bool exists(const K &key) const
Checks the existance of a particular key in the list.
Definition: CollectorMap.h:551
const K & key(int nth) const
Returns the nth key in the collection.
Definition: CollectorMap.h:673
#define _FILEINFO_
Macro for the filename and line number.
Definition: IException.h:24
const T & getNth(int nth) const
Returns the nth value in the collection.
Definition: CollectorMap.h:649
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...
Definition: CollectorMap.h:64
@ UniqueKeys
Constrain keys to be unique.
Definition: CollectorMap.h:436
KeyPolicy
Enumerated selection of key behaviour.
Definition: CollectorMap.h:436
T CollectorType
Data type.
Definition: CollectorMap.h:421
void destroy(T *element)
Destroys the CollectorMap pointer's CollectorMap.
Definition: CollectorMap.h:142
CollectorConstIter end() const
Const iterator to end of list.
Definition: CollectorMap.h:720
Isis exception class.
Definition: IException.h:91
Policy for deleting arrays that CollectorMap owns.
Definition: CollectorMap.h:156
void add(const K &key, const T &value)
Adds the element to the list.
Definition: CollectorMap.h:540
@ Programmer
This error is for when a programmer made an API call that was illegal.
Definition: IException.h:146
CollectorIter end()
Returns the end of the list.
Definition: CollectorMap.h:739
Collector/container for arbitrary items.
Definition: CollectorMap.h:419
CollectorMap & operator=(const CollectorMap &cmap)
Assignment operator for the CollectorMap class object.
Definition: CollectorMap.h:495
const double E
Sets some basic constants for use in ISIS programming.
Definition: Constants.h:39
void destroy(T *element)
Destroys the array of CollectorMaps.
Definition: CollectorMap.h:164
Supplies a NOOP default for removal of a CollectorMap entry.
Definition: CollectorMap.h:102
CollectorMap(const KeyPolicy &keyPolicy)
Allows the user to choose if keys can be duplicated.
Definition: CollectorMap.h:452
Pointer to object policy for copying map elements.
Definition: CollectorMap.h:214
Supplies a policy for deleting pointers that CollectorMap owns.
Definition: CollectorMap.h:134
This is free and unencumbered software released into the public domain.
Definition: Apollo.h:16
Provides a robust comparison of double/float values.
Definition: CollectorMap.h:77