1*1c78a5d6SAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3*1c78a5d6SAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4*1c78a5d6SAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5*1c78a5d6SAndrew Rist  * distributed with this work for additional information
6*1c78a5d6SAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7*1c78a5d6SAndrew Rist  * to you under the Apache License, Version 2.0 (the
8*1c78a5d6SAndrew Rist  * "License"); you may not use this file except in compliance
9*1c78a5d6SAndrew Rist  * with the License.  You may obtain a copy of the License at
10*1c78a5d6SAndrew Rist  *
11*1c78a5d6SAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12*1c78a5d6SAndrew Rist  *
13*1c78a5d6SAndrew Rist  * Unless required by applicable law or agreed to in writing,
14*1c78a5d6SAndrew Rist  * software distributed under the License is distributed on an
15*1c78a5d6SAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*1c78a5d6SAndrew Rist  * KIND, either express or implied.  See the License for the
17*1c78a5d6SAndrew Rist  * specific language governing permissions and limitations
18*1c78a5d6SAndrew Rist  * under the License.
19*1c78a5d6SAndrew Rist  *
20*1c78a5d6SAndrew Rist  *************************************************************/
21*1c78a5d6SAndrew Rist 
22*1c78a5d6SAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir #ifndef ARY_IDL_I2S_CALCULATOR_HXX
25cdf0e10cSrcweir #define ARY_IDL_I2S_CALCULATOR_HXX
26cdf0e10cSrcweir 
27cdf0e10cSrcweir 
28cdf0e10cSrcweir // USED SERVICES
29cdf0e10cSrcweir     // BASE CLASSES
30cdf0e10cSrcweir #include <cosv/tpl/processor.hxx>
31cdf0e10cSrcweir     // PARAMETERS
32cdf0e10cSrcweir #include <ary/idl/i_types4idl.hxx>
33cdf0e10cSrcweir 
34cdf0e10cSrcweir 
35cdf0e10cSrcweir namespace ary
36cdf0e10cSrcweir {
37cdf0e10cSrcweir namespace idl
38cdf0e10cSrcweir {
39cdf0e10cSrcweir     class CeAdmin;
40cdf0e10cSrcweir     class Ce_Storage;
41cdf0e10cSrcweir     class TypeAdmin;
42cdf0e10cSrcweir     class Type_Storage;
43cdf0e10cSrcweir     class Module;
44cdf0e10cSrcweir     class ExplicitType;
45cdf0e10cSrcweir     class Function;
46cdf0e10cSrcweir     class Interface;
47cdf0e10cSrcweir     class Property;
48cdf0e10cSrcweir     class Typedef;
49cdf0e10cSrcweir     class Service;
50cdf0e10cSrcweir     class Singleton;
51cdf0e10cSrcweir     class SglIfcService;
52cdf0e10cSrcweir     class SglIfcSingleton;
53cdf0e10cSrcweir     class Struct;
54cdf0e10cSrcweir     class StructElement;
55cdf0e10cSrcweir     class Exception;
56cdf0e10cSrcweir     class Ce_2s;
57cdf0e10cSrcweir }
58cdf0e10cSrcweir }
59cdf0e10cSrcweir 
60cdf0e10cSrcweir 
61cdf0e10cSrcweir 
62cdf0e10cSrcweir 
63cdf0e10cSrcweir 
64cdf0e10cSrcweir 
65cdf0e10cSrcweir namespace ary
66cdf0e10cSrcweir {
67cdf0e10cSrcweir namespace idl
68cdf0e10cSrcweir {
69cdf0e10cSrcweir 
70cdf0e10cSrcweir 
71cdf0e10cSrcweir enum E_2s_of_Service
72cdf0e10cSrcweir {
73cdf0e10cSrcweir     service_2s_IncludingServices,
74cdf0e10cSrcweir     service_2s_InstantiatingSingletons
75cdf0e10cSrcweir };
76cdf0e10cSrcweir 
77cdf0e10cSrcweir enum E_2s_of_Interface
78cdf0e10cSrcweir {
79cdf0e10cSrcweir     interface_2s_Derivations,
80cdf0e10cSrcweir     interface_2s_ExportingServices,
81cdf0e10cSrcweir     interface_2s_ExportingSingletons,
82cdf0e10cSrcweir     interface_2s_SynonymTypedefs,
83cdf0e10cSrcweir //    interface_2s_UsingTypedefs,
84cdf0e10cSrcweir     interface_2s_AsReturns,
85cdf0e10cSrcweir //    interface_2s_AsIndirectReturns,
86cdf0e10cSrcweir     interface_2s_AsParameters,
87cdf0e10cSrcweir //    interface_2s_AsIndirectParameters,
88cdf0e10cSrcweir     interface_2s_AsDataTypes
89cdf0e10cSrcweir };
90cdf0e10cSrcweir 
91cdf0e10cSrcweir enum E_2s_of_Struct
92cdf0e10cSrcweir {
93cdf0e10cSrcweir     struct_2s_Derivations,
94cdf0e10cSrcweir     struct_2s_SynonymTypedefs,
95cdf0e10cSrcweir //    struct_2s_UsingTypedefs,
96cdf0e10cSrcweir     struct_2s_AsReturns,
97cdf0e10cSrcweir //    struct_2s_AsIndirectReturns,
98cdf0e10cSrcweir     struct_2s_AsParameters,
99cdf0e10cSrcweir //    struct_2s_AsIndirectParameters,
100cdf0e10cSrcweir     struct_2s_AsDataTypes
101cdf0e10cSrcweir };
102cdf0e10cSrcweir 
103cdf0e10cSrcweir enum E_2s_of_Enum
104cdf0e10cSrcweir {
105cdf0e10cSrcweir     enum_2s_SynonymTypedefs,
106cdf0e10cSrcweir //    enum_2s_UsingTypedefs,
107cdf0e10cSrcweir     enum_2s_AsReturns,
108cdf0e10cSrcweir //    enum_2s_AsIndirectReturns,
109cdf0e10cSrcweir     enum_2s_AsParameters,
110cdf0e10cSrcweir //    enum_2s_AsIndirectParameters,
111cdf0e10cSrcweir     enum_2s_AsDataTypes
112cdf0e10cSrcweir };
113cdf0e10cSrcweir 
114cdf0e10cSrcweir enum E_2s_of_Typedef
115cdf0e10cSrcweir {
116cdf0e10cSrcweir     typedef_2s_SynonymTypedefs,
117cdf0e10cSrcweir //    typedef_2s_UsingTypedefs,
118cdf0e10cSrcweir     typedef_2s_AsReturns,
119cdf0e10cSrcweir //    typedef_2s_AsIndirectReturns,
120cdf0e10cSrcweir     typedef_2s_AsParameters,
121cdf0e10cSrcweir //    typedef_2s_AsIndirectParameters,
122cdf0e10cSrcweir     typedef_2s_AsDataTypes
123cdf0e10cSrcweir };
124cdf0e10cSrcweir 
125cdf0e10cSrcweir enum E_2s_of_Exceptions
126cdf0e10cSrcweir {
127cdf0e10cSrcweir     exception_2s_Derivations,
128cdf0e10cSrcweir     exception_2s_RaisingFunctions
129cdf0e10cSrcweir };
130cdf0e10cSrcweir 
131cdf0e10cSrcweir 
132cdf0e10cSrcweir 
133cdf0e10cSrcweir class SPInst_asHost :   public csv::ProcessorIfc,
134cdf0e10cSrcweir                         public csv::ConstProcessor<Service>,
135cdf0e10cSrcweir                         public csv::ConstProcessor<Interface>,
136cdf0e10cSrcweir                         public csv::ConstProcessor<Struct>,
137cdf0e10cSrcweir                         public csv::ConstProcessor<Exception>,
138cdf0e10cSrcweir                         public csv::ConstProcessor<Typedef>,
139cdf0e10cSrcweir                         public csv::ConstProcessor<Singleton>,
140cdf0e10cSrcweir                         public csv::ConstProcessor<Function>,
141cdf0e10cSrcweir                         public csv::ConstProcessor<StructElement>,
142cdf0e10cSrcweir                         public csv::ConstProcessor<Property>,
143cdf0e10cSrcweir                         public csv::ConstProcessor<SglIfcService>,
144cdf0e10cSrcweir                         public csv::ConstProcessor<SglIfcSingleton>
145cdf0e10cSrcweir {
146cdf0e10cSrcweir };
147cdf0e10cSrcweir 
148cdf0e10cSrcweir 
149cdf0e10cSrcweir 
150cdf0e10cSrcweir 
151cdf0e10cSrcweir /** This class scans the parsed data and produces several
152cdf0e10cSrcweir     secondary data like cross references and alphabetical indices.
153cdf0e10cSrcweir 
154cdf0e10cSrcweir     In this declaration "Secondaries" or "2s" mean those secondary data.
155cdf0e10cSrcweir 
156cdf0e10cSrcweir     @see Ce_2s
157cdf0e10cSrcweir */
158cdf0e10cSrcweir class SecondariesCalculator : public SPInst_asHost
159cdf0e10cSrcweir {
160cdf0e10cSrcweir   public:
161cdf0e10cSrcweir     // LIFECYCLE
162cdf0e10cSrcweir                         SecondariesCalculator(
163cdf0e10cSrcweir                             CeAdmin &           i_ces,
164cdf0e10cSrcweir                             TypeAdmin &         i_types );
165cdf0e10cSrcweir     virtual             ~SecondariesCalculator();
166cdf0e10cSrcweir 
167cdf0e10cSrcweir     // OPERATIONS
168cdf0e10cSrcweir     void                CheckAllInterfaceBases();
169cdf0e10cSrcweir     void                Connect_Types2Ces();
170cdf0e10cSrcweir     void                Gather_CrossReferences();
171cdf0e10cSrcweir     void                Make_Links2DeveloperManual(
172cdf0e10cSrcweir                             const String &      i_devman_reffilepath );
173cdf0e10cSrcweir 
174cdf0e10cSrcweir   private:
175cdf0e10cSrcweir     // Interface CeHost These are the points to gather cross
176cdf0e10cSrcweir     //   references:
177cdf0e10cSrcweir     virtual void        do_Process(
178cdf0e10cSrcweir                             const Service &     i_rData );
179cdf0e10cSrcweir     virtual void        do_Process(
180cdf0e10cSrcweir                             const Interface &   i_rData );
181cdf0e10cSrcweir     virtual void        do_Process(
182cdf0e10cSrcweir                             const Struct &      i_rData );
183cdf0e10cSrcweir     virtual void        do_Process(
184cdf0e10cSrcweir                             const Exception &   i_rData );
185cdf0e10cSrcweir     virtual void        do_Process(
186cdf0e10cSrcweir                             const Typedef &     i_rData );
187cdf0e10cSrcweir     virtual void        do_Process(
188cdf0e10cSrcweir                             const Singleton &   i_rData );
189cdf0e10cSrcweir     virtual void        do_Process(
190cdf0e10cSrcweir                             const Function &    i_rData );
191cdf0e10cSrcweir     virtual void        do_Process(
192cdf0e10cSrcweir                             const StructElement &
193cdf0e10cSrcweir                                                 i_rData );
194cdf0e10cSrcweir     virtual void        do_Process(
195cdf0e10cSrcweir                             const Property &    i_rData );
196cdf0e10cSrcweir     virtual void        do_Process(
197cdf0e10cSrcweir                             const SglIfcService &
198cdf0e10cSrcweir                                                 i_rData );
199cdf0e10cSrcweir     virtual void        do_Process(
200cdf0e10cSrcweir                             const SglIfcSingleton &
201cdf0e10cSrcweir                                                 i_rData );
202cdf0e10cSrcweir 
203cdf0e10cSrcweir     // Locals
204cdf0e10cSrcweir     const Ce_Storage &  my_CeStorage() const;
205cdf0e10cSrcweir     const Type_Storage &
206cdf0e10cSrcweir                         my_TypeStorage() const;
207cdf0e10cSrcweir     Ce_Storage &        my_CeStorage();
208cdf0e10cSrcweir     Type_Storage &      my_TypeStorage();
209cdf0e10cSrcweir 
210cdf0e10cSrcweir     template <class DEST>
211cdf0e10cSrcweir     DEST *              SearchCe4Type(
212cdf0e10cSrcweir                             Type_id             i_type );
213cdf0e10cSrcweir     Ce_id               lhf_Search_CeForType(
214cdf0e10cSrcweir                             const ExplicitType &
215cdf0e10cSrcweir                                                 i_rType ) const;
216cdf0e10cSrcweir     Ce_id               lhf_Search_CeFromTypeId(
217cdf0e10cSrcweir                             Type_id             i_nType ) const;
218cdf0e10cSrcweir     Service *           lhf_SearchService(
219cdf0e10cSrcweir                             Type_id             i_nServ );
220cdf0e10cSrcweir     Interface *         lhf_SearchInterface(
221cdf0e10cSrcweir                             Type_id             i_nIfc );
222cdf0e10cSrcweir     Struct *            lhf_SearchStruct(
223cdf0e10cSrcweir                             Type_id             i_nIfc );
224cdf0e10cSrcweir     Exception *         lhf_SearchException(
225cdf0e10cSrcweir                             Type_id             i_nIfc );
226cdf0e10cSrcweir     void                assign_CurLink(
227cdf0e10cSrcweir                             char *              i_text,
228cdf0e10cSrcweir                             const String &      i_link,
229cdf0e10cSrcweir                             const String &      i_linkUI,
230cdf0e10cSrcweir                             bool                i_isDescr,      /// @descr true: description, false: reference.
231cdf0e10cSrcweir                             int                 i_lineCount  );
232cdf0e10cSrcweir     void                gather_Synonyms();
233cdf0e10cSrcweir     void                recursive_AssignAsSynonym(
234cdf0e10cSrcweir                             Ce_id               i_synonymousTypedefsId,
235cdf0e10cSrcweir                             const Typedef &     i_TypedefToCheck );
236cdf0e10cSrcweir     void                recursive_AssignIncludingService(
237cdf0e10cSrcweir                             Ce_id               i_includingServicesId,
238cdf0e10cSrcweir                             const Service &     i_ServiceToCheckItsIncludes );
239cdf0e10cSrcweir     void                assign_AsDerivedInterface(
240cdf0e10cSrcweir                             const Interface &   i_rDerived );
241cdf0e10cSrcweir     void                assign_AsDerivedStruct(
242cdf0e10cSrcweir                             const Struct &      i_rDerived );
243cdf0e10cSrcweir     void                assign_AsDerivedException(
244cdf0e10cSrcweir                             const Exception &   i_rDerived );
245cdf0e10cSrcweir     void                assignImplementation_toAServicesInterfaces(
246cdf0e10cSrcweir                             Ce_id               i_nImpl,
247cdf0e10cSrcweir                             Ce_id               i_nService,
248cdf0e10cSrcweir                             E_2s_of_Interface   i_eList );
249cdf0e10cSrcweir     void                recursive_AssignImplementation_toExportedInterface(
250cdf0e10cSrcweir                             Ce_id               i_nService,
251cdf0e10cSrcweir                             Type_id             i_nExportedInterface,
252cdf0e10cSrcweir                             E_2s_of_Interface   i_eList );
253cdf0e10cSrcweir     void                recursive_AssignFunction_toCeAsReturn(
254cdf0e10cSrcweir                             Ce_id               i_nFunction,
255cdf0e10cSrcweir                             Type_id             i_nReturnType );
256cdf0e10cSrcweir     void                recursive_AssignFunction_toCeAsParameter(
257cdf0e10cSrcweir                             Ce_id               i_nFunction,
258cdf0e10cSrcweir                             Type_id             i_nParameterType );
259cdf0e10cSrcweir 
260cdf0e10cSrcweir     /** @param i_nDataElement
261cdf0e10cSrcweir         May be the ID of an struct element as well as an exception element
262cdf0e10cSrcweir         or a property.
263cdf0e10cSrcweir     */
264cdf0e10cSrcweir     void                recursive_AssignStructElement_toCeAsDataType(
265cdf0e10cSrcweir                             Ce_id               i_nDataElement,
266cdf0e10cSrcweir                             Type_id             i_nDataType );
267cdf0e10cSrcweir     void                insert_into2sList(
268cdf0e10cSrcweir                             CodeEntity &        o_out,
269cdf0e10cSrcweir                             int                 i_listIndex,
270cdf0e10cSrcweir                             Ce_id               i_nCe );
271cdf0e10cSrcweir     void                insert_into2sUnique(
272cdf0e10cSrcweir                             CodeEntity &        o_out,
273cdf0e10cSrcweir                             int                 i_listIndex,
274cdf0e10cSrcweir                             Ce_id               i_nCe );
275cdf0e10cSrcweir     /// Sorts secondary production lists alphabetical.
276cdf0e10cSrcweir     void                sort_All2s();
277cdf0e10cSrcweir 
278cdf0e10cSrcweir     void                Read_Links2DevManual(
279cdf0e10cSrcweir                             csv::bstream &      i_file );
280cdf0e10cSrcweir 
281cdf0e10cSrcweir     // DATA
282cdf0e10cSrcweir     CeAdmin *           pCes;
283cdf0e10cSrcweir     TypeAdmin *         pTypes;
284cdf0e10cSrcweir };
285cdf0e10cSrcweir 
286cdf0e10cSrcweir 
287cdf0e10cSrcweir 
288cdf0e10cSrcweir 
289cdf0e10cSrcweir }   // namespace idl
290cdf0e10cSrcweir }   // namespace ary
291cdf0e10cSrcweir #endif
292