From 815a5aa68b80a0beb3d988e09b8fe0901355d11b Mon Sep 17 00:00:00 2001
From: Martin Beseda <martinbeseda@seznam.cz>
Date: Tue, 18 Sep 2018 00:29:58 +0200
Subject: [PATCH] NEW: Added file for definitions of own exceptions

---
 src/DataSet/DataSetSerialization.h            |  8 ++++
 src/General/ExprtkWrapperSerialization.h      |  8 ++++
 .../ConnectionFunctionGeneralSerialization.h  |  8 ++++
 .../ConnectionFunctionIdentitySerialization.h |  8 ++++
 src/Network/NeuralNetworkSerialization.h      |  8 ++++
 src/Network/NeuralNetworkSumSerialization.h   |  8 ++++
 src/Neuron/NeuronBinarySerialization.h        | 45 ++++++++++++++++++
 src/Neuron/NeuronConstantSerialization.h      | 47 +++++++++++++++++++
 src/Neuron/NeuronLinearSerialization.h        |  8 ++++
 src/Neuron/NeuronLogisticSerialization.h      |  8 ++++
 src/Neuron/NeuronSerialization.h              | 42 +++++++++++++++++
 src/exceptions.h                              | 16 +++++++
 12 files changed, 214 insertions(+)
 create mode 100644 src/DataSet/DataSetSerialization.h
 create mode 100644 src/General/ExprtkWrapperSerialization.h
 create mode 100644 src/NetConnection/ConnectionFunctionGeneralSerialization.h
 create mode 100644 src/NetConnection/ConnectionFunctionIdentitySerialization.h
 create mode 100644 src/Network/NeuralNetworkSerialization.h
 create mode 100644 src/Network/NeuralNetworkSumSerialization.h
 create mode 100644 src/Neuron/NeuronBinarySerialization.h
 create mode 100644 src/Neuron/NeuronConstantSerialization.h
 create mode 100644 src/Neuron/NeuronLinearSerialization.h
 create mode 100644 src/Neuron/NeuronLogisticSerialization.h
 create mode 100644 src/Neuron/NeuronSerialization.h
 create mode 100644 src/exceptions.h

