Isis Developer Reference
DbAccess.h
Go to the documentation of this file.
1 #ifndef DbAccess_h
2 #define DbAccess_h
3 
10 /* SPDX-License-Identifier: CC0-1.0 */
11 
12 #include <string>
13 #include <vector>
14 #include <iostream>
15 
16 #include "CollectorMap.h"
17 #include "DbProfile.h"
18 #include "IException.h"
19 
20 namespace Isis {
21 
22 
23  class PvlObject;
24 
106  class DbAccess : public DbProfile {
107  private:
110  ProfileList;
111 
112  public:
113  // Constructors and Destructor
114  DbAccess() : DbProfile("Database"), _defProfileName(""), _profiles() { }
115  DbAccess(const QString &dbaccFile,
116  const QString &defProfileName = "");
117  DbAccess(PvlObject &pvl, const QString &defProfileName = "");
118 
120  virtual ~DbAccess() { }
121 
127  int profileCount() const {
128  return (_profiles.size());
129  }
130 
138  bool profileExists(const QString &profile) const {
139  return (_profiles.exists(profile));
140  }
141 
142  const DbProfile getProfile(const QString &name = "") const;
143  const DbProfile getProfile(int nth) const;
144 
145 
155  void addProfile(const DbProfile &profile) {
156  _profiles.add(profile.Name(), profile);
157  }
158 
159  void load(const QString &filename);
160  void load(PvlObject &pvl);
161 
162  QString getDefaultProfileName() const;
163 
164  private:
165  QString _defProfileName;
166  ProfileList _profiles;
167  };
168 
169 
170 
171 
172 
173 }
174 #endif
Isis::PvlObject::endGroup
PvlGroupIterator endGroup()
Returns the ending group index.
Definition: PvlObject.h:109
Isis::PvlObject::findGroup
PvlGroupIterator findGroup(const QString &name, PvlGroupIterator beg, PvlGroupIterator end)
Find a group with the specified name, within these indexes.
Definition: PvlObject.h:129
Isis::PvlObject::PvlGroupIterator
QList< Isis::PvlGroup >::iterator PvlGroupIterator
The counter for groups.
Definition: PvlObject.h:83
Isis::PvlObject
Contains Pvl Groups and Pvl Objects.
Definition: PvlObject.h:61
Isis::DbProfile::Name
QString Name() const
Returns the name of this property.
Definition: DbProfile.h:104
Isis::DbProfile::exists
bool exists(const QString &key) const
Checks for the existance of a keyword.
Definition: DbProfile.h:115
Isis::CollectorMap::getNth
T & getNth(int nth)
Returns the nth value in the collection.
Definition: CollectorMap.h:624
Isis::DbAccess::~DbAccess
virtual ~DbAccess()
Destructor ensures everything is cleaned up properly.
Definition: DbAccess.h:120
Isis::DbAccess
DbAccess manages programatic access to a database through profiles.
Definition: DbAccess.h:106
PvlGroup.h
Isis::CollectorMap::get
T & get(const K &key)
Returns the value associated with the name provided.
Definition: CollectorMap.h:567
Isis::CollectorMap::size
int size() const
Returns the size of the collection.
Definition: CollectorMap.h:512
Isis::Pvl
Container for cube-like labels.
Definition: Pvl.h:119
Isis::DbAccess::getDefaultProfileName
QString getDefaultProfileName() const
Determine the name of the default profile.
Definition: DbAccess.cpp:189
IString.h
Isis::CollectorMap::exists
bool exists(const K &key) const
Checks the existance of a particular key in the list.
Definition: CollectorMap.h:551
Pvl.h
Isis::DbAccess::load
void load(const QString &filename)
Loads a Database access configuration file.
Definition: DbAccess.cpp:142
Isis::DbProfile::DbProfile
DbProfile()
Definition: DbProfile.h:59
Isis::PvlObject::findObject
PvlObjectIterator findObject(const QString &name, PvlObjectIterator beg, PvlObjectIterator end)
Find the index of object with a specified name, between two indexes.
Definition: PvlObject.h:274
Isis::DbProfile::loadkeys
void loadkeys(PvlContainer &pvl)
Loads DbProfile keys from the given Pvl construct.
Definition: DbProfile.cpp:184
Isis::DbAccess::DbAccess
DbAccess()
Definition: DbAccess.h:114
Isis::DbProfile
A DbProfile is a container for access parameters to a database.
Definition: DbProfile.h:51
DbAccess.h
Isis::CollectorMap::add
void add(const K &key, const T &value)
Adds the element to the list.
Definition: CollectorMap.h:540
IException.h
CollectorMap.h
Isis::CollectorMap< IString, DbProfile, NoCaseStringCompare >
Isis::DbAccess::profileCount
int profileCount() const
Reports the number of user profiles to access this database.
Definition: DbAccess.h:127
Isis::PvlObject::beginGroup
PvlGroupIterator beginGroup()
Returns the beginning group index.
Definition: PvlObject.h:91
Isis::DbAccess::getProfile
const DbProfile getProfile(const QString &name="") const
Retrieves the specified access profile.
Definition: DbAccess.cpp:92
PvlObject.h
DbProfile.h
Isis::DbProfile::value
QString value(const QString &key, int nth=0) const
Returns the specified value for the given keyword.
Definition: DbProfile.cpp:146
Isis::DbAccess::addProfile
void addProfile(const DbProfile &profile)
Adds a profile to the database profile.
Definition: DbAccess.h:155
Isis::DbAccess::profileExists
bool profileExists(const QString &profile) const
Checks existance of a database user profile.
Definition: DbAccess.h:138
Isis
This is free and unencumbered software released into the public domain.
Definition: Apollo.h:16