#include <boost/algorithm/string.hpp>
#include <boost/foreach.hpp>
-#include <boost/scoped_ptr.hpp>
#include <vector>
using namespace std;
namespace isc {
namespace dhcp {
-std::string DatabaseConnection::getParameter(const std::string& name) const {
+std::string
+DatabaseConnection::getParameter(const std::string& name) const {
ParameterMap::const_iterator param = parameters_.find(name);
if (param == parameters_.end()) {
isc_throw(BadValue, "Parameter " << name << " not found");
// OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
// PERFORMANCE OF THIS SOFTWARE.
-#ifndef DATA_SOURCE_H
-#define DATA_SOURCE_H
+#ifndef DATABASE_CONNECTION_H
+#define DATABASE_CONNECTION_H
#include <boost/noncopyable.hpp>
#include <exceptions/exceptions.h>
};
-/// @brief Common Data Source Class
+/// @brief Common database connection class.
///
/// This class provides functions that are common for establishing
/// connection with different types of databases; enables operations
/// on access parameters strings. In particular, it provides a way
/// to parse parameters in key=value format. This class is expected
-/// to be a base class for all LeaseMgr and possibly HostDataSource
-/// derived classes.
+/// to be a base class for all @ref LeaseMgr and possibly
+/// @ref BaseHostDataSource derived classes.
class DatabaseConnection : public boost::noncopyable {
-
public:
- /// Database configuration parameter map
+ /// @brief Database configuration parameter map
typedef std::map<std::string, std::string> ParameterMap;
/// @brief Constructor
:parameters_(parameters) {
}
- /// @brief returns value of the parameter
+ /// @brief Returns value of a connection parameter.
+ ///
+ /// @param name Name of the parameter which value should be returned.
+ /// @return Value of one of the connection parameters.
/// @throw BadValue if parameter is not found
- /// @return parameter
std::string getParameter(const std::string& name) const;
/// @brief Parse database access string
///
/// @param dbaccess Database access string.
///
- /// @return std::map<std::string, std::string> Map of keyword/value pairs.
- static DatabaseConnection::ParameterMap parse(const std::string& dbaccess);
+ /// @return @ref ParameterMap of keyword/value pairs.
+ static ParameterMap parse(const std::string& dbaccess);
/// @brief Redact database access string
///
/// @return Redacted database access string.
static std::string redactedAccessString(const ParameterMap& parameters);
-protected:
+private:
/// @brief List of parameters passed in dbconfig
///
}; // end of isc::dhcp namespace
}; // end of isc namespace
-#endif // DATA_SOURCE_H
+#endif // DATABASE_CONNECTION_H