OpenASIP  2.0
ContainerTools.hh
Go to the documentation of this file.
1 /*
2  Copyright (c) 2002-2009 Tampere University.
3 
4  This file is part of TTA-Based Codesign Environment (TCE).
5 
6  Permission is hereby granted, free of charge, to any person obtaining a
7  copy of this software and associated documentation files (the "Software"),
8  to deal in the Software without restriction, including without limitation
9  the rights to use, copy, modify, merge, publish, distribute, sublicense,
10  and/or sell copies of the Software, and to permit persons to whom the
11  Software is furnished to do so, subject to the following conditions:
12 
13  The above copyright notice and this permission notice shall be included in
14  all copies or substantial portions of the Software.
15 
16  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
19  THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
21  FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
22  DEALINGS IN THE SOFTWARE.
23  */
24 /**
25  * @file ContainerTools.hh
26  * @author Pekka Jääskeläinen (pjaaskel-no.spam-cs.tut.fi) 2003
27  *
28  * Tools for handling STL containers.
29  *
30  * Declarations.
31  *
32  */
33 
34 #ifndef TTA_CONTAINERTOOLS_HH
35 #define TTA_CONTAINERTOOLS_HH
36 
37 #include <vector>
38 
40 public:
41  template <typename ContainerType, typename ElementType>
42  static bool containsValue(
43  const ContainerType& aContainer, const ElementType& aKey);
44 
45  template <typename ContainerType, typename ElementType>
46  static bool removeValueIfExists(
47  ContainerType& aContainer, const ElementType& aKey);
48 
49  template <typename ContainerType, typename ElementType>
50  static bool deleteValueIfExists(
51  ContainerType& aContainer, const ElementType& aKey);
52 
53  template <typename ContainerType>
54  static void removeValues(
55  ContainerType& aContainer,
56  const ContainerType& toRemove);
57 
58  template <typename E, typename I>
59  static void swapRemoveValue(std::vector<E>& aContainer, I index);
60 };
61 
62 #include "ContainerTools.icc"
63 
64 #endif
ContainerTools::swapRemoveValue
static void swapRemoveValue(std::vector< E > &aContainer, I index)
ContainerTools::removeValues
static void removeValues(ContainerType &aContainer, const ContainerType &toRemove)
ContainerTools
Definition: ContainerTools.hh:39
ContainerTools::removeValueIfExists
static bool removeValueIfExists(ContainerType &aContainer, const ElementType &aKey)
ContainerTools.icc
ContainerTools::containsValue
static bool containsValue(const ContainerType &aContainer, const ElementType &aKey)
ContainerTools::deleteValueIfExists
static bool deleteValueIfExists(ContainerType &aContainer, const ElementType &aKey)