From 50f10eb100a600467a3e6b64c9fcd083249e7829 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Christoph=20Gr=C3=BCninger?= <gruenich@dune-project.org>
Date: Sun, 10 Jun 2012 13:00:10 +0000
Subject: [PATCH] Remove deprecated finitestack.

[[Imported from SVN: r6795]]
---
 dune/common/Makefile.am        |  1 -
 dune/common/finitestack.hh     | 71 -------------------------------
 dune/common/test/.gitignore    |  2 -
 dune/common/test/Makefile.am   |  3 --
 dune/common/test/test-stack.cc | 77 ----------------------------------
 5 files changed, 154 deletions(-)
 delete mode 100644 dune/common/finitestack.hh
 delete mode 100644 dune/common/test/test-stack.cc

diff --git a/dune/common/Makefile.am b/dune/common/Makefile.am
index a347cdfef..0f6526ddd 100644
--- a/dune/common/Makefile.am
+++ b/dune/common/Makefile.am
@@ -36,7 +36,6 @@ commoninclude_HEADERS = 			\
 	enumset.hh				\
 	exceptions.hh				\
 	fassign.hh				\
-	finitestack.hh				\
 	float_cmp.cc				\
 	float_cmp.hh				\
 	fmatrix.hh				\
diff --git a/dune/common/finitestack.hh b/dune/common/finitestack.hh
deleted file mode 100644
index cae691246..000000000
--- a/dune/common/finitestack.hh
+++ /dev/null
@@ -1,71 +0,0 @@
-// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
-// vi: set et ts=4 sw=2 sts=2:
-#ifndef DUNE_FINITE_STACK_HH
-#define DUNE_FINITE_STACK_HH
-
-/** \file
- * \brief Stack class of fixed maximum size (deprecated)
- */
-
-#warning This file is deprecated and will be removed after the release of dune-common-2.2.\
-  Please use std::stack<Dune::ReservedVector> instead of FiniteStack.
-
-#include <stack>
-
-#include <dune/common/exceptions.hh>
-#include <dune/common/reservedvector.hh>
-
-namespace Dune {
-
-  /*! \addtogroup Common
-     @{
-   */
-
-  /*! \file
-
-     This file implements a stack classes FiniteStack. It is
-     mainly used by the grid iterators where exact knowledge of the stack
-     implementation is needed to guarantee efficient execution.
-   */
-
-  /** \brief A stack with static memory allocation
-   *
-     This class implements a very efficient stack where the maximum
-     depth is known in advance. Note that no error checking is
-     performed!
-
-     \param n Maximum number of stack entries
-   */
-  template<class T, int n>
-  class FiniteStack
-    : public std::stack<T, Dune::ReservedVector<T,n> >
-  {
-  public:
-
-    //! Returns true if the stack is full
-    bool full () const
-    {
-      return this->size()>=n;
-    }
-
-    /** Removes and returns the uppermost object from the stack
-       \warning This differs from the semantics of std::stack, where pop() returns void
-     */
-    T pop ()
-    {
-#ifndef NDEBUG
-      if (this->empty())
-        DUNE_THROW(Dune::RangeError, "trying to call pop() on an empty FiniteStack");
-#endif
-      T tmp = this->top();
-      this->std::stack<T,Dune::ReservedVector<T,n> >::pop();
-      return tmp;
-    }
-
-  };
-
-}
-
-//! }@
-
-#endif
diff --git a/dune/common/test/.gitignore b/dune/common/test/.gitignore
index 0b0201596..70a8d48c0 100644
--- a/dune/common/test/.gitignore
+++ b/dune/common/test/.gitignore
@@ -7,7 +7,6 @@ dynvectortest
 fvectortest
 mpicollectivecommunication
 lrutest
-test-stack
 arraylisttest
 shared_ptrtest
 testfloatcmp
@@ -44,7 +43,6 @@ testfassign1
 testfassign2
 testfassign3
 testfassign4
-smallobject
 conversiontest
 nullptr-test
 blockbitfieldtest
diff --git a/dune/common/test/Makefile.am b/dune/common/test/Makefile.am
index 660215753..3ba9f71f7 100644
--- a/dune/common/test/Makefile.am
+++ b/dune/common/test/Makefile.am
@@ -31,7 +31,6 @@ TESTPROGS = \
     singletontest \
     static_assert_test \
     streamtest \
-    test-stack \
     testfassign1 \
     testfassign2 \
     testfassign3 \
@@ -114,8 +113,6 @@ lrutest_SOURCES = lrutest.cc
 
 sllisttest_SOURCES = sllisttest.cc
 
-test_stack_SOURCES = test-stack.cc
-
 arraylisttest_SOURCES = arraylisttest.cc
 
 arraytest_SOURCES = arraytest.cc
diff --git a/dune/common/test/test-stack.cc b/dune/common/test/test-stack.cc
deleted file mode 100644
index a75d14f04..000000000
--- a/dune/common/test/test-stack.cc
+++ /dev/null
@@ -1,77 +0,0 @@
-// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
-// vi: set et ts=4 sw=2 sts=2:
-// $Id$
-
-#ifdef NDEBUG
-#warning "Disabling NDEBUG for this test, otherwise it will fail!"
-#undef NDEBUG
-#endif
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include <cassert>
-#include <iostream>
-
-#include <dune/common/finitestack.hh>
-
-// stack depth to test
-static const int MAX = 100;
-
-template <class SType>
-void exercise_stack (SType &S) {
-  assert(S.empty());
-
-  // fill stack to maximum
-  for (int i = 0; i < MAX; ++i) {
-    assert(! S.full());
-    S.push(i);
-    assert(! S.empty());
-  };
-
-  for (int i = MAX - 1; i >= 0; --i) {
-    int x = S.top();
-    int y = S.pop();
-    assert(x == i);
-    assert(y == i);
-  };
-
-  assert(S.empty());
-}
-
-int main () {
-  // initialize stack, push stuff and check if it comes out again
-  Dune::FiniteStack<int, MAX> fixedstack;
-  exercise_stack(fixedstack);
-
-  // check error handling of Stack
-  try {
-    Dune::FiniteStack<int, MAX> stack1;
-
-    assert(stack1.empty());
-    stack1.pop();
-
-    // exception has to happen
-    // make sure you compile this test without NDEBUG
-    std::cerr << "Expected exception Dune::RangeError, but nothing caught\n";
-    return 1;
-  } catch (Dune::RangeError &e) {
-    // exception was correctly reported
-    std::cerr << "Caught expected Dune::RangeError: " << e.what() << std::endl;
-    return 0;
-  } catch (Dune::Exception &e) {
-    // exception was correctly reported
-    std::cerr << "Dune::Exception: " << e.what() << std::endl;
-    return 1;
-  } catch (std::exception &e) {
-    // exception was correctly reported
-    std::cerr << "std::exception: " << e.what() << std::endl;
-    return 1;
-  } catch (...) {
-    // wrong type of exception
-    std::cerr << "unknown exception\n";
-    return 1;
-  }
-
-}
-- 
GitLab