diff --git a/src/DataSet/DataSetSerialization.h b/src/DataSet/DataSetSerialization.h
new file mode 100644
index 00000000..7e9e1b75
--- /dev/null
+++ b/src/DataSet/DataSetSerialization.h
@@ -0,0 +1,8 @@
+//
+// Created by martin on 9/18/18.
+//
+
+#ifndef LIB4NEURO_DATASETSERIALIZATION_H
+#define LIB4NEURO_DATASETSERIALIZATION_H
+
+#endif //LIB4NEURO_DATASETSERIALIZATION_H
diff --git a/src/General/ExprtkWrapperSerialization.h b/src/General/ExprtkWrapperSerialization.h
new file mode 100644
index 00000000..f53535a0
--- /dev/null
+++ b/src/General/ExprtkWrapperSerialization.h
@@ -0,0 +1,8 @@
+//
+// Created by martin on 9/17/18.
+//
+
+#ifndef LIB4NEURO_EXPRTKWRAPPERSERIALIZATION_H
+#define LIB4NEURO_EXPRTKWRAPPERSERIALIZATION_H
+
+#endif //LIB4NEURO_EXPRTKWRAPPERSERIALIZATION_H
diff --git a/src/NetConnection/ConnectionFunctionGeneralSerialization.h b/src/NetConnection/ConnectionFunctionGeneralSerialization.h
new file mode 100644
index 00000000..f0be815e
--- /dev/null
+++ b/src/NetConnection/ConnectionFunctionGeneralSerialization.h
@@ -0,0 +1,8 @@
+//
+// Created by martin on 9/17/18.
+//
+
+#ifndef LIB4NEURO_CONNECTIONFUNCTIONGENERALSERIALIZATION_H
+#define LIB4NEURO_CONNECTIONFUNCTIONGENERALSERIALIZATION_H
+
+#endif //LIB4NEURO_CONNECTIONFUNCTIONGENERALSERIALIZATION_H
diff --git a/src/NetConnection/ConnectionFunctionIdentitySerialization.h b/src/NetConnection/ConnectionFunctionIdentitySerialization.h
new file mode 100644
index 00000000..c5ce9949
--- /dev/null
+++ b/src/NetConnection/ConnectionFunctionIdentitySerialization.h
@@ -0,0 +1,8 @@
+//
+// Created by martin on 9/17/18.
+//
+
+#ifndef LIB4NEURO_CONNECTIONFUNCTIONIDENTITYSERIALIZATION_H
+#define LIB4NEURO_CONNECTIONFUNCTIONIDENTITYSERIALIZATION_H
+
+#endif //LIB4NEURO_CONNECTIONFUNCTIONIDENTITYSERIALIZATION_H
diff --git a/src/Network/NeuralNetworkSerialization.h b/src/Network/NeuralNetworkSerialization.h
new file mode 100644
index 00000000..3683a553
--- /dev/null
+++ b/src/Network/NeuralNetworkSerialization.h
@@ -0,0 +1,8 @@
+//
+// Created by martin on 9/17/18.
+//
+
+#ifndef LIB4NEURO_NEURALNETWORKSERIALIZATION_H
+#define LIB4NEURO_NEURALNETWORKSERIALIZATION_H
+
+#endif //LIB4NEURO_NEURALNETWORKSERIALIZATION_H
diff --git a/src/Network/NeuralNetworkSumSerialization.h b/src/Network/NeuralNetworkSumSerialization.h
new file mode 100644
index 00000000..55a8c76b
--- /dev/null
+++ b/src/Network/NeuralNetworkSumSerialization.h
@@ -0,0 +1,8 @@
+//
+// Created by martin on 9/17/18.
+//
+
+#ifndef LIB4NEURO_NEURALNETWORKSUMSERIALIZATION_H
+#define LIB4NEURO_NEURALNETWORKSUMSERIALIZATION_H
+
+#endif //LIB4NEURO_NEURALNETWORKSUMSERIALIZATION_H
diff --git a/src/Neuron/NeuronBinarySerialization.h b/src/Neuron/NeuronBinarySerialization.h
new file mode 100644
index 00000000..690c091d
--- /dev/null
+++ b/src/Neuron/NeuronBinarySerialization.h
@@ -0,0 +1,45 @@
+//
+// Created by martin on 9/17/18.
+//
+
+#ifndef LIB4NEURO_NEURON_BINARY_SERIALIZATION_H
+#define LIB4NEURO_NEURON_BINARY_SERIALIZATION_H
+
+#include <boost/serialization/base_object.hpp>
+#include <boost/archive/text_oarchive.hpp>
+#include <boost/archive/text_iarchive.hpp>
+#include <boost/serialization/access.hpp>
+#include <boost/serialization/export.hpp>
+
+#include "NeuronBinary.h"
+
+BOOST_CLASS_EXPORT(NeuronBinary);
+
+
+struct NeuronBinary :: access {
+    template <class Archive>
+    static void serialize(Archive &ar, NeuronBinary& n, const unsigned int version) {
+        ar & boost::serialization::base_object<Neuron>(n);
+    }
+};
+
+namespace boost {
+    namespace serialization {
+
+        /**
+         * Serialization function
+         * @tparam Archive Boost library template
+         * @param ar Boost parameter - filled automatically during serialization!
+         * @param n NeuronBinary instance
+         * @param version Boost parameter - filled automatically during serialization!
+         */
+        template<class Archive>
+        void serialize(Archive & ar, NeuronBinary& n, const unsigned int version)
+        {
+            NeuronBinary::access::serialize(ar, n, version);
+        }
+
+    } // namespace serialization
+} // namespace boost
+
+#endif //LIB4NEURO_NEURON_BINARY_SERIALIZATION_H
diff --git a/src/Neuron/NeuronConstantSerialization.h b/src/Neuron/NeuronConstantSerialization.h
new file mode 100644
index 00000000..2ca36194
--- /dev/null
+++ b/src/Neuron/NeuronConstantSerialization.h
@@ -0,0 +1,47 @@
+//
+// Created by martin on 9/17/18.
+//
+
+#ifndef LIB4NEURO_NEURON_SERIALIZATION_H
+#define LIB4NEURO_NEURON_SERIALIZATION_H
+
+#include <boost/serialization/base_object.hpp>
+#include <boost/archive/text_oarchive.hpp>
+#include <boost/archive/text_iarchive.hpp>
+#include <boost/serialization/export.hpp>
+
+#include "NeuronConstant.h"
+#include "../settings.h"
+#include "Neuron_serialization.h"
+
+BOOST_CLASS_EXPORT(NeuronConstant);
+
+
+struct NeuronConstant :: access {
+    template <class Archive>
+    static void serialize(Archive &ar, NeuronConstant& n, const unsigned int version) {
+        ar & boost::serialization::base_object<Neuron>(n);
+        ar & n.p;
+    }
+};
+
+namespace boost {
+    namespace serialization {
+
+        /**
+         * Serialization function
+         * @tparam Archive Boost library template
+         * @param ar Boost parameter - filled automatically during serialization!
+         * @param n NeuronConstant instance
+         * @param version Boost parameter - filled automatically during serialization!
+         */
+        template<class Archive>
+        void serialize(Archive & ar, NeuronConstant& n, const unsigned int version)
+        {
+            NeuronConstant::access::serialize(ar, n, version);
+        }
+
+    } // namespace serialization
+} // namespace boost
+
+#endif //LIB4NEURO_NEURON_SERIALIZATION_H
diff --git a/src/Neuron/NeuronLinearSerialization.h b/src/Neuron/NeuronLinearSerialization.h
new file mode 100644
index 00000000..e4259383
--- /dev/null
+++ b/src/Neuron/NeuronLinearSerialization.h
@@ -0,0 +1,8 @@
+//
+// Created by martin on 9/17/18.
+//
+
+#ifndef LIB4NEURO_NEURONLINEARSERIALIZATION_H
+#define LIB4NEURO_NEURONLINEARSERIALIZATION_H
+
+#endif //LIB4NEURO_NEURONLINEARSERIALIZATION_H
diff --git a/src/Neuron/NeuronLogisticSerialization.h b/src/Neuron/NeuronLogisticSerialization.h
new file mode 100644
index 00000000..723a362b
--- /dev/null
+++ b/src/Neuron/NeuronLogisticSerialization.h
@@ -0,0 +1,8 @@
+//
+// Created by martin on 9/17/18.
+//
+
+#ifndef LIB4NEURO_NEURONLOGISTICSERIALIZATION_H
+#define LIB4NEURO_NEURONLOGISTICSERIALIZATION_H
+
+#endif //LIB4NEURO_NEURONLOGISTICSERIALIZATION_H
diff --git a/src/Neuron/NeuronSerialization.h b/src/Neuron/NeuronSerialization.h
new file mode 100644
index 00000000..9fe369b9
--- /dev/null
+++ b/src/Neuron/NeuronSerialization.h
@@ -0,0 +1,42 @@
+//
+// Created by martin on 9/17/18.
+//
+
+#ifndef LIB4NEURO_NEURON_SERIALIZATION_H
+#define LIB4NEURO_NEURON_SERIALIZATION_H
+
+#include <boost/archive/text_oarchive.hpp>
+#include <boost/archive/text_iarchive.hpp>
+#include <boost/serialization/access.hpp>
+#include <boost/serialization/assume_abstract.hpp>
+
+#include "Neuron.h"
+
+BOOST_SERIALIZATION_ASSUME_ABSTRACT(Neuron);
+
+
+struct Neuron :: access {
+    template <class Archive>
+    static void serialize(Archive &ar, Neuron& n, const unsigned int version) {}
+};
+
+namespace boost {
+    namespace serialization {
+
+        /**
+         * Serialization function
+         * @tparam Archive Boost library template
+         * @param ar Boost parameter - filled automatically during serialization!
+         * @param n Neuron instance
+         * @param version Boost parameter - filled automatically during serialization!
+         */
+        template<class Archive>
+        void serialize(Archive & ar, Neuron& n, const unsigned int version)
+        {
+            Neuron::access::serialize(ar, n, version);
+        }
+
+    } // namespace serialization
+} // namespace boost
+
+#endif //LIB4NEURO_NEURON_SERIALIZATION_H
diff --git a/src/exceptions.h b/src/exceptions.h
new file mode 100644
index 00000000..0beaf7b4
--- /dev/null
+++ b/src/exceptions.h
@@ -0,0 +1,16 @@
+//
+// Created by martin on 9/17/18.
+//
+
+#ifndef LIB4NEURO_EXCEPTIONS_H
+#define LIB4NEURO_EXCEPTIONS_H
+
+//TODO implement NotImplementedException according to C++17
+//class NotImplementedException : public std::logic_error {
+//public:
+//    const char* what() {
+//        return "Function not yet implemented!";
+//    }
+//};
+
+#endif //LIB4NEURO_EXCEPTIONS_H
-- 
GitLab