diff --git a/middletier/cta/SqliteDatabase.cpp b/middletier/cta/SqliteDatabase.cpp index a1094e763319c3bbc61fa24f101c5ca59569a40f..2b64bfc15d7e29873674a1697e29e8b1d003caaa 100644 --- a/middletier/cta/SqliteDatabase.cpp +++ b/middletier/cta/SqliteDatabase.cpp @@ -833,9 +833,10 @@ std::list<cta::TapePool> cta::SqliteDatabase::selectAllTapePools(const SecurityI std::string((char *)sqlite3_column_text(statement,cm("NAME"))), sqlite3_column_int(statement,cm("NBDRIVES")), sqlite3_column_int(statement,cm("NBPARTIALTAPES")), - cta::UserIdentity(sqlite3_column_int(statement,cm("UID")),sqlite3_column_int(statement,cm("GID"))), - time_t(sqlite3_column_int(statement,cm("CREATIONTIME"))), - std::string((char *)sqlite3_column_text(statement,cm("COMMENT"))) + cta::UserIdentity(sqlite3_column_int(statement,cm("UID")), + sqlite3_column_int(statement,cm("GID"))), + std::string((char *)sqlite3_column_text(statement,cm("COMMENT"))), + time_t(sqlite3_column_int(statement,cm("CREATIONTIME"))) )); } sqlite3_finalize(statement); @@ -1102,8 +1103,8 @@ cta::TapePool cta::SqliteDatabase::getTapePoolByName(const SecurityIdentity &req sqlite3_column_int(statement,cm("NBDRIVES")), sqlite3_column_int(statement,cm("NBPARTIALTAPES")), cta::UserIdentity(sqlite3_column_int(statement,cm("UID")),sqlite3_column_int(statement,cm("GID"))), - time_t(sqlite3_column_int(statement,cm("CREATIONTIME"))), - std::string((char *)sqlite3_column_text(statement,cm("COMMENT"))) + std::string((char *)sqlite3_column_text(statement,cm("COMMENT"))), + time_t(sqlite3_column_int(statement,cm("CREATIONTIME"))) ); } else if(res==SQLITE_DONE) { diff --git a/middletier/cta/TapePool.cpp b/middletier/cta/TapePool.cpp index 9457fce077b1391359cf9309ea7f9fcfa10b1170..89b8e056f2812f1f1f6437a9689218f69cada9d6 100644 --- a/middletier/cta/TapePool.cpp +++ b/middletier/cta/TapePool.cpp @@ -5,8 +5,13 @@ //------------------------------------------------------------------------------ cta::TapePool::TapePool(): m_nbDrives(0), - m_nbPartialTapes(0), - m_creationTime(time(NULL)) { + m_nbPartialTapes(0) { +} + +//------------------------------------------------------------------------------ +// destructor +//------------------------------------------------------------------------------ +cta::TapePool::~TapePool() throw() { } //------------------------------------------------------------------------------ @@ -17,14 +22,12 @@ cta::TapePool::TapePool( const uint16_t nbDrives, const uint32_t nbPartialTapes, const UserIdentity &creator, - const time_t creationTime, - const std::string &comment): + const std::string &comment, + const time_t creationTime): + ConfigurationItem(creator, comment, creationTime), m_name(name), m_nbDrives(nbDrives), - m_nbPartialTapes(nbPartialTapes), - m_creationTime(creationTime), - m_creator(creator), - m_comment(comment) { + m_nbPartialTapes(nbPartialTapes) { } //------------------------------------------------------------------------------ @@ -54,25 +57,3 @@ uint16_t cta::TapePool::getNbDrives() const throw() { uint32_t cta::TapePool::getNbPartialTapes() const throw() { return m_nbPartialTapes; } - -//------------------------------------------------------------------------------ -// getCreationTime -//------------------------------------------------------------------------------ -time_t cta::TapePool::getCreationTime() const throw() { - return m_creationTime; -} - -//------------------------------------------------------------------------------ -// getCreator -//------------------------------------------------------------------------------ -const cta::UserIdentity &cta::TapePool::getCreator() - const throw() { - return m_creator; -} - -//------------------------------------------------------------------------------ -// getComment -//------------------------------------------------------------------------------ -const std::string &cta::TapePool::getComment() const throw() { - return m_comment; -} diff --git a/middletier/cta/TapePool.hpp b/middletier/cta/TapePool.hpp index 897f80c8c4f7f338016b747270f8ee4c3a864572..cb4bc836b3e171eb999d50d899cd8f25aec61c0d 100644 --- a/middletier/cta/TapePool.hpp +++ b/middletier/cta/TapePool.hpp @@ -1,5 +1,6 @@ #pragma once +#include "cta/ConfigurationItem.hpp" #include "cta/UserIdentity.hpp" #include <string> @@ -9,7 +10,7 @@ namespace cta { /** * Class representing a tape pool. */ -class TapePool { +class TapePool: public ConfigurationItem { public: /** @@ -17,6 +18,11 @@ public: */ TapePool(); + /** + * Destructor. + */ + ~TapePool() throw(); + /** * Constructor. * @@ -28,14 +34,17 @@ public: * full at any moment in time. * @param creator The identity of the user that created the tape pool. * @param comment The comment describing the tape pool. + * @param creationTime Optionally the absolute time at which the + * configuration item was created. If no value is given then the current + * time is used. */ TapePool( const std::string &name, const uint16_t nbDrives, const uint32_t nbPartialTapes, const UserIdentity &creator, - const time_t creationTime, - const std::string &comment); + const std::string &comment, + const time_t creationTime = time(NULL)); /** * Less than operator. @@ -71,27 +80,6 @@ public: */ uint32_t getNbPartialTapes() const throw(); - /** - * Returns the time when the tape pool was created. - * - * @return The time when the tape pool was created. - */ - time_t getCreationTime() const throw(); - - /** - * Returns the identity of the user that created the tape pool. - * - * @return The identity of the user that created the tape pool. - */ - const UserIdentity &getCreator() const throw(); - - /** - * Returns the comment describing the tape pool. - * - * @return The comment describing the tape pool. - */ - const std::string &getComment() const throw(); - private: /** @@ -111,21 +99,6 @@ private: */ uint32_t m_nbPartialTapes; - /** - * The time when the tape pool was created. - */ - time_t m_creationTime; - - /** - * The identity of the user that created the tape pool. - */ - UserIdentity m_creator; - - /** - * Comment describing the tape pool. - */ - std::string m_comment; - }; // class TapePool } // namespace cta