USGS

Isis 3.0 Developer's Reference (API)

Home

DbProfile.h

Go to the documentation of this file.
00001 #ifndef DbProfile_h
00002 #define DbProfile_h
00003 
00026 #include <string>
00027 #include <vector>
00028 #include <iostream>
00029 
00030 #include "PvlKeyword.h"
00031 #include "PvlContainer.h"
00032 #include "CollectorMap.h"
00033 #include "IException.h"
00034 
00035 namespace Isis {
00036 
00065   class DbProfile {
00066 
00067     protected:
00068       /* Container for multi-valued keywords in profiles */
00069       typedef CollectorMap<IString, PvlKeyword, NoCaseStringCompare> KeyList;
00070 
00071     public:
00072       //  Constructors and Destructor
00073       DbProfile() : _name("Profile"), _keys() { }
00074       DbProfile(const QString &name) : _name(name), _keys() { }
00075       DbProfile(const DbProfile &prof1, const DbProfile &prof2,
00076                 const QString &name = "");
00077       DbProfile(PvlContainer &pvl);
00078 
00079 
00081       virtual ~DbProfile() { }
00082 
00091       bool isValid() const {
00092         return (size() > 0);
00093       }
00094 
00100       int size() const {
00101         return (_keys.size());
00102       }
00103 
00109       void setName(const QString &name) {
00110         _name = name;
00111       }
00112 
00118       QString Name() const {
00119         return (_name);
00120       }
00121 
00129       bool exists(const QString &key) const {
00130         return (_keys.exists(key));
00131       }
00132 
00133       //  Convenience methods for adding keys
00134       void add(const QString &key, const QString &value = "");
00135       void replace(const QString &key, const QString &value = "");
00136       void remove(const QString &key);
00137       int  count(const QString &key) const;
00138 
00155       QString key(int nth) const {
00156         return (_keys.key(nth).ToQt());
00157       }
00158       QString value(const QString &key, int nth = 0) const;
00159       QString operator()(const QString &key, int nth = 0) const;
00160 
00161     protected:
00162       void loadkeys(PvlContainer &pvl);
00163 
00173       const KeyList &getKeyList() const {
00174         return (_keys);
00175       }
00176 
00177     private:
00178       QString _name;     
00179       KeyList _keys;         
00180   };
00181 }
00182 
00183 
00184 #endif
00185 
00186