[nncc.foundation] Remove unused Exception class (#1131)
author박종현/동작제어Lab(SR)/Staff Engineer/삼성전자 <jh1302.park@samsung.com>
Wed, 22 Aug 2018 13:15:45 +0000 (22:15 +0900)
committerSergey Vostokov/AI Tools Lab /SRR/Staff Engineer/삼성전자 <s.vostokov@samsung.com>
Wed, 22 Aug 2018 13:15:45 +0000 (16:15 +0300)
This commit removes Exception class from nncc.foundation as there is no
code that use this class.

Signed-off-by: Jonghyun Park <jh1302.park@samsung.com>
libs/foundation/include/nncc/foundation/Exception.h [deleted file]
libs/foundation/src/Exception.cpp [deleted file]
libs/foundation/src/Exception.test.cpp [deleted file]

diff --git a/libs/foundation/include/nncc/foundation/Exception.h b/libs/foundation/include/nncc/foundation/Exception.h
deleted file mode 100644 (file)
index ae68e34..0000000
+++ /dev/null
@@ -1,40 +0,0 @@
-//
-// Created by v.cherepanov on 28.03.18.
-//
-
-#ifndef __BASEEXCEPTION_H__
-#define __BASEEXCEPTION_H__
-
-#include <vector>
-#include <string>
-#include <ostream>
-
-namespace nncc
-{
-namespace foundation
-{
-
-class Exception : public std::exception
-{
-public:
-  Exception() = default;
-  ~Exception() throw() override = default;
-
-  explicit Exception(const std::string &info);
-  explicit Exception(Exception &e, const std::string &info);
-
-  Exception &append(const std::string &info);
-  const std::vector<std::string> &getInfo() const;
-  const char *what() const throw() override;
-
-private:
-  std::vector<std::string> _info;
-  mutable std::string _sInfo;
-};
-
-std::ostream &operator<<(std::ostream &s, const Exception &e);
-
-} // namespace foundation
-} // namespace nncc
-
-#endif // __BASEEXCEPTION_H__
diff --git a/libs/foundation/src/Exception.cpp b/libs/foundation/src/Exception.cpp
deleted file mode 100644 (file)
index 8cdfcb6..0000000
+++ /dev/null
@@ -1,53 +0,0 @@
-//
-// Created by v.cherepanov@samsung.com on 28.03.18.
-//
-
-#include <string>
-#include <iostream>
-#include <stdexcept>
-
-#include "nncc/foundation/Exception.h"
-
-namespace nncc
-{
-namespace foundation
-{
-
-Exception::Exception(const std::string &info) { _info.push_back(info); }
-
-Exception::Exception(Exception &e, const std::string &info)
-{
-  for (auto errors : e.getInfo())
-  {
-    _info.push_back(errors);
-  }
-  _info.push_back(info);
-}
-
-const char *Exception::what() const throw()
-{
-  _sInfo.clear();
-  for (auto it : _info)
-    _sInfo.append(it).append("\n");
-  return _sInfo.c_str();
-}
-
-const std::vector<std::string> &Exception::getInfo() const { return _info; }
-
-Exception &Exception::append(const std::string &info)
-{
-  _info.push_back(info);
-  return *this;
-}
-
-std::ostream &operator<<(std::ostream &s, const Exception &e)
-{
-  for (auto &errors : e.getInfo())
-  {
-    s << errors << std::endl;
-  }
-  return s;
-}
-
-} // namespace foundation
-} // namespace nncc
diff --git a/libs/foundation/src/Exception.test.cpp b/libs/foundation/src/Exception.test.cpp
deleted file mode 100644 (file)
index da87317..0000000
+++ /dev/null
@@ -1,60 +0,0 @@
-#include <nncc/foundation/Exception.h>
-
-#include <gtest/gtest.h>
-
-using namespace nncc::foundation;
-
-std::string errorMsg1 = "error constructor";
-std::string errorMsg2 = "error append";
-std::string errorMsg3 = "error second constructor";
-
-std::vector<std::string> msgs = {errorMsg1, errorMsg2, errorMsg3};
-
-void err1() { throw Exception(errorMsg1); }
-
-void err2()
-{
-  try
-  {
-    err1();
-  }
-  catch (Exception &e)
-  {
-    throw e.append(errorMsg2);
-  }
-}
-
-void err3()
-{
-  try
-  {
-    err2();
-  }
-  catch (Exception &e)
-  {
-    throw Exception(e, errorMsg3);
-  }
-}
-
-TEST(FOUNDATION_EXCEPTION, Exception)
-{
-  try
-  {
-    err3();
-  }
-  catch (Exception &e)
-  {
-    ASSERT_TRUE(msgs == e.getInfo());
-
-    std::string glued;
-    const char delim[] = "\n";
-    glued.append(errorMsg1).append(delim);
-    glued.append(errorMsg2).append(delim);
-    glued.append(errorMsg3).append(delim);
-    ASSERT_TRUE(glued == e.what());
-    return;
-  }
-
-  // should not be happened
-  ASSERT_TRUE(false);
-}