From f907abccca2503977e4ddf330c890a636600819b Mon Sep 17 00:00:00 2001
From: Steven Murray <Steven.Murray@cern.ch>
Date: Wed, 18 Feb 2015 17:31:14 +0100
Subject: [PATCH] Added Tape

---
 libs/client/CMakeLists.txt     |   1 +
 libs/client/LogicalLibrary.hpp |   7 --
 libs/client/Tape.cpp           |  87 +++++++++++++++++++++
 libs/client/Tape.hpp           | 139 +++++++++++++++++++++++++++++++++
 4 files changed, 227 insertions(+), 7 deletions(-)
 create mode 100644 libs/client/Tape.cpp
 create mode 100644 libs/client/Tape.hpp

diff --git a/libs/client/CMakeLists.txt b/libs/client/CMakeLists.txt
index b1f22b2f60..a84bf0e69d 100644
--- a/libs/client/CMakeLists.txt
+++ b/libs/client/CMakeLists.txt
@@ -24,6 +24,7 @@ set (CLIENT_LIB_SRC_FILES
   MockMiddleTierUser.cpp
   SecurityIdentity.cpp
   StorageClass.cpp
+  Tape.cpp
   TapePool.cpp
   UserIdentity.cpp
   Utils.cpp)
diff --git a/libs/client/LogicalLibrary.hpp b/libs/client/LogicalLibrary.hpp
index 7f598e2b64..093f5bf694 100644
--- a/libs/client/LogicalLibrary.hpp
+++ b/libs/client/LogicalLibrary.hpp
@@ -36,13 +36,6 @@ public:
    */
   const std::string &getName() const throw();
 
