From 00aa3c7059bc24dbc0ad4bdb70350763571569d2 Mon Sep 17 00:00:00 2001
From: Steven Murray <Steven.Murray@cern.ch>
Date: Fri, 29 May 2015 05:00:45 +0200
Subject: [PATCH] Added the SchedulerFactory ready for parameterised unit
 testing

---
 scheduler/CMakeLists.txt       |  8 +++++-
 scheduler/SchedulerFactory.cpp | 25 ++++++++++++++++++
 scheduler/SchedulerFactory.hpp | 48 ++++++++++++++++++++++++++++++++++
 3 files changed, 80 insertions(+), 1 deletion(-)
 create mode 100644 scheduler/SchedulerFactory.cpp
 create mode 100644 scheduler/SchedulerFactory.hpp

diff --git a/scheduler/CMakeLists.txt b/scheduler/CMakeLists.txt
index d5d9fa29f4..b3aece6dc2 100644
--- a/scheduler/CMakeLists.txt
+++ b/scheduler/CMakeLists.txt
@@ -59,4 +59,10 @@ add_library (ctamockschedulerdb
   MockSchedulerDatabase.cpp)
 
 target_link_libraries(ctamockschedulerdb
-  ctascedhuler)
+  ctascheduler)
+
+add_library (ctaschedulertest SHARED
+  SchedulerFactory.cpp)
+
+target_link_libraries(ctaschedulertest
+  ctamockschedulerdb)
diff --git a/scheduler/SchedulerFactory.cpp b/scheduler/SchedulerFactory.cpp
new file mode 100644
index 0000000000..f3ef1a50da
--- /dev/null
+++ b/scheduler/SchedulerFactory.cpp
@@ -0,0 +1,25 @@
+/*
+ * The CERN Tape Archive (CTA) project
+ * Copyright (C) 2015  CERN
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include "scheduler/SchedulerFactory.hpp"
+
+//------------------------------------------------------------------------------
+// destructor
+//------------------------------------------------------------------------------
+cta::SchedulerFactory::~SchedulerFactory() throw() {
+}
diff --git a/scheduler/SchedulerFactory.hpp b/scheduler/SchedulerFactory.hpp
new file mode 100644
index 0000000000..cc6a2b9aaa
--- /dev/null
+++ b/scheduler/SchedulerFactory.hpp
@@ -0,0 +1,48 @@
+/*
+ * The CERN Tape Archive (CTA) project
+ * Copyright (C) 2015  CERN
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#pragma once
+
+#include <memory>
+
+namespace cta {
+
+// Forward declarations for opaque references.
+class Scheduler;
+
+/**
+ * Asbtract class specifying the interface to a factory of scheduler objects.
+ */
+class SchedulerFactory {
+public:
+
+  /**
+   * Destructor.
+   */
+  virtual ~SchedulerFactory() throw() = 0;
+
+  /**
+   * Returns a newly created scheduler object.
+   *
+   * @return A newly created scheduler object.
+   */
+  virtual std::auto_ptr<Scheduler *> create() = 0;
+
+}; // class SchedulerFactory
+
+} // namespace cta
-- 
GitLab