Isis 3 Programmer Reference
DbAccess.h
Go to the documentation of this file.
1 #ifndef DbAccess_h
2 #define DbAccess_h
3 
26 #include <string>
27 #include <vector>
28 #include <iostream>
29 
30 #include "CollectorMap.h"
31 #include "DbProfile.h"
32 #include "IException.h"
33 
34 namespace Isis {
35 
36 
37  class PvlObject;
38 
120  class DbAccess : public DbProfile {
121  private:
125 
126  public:
127  // Constructors and Destructor
128  DbAccess() : DbProfile("Database"), _defProfileName(""), _profiles() { }
129  DbAccess(const QString &dbaccFile,
130  const QString &defProfileName = "");
131  DbAccess(PvlObject &pvl, const QString &defProfileName = "");
132 
134  virtual ~DbAccess() { }
135 
141  int profileCount() const {
142  return (_profiles.size());
143  }
144 
152  bool profileExists(const QString &profile) const {
153  return (_profiles.exists(profile));
154  }
155 
156  const DbProfile getProfile(const QString &name = "") const;
157  const DbProfile getProfile(int nth) const;
158 
159 
169  void addProfile(const DbProfile &profile) {
170  _profiles.add(profile.Name(), profile);
171  }
172 
173  void load(const QString &filename);
174  void load(PvlObject &pvl);
175 
176  QString getDefaultProfileName() const;
177 
178  private:
179  QString _defProfileName;
181  };
182 
183 
184 
185 
186 
187 }
188 #endif
189 
190 
void addProfile(const DbProfile &profile)
Adds a profile to the database profile.
Definition: DbAccess.h:169
void load(const QString &filename)
Loads a Database access configuration file.
Definition: DbAccess.cpp:156
bool profileExists(const QString &profile) const
Checks existance of a database user profile.
Definition: DbAccess.h:152
int size() const
Returns the size of the collection.
Definition: CollectorMap.h:528
A DbProfile is a container for access parameters to a database.
Definition: DbProfile.h:65
const DbProfile getProfile(const QString &name="") const
Retrieves the specified access profile.
Definition: DbAccess.cpp:106
bool exists(const K &key) const
Checks the existance of a particular key in the list.
Definition: CollectorMap.h:567
void add(const K &key, const T &value)
Adds the element to the list.
Definition: CollectorMap.h:556
QString _defProfileName
Name of default profile.
Definition: DbAccess.h:179
int profileCount() const
Reports the number of user profiles to access this database.
Definition: DbAccess.h:141
CollectorMap< IString, DbProfile, NoCaseStringCompare > ProfileList
Define the container for the DbAccess key word list.
Definition: DbAccess.h:124
DbAccess manages programatic access to a database through profiles.
Definition: DbAccess.h:120
Namespace for ISIS/Bullet specific routines.
Definition: Apollo.h:31
QString getDefaultProfileName() const
Determine the name of the default profile.
Definition: DbAccess.cpp:203
QString Name() const
Returns the name of this property.
Definition: DbProfile.h:118
virtual ~DbAccess()
Destructor ensures everything is cleaned up properly.
Definition: DbAccess.h:134
Contains Pvl Groups and Pvl Objects.
Definition: PvlObject.h:74
ProfileList _profiles
List of profiles.
Definition: DbAccess.h:180