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_SORTED_IDSET_HXX
25 #define ARY_SORTED_IDSET_HXX
26 
27 
28 
29 // USED SERVICES
30     // BASE CLASSES
31     // COMPONENTS
32 #include <set>
33     // PARAMETERS
34 #include "csi_impl.hxx"
35 
36 
37 template <class XY> class SortedIdSet;
38 
39 class Interface_2s
40 {
41   public:
42     /// Checks for double occurences
43     void                Add_ExportingService(
44                             Ce_id               i_nId );
45     void                Get_ExportingServices(
46                             Dyn_StdConstIterator<Ce_id> &
47                                                 o_rResult ) const;
48   private:
49     Dyn<SortedIdSet>    pExportingServices;
50 };
51 
52 
53 
54 namespace ary
55 {
56 
57 template <class TYPES>
58 class SortedIdSet
59 {
60   public:
61     typedef typename TYPES::element_type   element;
62     typedef typename TYPES::sort_type      sorter;
63     typedef typename TYPES::find_type      finder;
64 
SortedIdSet(const finder & i_rFinder)65                         SortedIdSet(
66                             const finder &      i_rFinder )
67                                                 : aSorter(i_rFinder),
68                                                   aData(aSorter) {}
~SortedIdSet()69                         ~SortedIdSet()          {}
70 
Get_Begin(Dyn_StdConstIterator<element> & o_rResult)71     void                Get_Begin(
72                             Dyn_StdConstIterator<element> &
73                                                 o_rResult )
74                                                 { o_rResult = new SCI_Set<FINDER>(aData); }
Add(const element & i_rElement)75     void                Add(
76                             const element &     i_rElement )
77                                                 { aData.insert(i_rElement); }
78 
79   private:
80     typedef std::set<element, sorter>       Set;
81 
82     // DATA
83     sorter              aSorter;
84     Set                 aData;
85 };
86 
87 
88 }   // namespace ary
89 
90 
91 
92 #endif
93 
94