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_IDL_IA_TYPE_HXX
25 #define ARY_IDL_IA_TYPE_HXX
26
27
28 // USED SERVICES
29 // BASE CLASSES
30 #include <ary/idl/ip_type.hxx>
31 // COMPONENTS
32 // PARAMETERS
33 #include "is_type.hxx"
34
35
36 namespace ary
37 {
38 namespace idl
39 {
40
41
42 class Type_Storage;
43 class CeAdmin;
44 class TemplateParamType;
45
46
47 class TypeAdmin : public TypePilot
48 {
49 public:
50 // LIFECYCLE
51 TypeAdmin();
52
53 void Assign_CePilot(
54 CeAdmin & io_rCes );
55 virtual ~TypeAdmin();
56
57 // OPERATIONS
58 TemplateParamType & Store_TemplateParamType(
59 String i_sName );
60 // INQUIRY
61 const Type_Storage &
62 Storage() const;
63 // ACCESS
64 Type_Storage & Storage();
65
66 // INHERITED
67 // Interface TypePilot:
68 virtual const Type &
69 CheckIn_Type(
70 QualifiedName & i_rFullName,
71 uintt i_nSequenceCount,
72 Ce_id i_nModuleOfOccurrence,
73 const std::vector<Type_id> *
74 i_templateParameters );
75 virtual const Type &
76 Find_Type(
77 Type_id i_nType ) const;
78 virtual String Search_LocalNameOf(
79 Type_id i_nType ) const;
80 virtual Ce_id Search_CeRelatedTo(
81 Type_id i_nType ) const;
82 virtual const ExplicitNameRoom &
83 Find_XNameRoom(
84 Type_id i_nType ) const;
85 virtual bool IsBuiltInOrRelated(
86 const Type & i_rType ) const;
87 private:
88 // Locals
89 CeAdmin & my_Ces() const;
90
91 void lhf_Put2Storage_and_AssignId(
92 DYN Type & pass_io_rType );
93
94 ExplicitNameRoom & lhf_CheckIn_XNameRoom(
95 const QualifiedName &
96 i_rName,
97 Ce_id i_nModuleOfOccurrence );
98 Type_id lhf_CheckIn_TypeName(
99 const String & i_sLocalName,
100 ExplicitNameRoom & io_rExplicitNameRoom,
101 Ce_id i_nModuleOfOccurrence,
102 const std::vector<Type_id> *
103 i_templateParameters );
104 Type_id lhf_CheckIn_Sequence(
105 Type_id i_nType );
106 void lhf_CheckIn_BuiltInType(
107 const char * i_sName,
108 Rid i_nId );
109 const ExplicitNameRoom &
110 find_ExplicitNameRoom(
111 Type_id i_nType ) const;
112 ExplicitNameRoom & find_ExplicitNameRoom(
113 Type_id i_nType );
114 ExplicitNameRoom & lhf_Get_NameRoomRoot_forModuleofOccurrence(
115 Ce_id i_nModuleOfOccurrence );
116
117 /// @return Type_id::Null_(), if not found.
118 Type_id lhf_findBuiltInType(
119 const String & i_sName );
120 /// @precond nGlobalNamespace must be valid.
121 void lhf_Setup_BuildInTypes();
122
123 // DATA
124 Type_Storage * pStorage; /// @inv pStorage != 0
125 CeAdmin * pCes; /// @inv pCes != 0
126
127 // Data for saving time:
128 Type_id nXNameRoom_Root; /** @descr This is different from nXNameRoom_Global, because
129 the root of explicit name rooms in code without leading "::" is unknown.
130 */
131 Type_id nXNameRoom_Global;
132
133 // HACK, because this needs to be saved somehow and is not in storage:
134 std::map<Ce_id, Type_id>
135 aMap_ModuleOfOccurrence2NameRoomRoot;
136 };
137
138
139
140
141
142 // IMPLEMENTATION
143 inline const Type_Storage &
Storage() const144 TypeAdmin::Storage() const
145 {
146 return *pStorage;
147 }
148
149 inline Type_Storage &
Storage()150 TypeAdmin::Storage()
151 {
152 return *pStorage;
153 }
154
155 inline void
Assign_CePilot(CeAdmin & io_rCes)156 TypeAdmin::Assign_CePilot( CeAdmin & io_rCes )
157 {
158 pCes = &io_rCes;
159 }
160
161
162
163
164 } // namespace idl
165 } // namespace ary
166 #endif
167