1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 #ifndef ARY_CROSS_REFS_HXX
25 #define ARY_CROSS_REFS_HXX
26 
27 
28 
29 // USED SERVICES
30     // BASE CLASSES
31     // COMPONENTS
32     // PARAMETERS
33 #include "sorted_idset.hxx"
34 
35 
36 template <class VALUE_LIST, class TYPES>
37 class CrossReferences
38 {
39   public:
40     typedef TYPES::element_type         element;
41 
42     /// Checks for double occurences
43     void                Add(
44                             VALUE_LIST::index_type
45                                             	i_nPosition
46                             const element &     i_rElem );
47     void                Get_List(
48                             Dyn_StdConstIterator<element> &
49                                                 o_rResult ) const;
50   private:
51     SortedIdSet<TYPES>  aData[VALUE_LIST::max];
52 };
53 
54 
55 
56 namespace ary
57 {
58 
59 template <class TYPES>
60 class SortedIdSet
61 {
62   public:
63     typedef typename TYPES::element_type   element;
64     typedef typename TYPES::sort_type      sorter;
65     typedef typename TYPES::find_type      finder;
66 
67                         SortedIdSet(
68                             const finder &      i_rFinder )
69                                                 : aSorter(i_rFinder),
70                                                   aData(aSorter) {}
71                         ~SortedIdSet()          {}
72 
73     void                Get_Begin(
74                             Dyn_StdConstIterator<element> &
75                                                 o_rResult )
76                                                 { o_rResult = new SCI_Set<FINDER>(aData); }
77     void                Add(
78                             const element &     i_rElement )
79                                                 { aData.insert(i_rElement); }
80 
81   private:
82     typedef std::set<element, sorter>       Set;
83 
84     // DATA
85     sorter              aSorter;
86     Set                 aData;
87 };
88 
89 
90 }   // namespace ary
91 
92 
93 
94 #endif
95 
96