xref: /trunk/main/autodoc/source/ary/idl/is_type.cxx (revision 78bc99aa)
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 #include <precomp.h>
23 #include "is_type.hxx"
24 
25 
26 // NOT FULLY DEFINED SERVICES
27 #include <cosv/tpl/tpltools.hxx>
28 
29 namespace
30 {
31 
32 const uintt
33     C_nReservedElements = ary::idl::predefined::type_MAX;    // Skipping "0" and the built in types.
34 }
35 
36 
37 namespace ary
38 {
39 namespace idl
40 {
41 
42 Type_Storage *          Type_Storage::pInstance_ = 0;
43 
44 
45 
Type_Storage()46 Type_Storage::Type_Storage()
47     :   stg::Storage<Type>(C_nReservedElements),
48         aSequenceIndex()
49 {
50     csv_assert(pInstance_ == 0);
51     pInstance_ = this;
52 }
53 
~Type_Storage()54 Type_Storage::~Type_Storage()
55 {
56     csv_assert(pInstance_ != 0);
57     pInstance_ = 0;
58 }
59 
60 void
Add_Sequence(Type_id i_nRelatedType,Type_id i_nSequence)61 Type_Storage::Add_Sequence( Type_id             i_nRelatedType,
62                             Type_id             i_nSequence )
63 {
64     aSequenceIndex[i_nRelatedType] = i_nSequence;
65 }
66 
67 Type_id
Search_SequenceOf(Type_id i_nRelatedType)68 Type_Storage::Search_SequenceOf( Type_id i_nRelatedType )
69 {
70     return csv::value_from_map(aSequenceIndex, i_nRelatedType);
71 }
72 
73 
74 
75 
76 }   // namespace idl
77 }   // namespace ary
78