-  /**
-   * Returns the name of the device group.
-   *
-   * @return The name of the device group.
-   */
-  const std::string &getDeviceGroupName() const throw();
-
   /**
    * Returns the time when the logical library was created.
    *
diff --git a/libs/client/Tape.cpp b/libs/client/Tape.cpp
new file mode 100644
index 0000000000..962fe46b81
--- /dev/null
+++ b/libs/client/Tape.cpp
@@ -0,0 +1,87 @@
+#include "Tape.hpp"
+
+//------------------------------------------------------------------------------
+// constructor
+//------------------------------------------------------------------------------
+cta::Tape::Tape():
+    m_capacityInBytes(0),
+    m_dataOnTapeInBytes(0),
+    m_creationTime(time(NULL)) {
+}
+
+//------------------------------------------------------------------------------
+// constructor
+//------------------------------------------------------------------------------
+cta::Tape::Tape(
+    const std::string &vid,
+    const std::string &logicalLibraryName,
+    const std::string &tapePoolName,
+    const uint64_t capacityInBytes,
+    const UserIdentity &creator,
+    const std::string &comment):
+    m_vid(vid),
+    m_logicalLibraryName(logicalLibraryName),
+    m_tapePoolName(tapePoolName),
+    m_capacityInBytes(capacityInBytes),
+    m_dataOnTapeInBytes(0),
+    m_creationTime(time(NULL)),
+    m_creator(creator),
+    m_comment(comment) {
+}
+
+//------------------------------------------------------------------------------
+// getVid
+//------------------------------------------------------------------------------
+const std::string &cta::Tape::getVid() const throw() {
+  return m_vid;
+}
+
+//------------------------------------------------------------------------------
+// getLogicalLibraryName
+//------------------------------------------------------------------------------
+const std::string &cta::Tape::getLogicalLibraryName() const throw() {
+  return m_logicalLibraryName;
+}
+
+//------------------------------------------------------------------------------
+// getTapePoolName
+//------------------------------------------------------------------------------
+const std::string &cta::Tape::getTapePoolName() const throw() {
+  return m_tapePoolName;
+}
+
+//------------------------------------------------------------------------------
+// getCapacityInBytes
+//------------------------------------------------------------------------------
+uint64_t cta::Tape::getCapacityInBytes() const throw() {
+  return m_capacityInBytes;
+}
+
+//------------------------------------------------------------------------------
+// getDataOnTapeInBytes
+//------------------------------------------------------------------------------
+uint64_t cta::Tape::getDataOnTapeInBytes() const throw() {
+  return m_dataOnTapeInBytes;
+}
+
+//------------------------------------------------------------------------------
+// getCreationTime
+//------------------------------------------------------------------------------
+time_t cta::Tape::getCreationTime() const throw() {
+  return m_creationTime;
+}
+
+//------------------------------------------------------------------------------
+// getCreator
+//------------------------------------------------------------------------------
+const cta::UserIdentity &cta::Tape::getCreator()
+  const throw() {
+  return m_creator;
+}
+
+//------------------------------------------------------------------------------
+// getComment
+//------------------------------------------------------------------------------
+const std::string &cta::Tape::getComment() const throw() {
+  return m_comment;
+}
diff --git a/libs/client/Tape.hpp b/libs/client/Tape.hpp
new file mode 100644
index 0000000000..c2764dbeb4
--- /dev/null
+++ b/libs/client/Tape.hpp
@@ -0,0 +1,139 @@
+#pragma once
+
+#include "UserIdentity.hpp"
+
+#include <string>
+
+namespace cta {
+
+/**
+ * Class representing a tape.
+ */
+class Tape {
+public:
+
+  /**
+   * Constructor.
+   */
+  Tape();
+
+  /**
+   * Constructor.
+   *
+   * @param vid The volume identifier of the tape.
+   * @param logicalLibrary The name of the logical library to which the tape
+   * belongs.
+   * @param tapePoolName The name of the tape pool to which the tape belongs.
+   * @param capacityInBytes The capacity of the tape.
+   * @param creator The identity of the user that created the tape.
+   * @param comment The comment describing the tape.
+   */
+  Tape(
+    const std::string &vid,
+    const std::string &logicalLibraryName,
+    const std::string &tapePoolName,
+    const uint64_t capacityInBytes,
+    const UserIdentity &creator,
+    const std::string &comment);
+
+  /**
+   * Returns the volume identifier of the tape.
+   *
+   * @return The volume identifier of the tape.
+   */
+  const std::string &getVid() const throw();
+
+  /**
+   * Returns the name of the logical library to which the tape belongs.
+   *
+   * @return The name of the logical library to which the tape belongs.
+   */
+  const std::string &getLogicalLibraryName() const throw();
+
+  /**
+   * Returns the name of the tape pool to which the tape belongs.
+   *
+   * @return The name of the tape pool to which the tape belongs.
+   */
+  const std::string &getTapePoolName() const throw();
+
+  /**
+   * Returns the capacity of the tape.
+   *
+   * @return The capacity of the tape.
+   */
+  uint64_t getCapacityInBytes() const throw();
+
+  /**
+   * Returns the amount of data on the tape.
+   *
+   * @return The amount of data on the tape.
+   */
+  uint64_t getDataOnTapeInBytes() const throw();
+
+  /**
+   * Returns the time when the tape was created.
+   *
+   * @return The time when the tape was created.
+   */
+  time_t getCreationTime() const throw();
+
+  /**
+   * Returns the identity of the user that created the tape.
+   *
+   * @return The identity of the user that created the tape.
+   */
+  const UserIdentity &getCreator() const throw();
+
+  /**
+   * Returns the comment describing the tape.
+   *
+   * @return The comment describing the tape.
+   */
+  const std::string &getComment() const throw();
+
+private:
+
+  /**
+   * The volume identifier of the tape.
+   */
+  std::string m_vid;
+
+  /**
+   * The name of the logical library to which the tape belongs.
+   */
+  std::string m_logicalLibraryName;
+
+  /**
+   * The name of the tape pool to which the tape belongs.
+   */
+  std::string m_tapePoolName;
+
+  /**
+   * The capacity of the tape.
+   */
+  uint64_t m_capacityInBytes;
+
+  /**
+   * The amount of data on the tape.
+   */
+  uint64_t m_dataOnTapeInBytes;
+
+  /**
+   * The time when the tape was created.
+   */
+  time_t m_creationTime;
+
+  /**
+   * The identity of the user that created the tape.
+   */
+  UserIdentity m_creator;
+
+  /**
+   * Comment describing the tape.
+   */
+  std::string m_comment;
+
+}; // class Tape
+
+} // namespace cta
-- 
GitLab