USGS

Isis 3.0 Developer's Reference (API)

Home

DbProfile.h
Go to the documentation of this file.
1 #ifndef DbProfile_h
2 #define DbProfile_h
3 
26 #include <string>
27 #include <vector>
28 #include <iostream>
29 
30 #include "PvlKeyword.h"
31 #include "PvlContainer.h"
32 #include "CollectorMap.h"
33 #include "IException.h"
34 
35 namespace Isis {
36 
65  class DbProfile {
66 
67  protected:
68  /* Container for multi-valued keywords in profiles */
70 
71  public:
72  // Constructors and Destructor
73  DbProfile() : _name("Profile"), _keys() { }
74  DbProfile(const QString &name) : _name(name), _keys() { }
75  DbProfile(const DbProfile &prof1, const DbProfile &prof2,
76  const QString &name = "");
77  DbProfile(PvlContainer &pvl);
78 
79 
81  virtual ~DbProfile() { }
82 
91  bool isValid() const {
92  return (size() > 0);
93  }
94 
100  int size() const {
101  return (_keys.size());
102  }
103 
109  void setName(const QString &name) {
110  _name = name;
111  }
112 
118  QString Name() const {
119  return (_name);
120  }
121 
129  bool exists(const QString &key) const {
130  return (_keys.exists(key));
131  }
132 
133  // Convenience methods for adding keys
134  void add(const QString &key, const QString &value = "");
135  void replace(const QString &key, const QString &value = "");
136  void remove(const QString &key);
137  int count(const QString &key) const;
138 
155  QString key(int nth) const {
156  return (_keys.key(nth).ToQt());
157  }
158  QString value(const QString &key, int nth = 0) const;
159  QString operator()(const QString &key, int nth = 0) const;
160 
161  protected:
162  void loadkeys(PvlContainer &pvl);
163 
173  const KeyList &getKeyList() const {
174  return (_keys);
175  }
176 
177  private:
178  QString _name;
179  KeyList _keys;
180  };
181 }
182 
183 
184 #endif
185 
186