OpenASIP  2.0
AssocTools.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 AssocTools.hh
26  *
27  * @author Pekka Jääskeläinen (pekka.jaaskelainen-no.spam-tut.fi) 2004-2009
28  *
29  * Tools for handling STL Associative Containers (usually set).
30  *
31  * Declarations.
32  *
33  */
34 
35 #ifndef TTA_ASSOC_TOOLS_HH
36 #define TTA_ASSOC_TOOLS_HH
37 
38 #include <set>
39 #include <utility>
40 
41 #include "Exception.hh"
42 
43 class AssocTools {
44 public:
45  template <typename ContainerType>
46  static void deleteAllItems(ContainerType& aMap);
47 
48  template <typename ContainerType>
49  static void deleteAllValues(ContainerType& aMap);
50 
51  template <typename ContainerType, typename KeyType>
52  static bool containsKey(
53  const ContainerType& aContainer,
54  const KeyType& aKey);
55 
56  template <typename ContainerType>
57  static void difference(
58  const ContainerType& firstContainer,
59  const ContainerType& secondContainer,
60  ContainerType& difference);
61 
62  template <typename ContainerType1, typename ContainerType2>
63  static std::set<std::pair<
64  typename ContainerType1::value_type,
65  typename ContainerType2::value_type> > pairs(
66  ContainerType1& firstContainer,
67  ContainerType2& secondContainer);
68 
69  template <typename Comparator,typename ContainerType1,
70  typename ContainerType2>
71  static std::set<std::pair<
72  typename ContainerType1::value_type,
73  typename ContainerType2::value_type>, Comparator > pairs(
74  ContainerType1& firstContainer,
75  ContainerType2& secondContainer);
76 
77  template <typename ContainerType>
78  static void append(const ContainerType& src, ContainerType &dest);
79 };
80 
81 #include "AssocTools.icc"
82 
83 #endif
AssocTools::difference
static void difference(const ContainerType &firstContainer, const ContainerType &secondContainer, ContainerType &difference)
AssocTools
Definition: AssocTools.hh:43
Exception.hh
AssocTools::containsKey
static bool containsKey(const ContainerType &aContainer, const KeyType &aKey)
AssocTools::deleteAllItems
static void deleteAllItems(ContainerType &aMap)
AssocTools.icc
AssocTools::append
static void append(const ContainerType &src, ContainerType &dest)
AssocTools::pairs
static std::set< std::pair< typename ContainerType1::value_type, typename ContainerType2::value_type > > pairs(ContainerType1 &firstContainer, ContainerType2 &secondContainer)
AssocTools::deleteAllValues
static void deleteAllValues(ContainerType &aMap)