1*d291ea28SAndrew Rist /**************************************************************
2cdf0e10cSrcweir *
3*d291ea28SAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one
4*d291ea28SAndrew Rist * or more contributor license agreements. See the NOTICE file
5*d291ea28SAndrew Rist * distributed with this work for additional information
6*d291ea28SAndrew Rist * regarding copyright ownership. The ASF licenses this file
7*d291ea28SAndrew Rist * to you under the Apache License, Version 2.0 (the
8*d291ea28SAndrew Rist * "License"); you may not use this file except in compliance
9*d291ea28SAndrew Rist * with the License. You may obtain a copy of the License at
10*d291ea28SAndrew Rist *
11*d291ea28SAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0
12*d291ea28SAndrew Rist *
13*d291ea28SAndrew Rist * Unless required by applicable law or agreed to in writing,
14*d291ea28SAndrew Rist * software distributed under the License is distributed on an
15*d291ea28SAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*d291ea28SAndrew Rist * KIND, either express or implied. See the License for the
17*d291ea28SAndrew Rist * specific language governing permissions and limitations
18*d291ea28SAndrew Rist * under the License.
19*d291ea28SAndrew Rist *
20*d291ea28SAndrew Rist *************************************************************/
21cdf0e10cSrcweir
22cdf0e10cSrcweir #include <precomp.h>
23cdf0e10cSrcweir #include "i2s_calculator.hxx"
24cdf0e10cSrcweir
25cdf0e10cSrcweir
26cdf0e10cSrcweir // NOT FULLY DEFINED SERVICES
27cdf0e10cSrcweir #include <algorithm>
28cdf0e10cSrcweir #include <string.h>
29cdf0e10cSrcweir #include <cosv/file.hxx>
30cdf0e10cSrcweir //#include <adc_manager.hxx>
31cdf0e10cSrcweir //#include <adc_options.hxx>
32cdf0e10cSrcweir #include <ary/qualiname.hxx>
33cdf0e10cSrcweir #include <ary/idl/i_enum.hxx>
34cdf0e10cSrcweir #include <ary/idl/i_exception.hxx>
35cdf0e10cSrcweir #include <ary/idl/i_function.hxx>
36cdf0e10cSrcweir #include <ary/idl/i_gate.hxx>
37cdf0e10cSrcweir #include <ary/idl/i_interface.hxx>
38cdf0e10cSrcweir #include <ary/idl/ik_interface.hxx>
39cdf0e10cSrcweir #include <ary/idl/i_module.hxx>
40cdf0e10cSrcweir #include <ary/idl/i_property.hxx>
41cdf0e10cSrcweir #include <ary/idl/i_service.hxx>
42cdf0e10cSrcweir #include <ary/idl/i_singleton.hxx>
43cdf0e10cSrcweir #include <ary/idl/i_siservice.hxx>
44cdf0e10cSrcweir #include <ary/idl/i_sisingleton.hxx>
45cdf0e10cSrcweir #include <ary/idl/i_struct.hxx>
46cdf0e10cSrcweir #include <ary/idl/i_structelem.hxx>
47cdf0e10cSrcweir #include <ary/idl/i_typedef.hxx>
48cdf0e10cSrcweir #include <ary/idl/ip_ce.hxx>
49cdf0e10cSrcweir #include <ary/idl/ip_type.hxx>
50cdf0e10cSrcweir #include <ary/namesort.hxx>
51cdf0e10cSrcweir #include <nametreenode.hxx>
52cdf0e10cSrcweir #include "i_nnfinder.hxx"
53cdf0e10cSrcweir #include "ia_ce.hxx"
54cdf0e10cSrcweir #include "ia_type.hxx"
55cdf0e10cSrcweir #include "is_ce.hxx"
56cdf0e10cSrcweir #include "is_type.hxx"
57cdf0e10cSrcweir #include "it_ce.hxx"
58cdf0e10cSrcweir #include "it_explicit.hxx"
59cdf0e10cSrcweir #include "it_sequence.hxx"
60cdf0e10cSrcweir #include "it_xnameroom.hxx"
61cdf0e10cSrcweir
62cdf0e10cSrcweir
63cdf0e10cSrcweir
64cdf0e10cSrcweir namespace ary
65cdf0e10cSrcweir {
66cdf0e10cSrcweir namespace idl
67cdf0e10cSrcweir {
68cdf0e10cSrcweir
69cdf0e10cSrcweir template <class DEST>
70cdf0e10cSrcweir DEST *
SearchCe4Type(Type_id i_type)71cdf0e10cSrcweir SecondariesCalculator::SearchCe4Type(Type_id i_type)
72cdf0e10cSrcweir {
73cdf0e10cSrcweir Ce_id
74cdf0e10cSrcweir ce = lhf_Search_CeFromTypeId(i_type);
75cdf0e10cSrcweir if (ce.IsValid())
76cdf0e10cSrcweir return ary_cast<DEST>(& my_CeStorage()[ce]);
77cdf0e10cSrcweir return 0;
78cdf0e10cSrcweir }
79cdf0e10cSrcweir
80cdf0e10cSrcweir
81cdf0e10cSrcweir typedef stg::const_iterator<CodeEntity> stg_citerator;
82cdf0e10cSrcweir typedef stg::iterator<CodeEntity> stg_iterator;
83cdf0e10cSrcweir
84cdf0e10cSrcweir typedef stg::filter_iterator<CodeEntity,Interface>
85cdf0e10cSrcweir interface_iterator;
86cdf0e10cSrcweir
87cdf0e10cSrcweir typedef stg::filter_iterator<Type,ExplicitType>
88cdf0e10cSrcweir explicittype_iterator;
89cdf0e10cSrcweir
90cdf0e10cSrcweir typedef ary::stg::const_filter_iterator<CodeEntity,Typedef>
91cdf0e10cSrcweir typedef_citerator;
92cdf0e10cSrcweir
93cdf0e10cSrcweir
94cdf0e10cSrcweir inline Service *
lhf_SearchService(Type_id i_nType)95cdf0e10cSrcweir SecondariesCalculator::lhf_SearchService( Type_id i_nType )
96cdf0e10cSrcweir {
97cdf0e10cSrcweir return SearchCe4Type<Service>(i_nType);
98cdf0e10cSrcweir }
99cdf0e10cSrcweir
100cdf0e10cSrcweir inline Interface *
lhf_SearchInterface(Type_id i_nType)101cdf0e10cSrcweir SecondariesCalculator::lhf_SearchInterface( Type_id i_nType )
102cdf0e10cSrcweir {
103cdf0e10cSrcweir return SearchCe4Type<Interface>(i_nType);
104cdf0e10cSrcweir }
105cdf0e10cSrcweir
106cdf0e10cSrcweir inline Struct *
lhf_SearchStruct(Type_id i_nType)107cdf0e10cSrcweir SecondariesCalculator::lhf_SearchStruct( Type_id i_nType )
108cdf0e10cSrcweir {
109cdf0e10cSrcweir return SearchCe4Type<Struct>(i_nType);
110cdf0e10cSrcweir }
111cdf0e10cSrcweir
112cdf0e10cSrcweir inline Exception *
lhf_SearchException(Type_id i_nType)113cdf0e10cSrcweir SecondariesCalculator::lhf_SearchException( Type_id i_nType )
114cdf0e10cSrcweir {
115cdf0e10cSrcweir return SearchCe4Type<Exception>(i_nType);
116cdf0e10cSrcweir }
117cdf0e10cSrcweir
118cdf0e10cSrcweir inline const Ce_Storage &
my_CeStorage() const119cdf0e10cSrcweir SecondariesCalculator::my_CeStorage() const
120cdf0e10cSrcweir {
121cdf0e10cSrcweir csv_assert(pCes != 0);
122cdf0e10cSrcweir return pCes->Storage();
123cdf0e10cSrcweir }
124cdf0e10cSrcweir
125cdf0e10cSrcweir inline const Type_Storage &
my_TypeStorage() const126cdf0e10cSrcweir SecondariesCalculator::my_TypeStorage() const
127cdf0e10cSrcweir {
128cdf0e10cSrcweir csv_assert(pTypes != 0);
129cdf0e10cSrcweir return pTypes->Storage();
130cdf0e10cSrcweir }
131cdf0e10cSrcweir
132cdf0e10cSrcweir inline Ce_Storage &
my_CeStorage()133cdf0e10cSrcweir SecondariesCalculator::my_CeStorage()
134cdf0e10cSrcweir {
135cdf0e10cSrcweir csv_assert(pCes != 0);
136cdf0e10cSrcweir return pCes->Storage();
137cdf0e10cSrcweir }
138cdf0e10cSrcweir
139cdf0e10cSrcweir inline Type_Storage &
my_TypeStorage()140cdf0e10cSrcweir SecondariesCalculator::my_TypeStorage()
141cdf0e10cSrcweir {
142cdf0e10cSrcweir csv_assert(pTypes != 0);
143cdf0e10cSrcweir return pTypes->Storage();
144cdf0e10cSrcweir }
145cdf0e10cSrcweir
146cdf0e10cSrcweir inline void
insert_into2sList(CodeEntity & o_out,int i_listIndex,Ce_id i_nCe)147cdf0e10cSrcweir SecondariesCalculator::insert_into2sList( CodeEntity & o_out,
148cdf0e10cSrcweir int i_listIndex,
149cdf0e10cSrcweir Ce_id i_nCe )
150cdf0e10cSrcweir { o_out.Secondaries().Access_List(i_listIndex).push_back(i_nCe); }
151cdf0e10cSrcweir
152cdf0e10cSrcweir
SecondariesCalculator(CeAdmin & i_ces,TypeAdmin & i_types)153cdf0e10cSrcweir SecondariesCalculator::SecondariesCalculator( CeAdmin & i_ces,
154cdf0e10cSrcweir TypeAdmin & i_types )
155cdf0e10cSrcweir : pCes(&i_ces),
156cdf0e10cSrcweir pTypes(&i_types)
157cdf0e10cSrcweir {
158cdf0e10cSrcweir }
159cdf0e10cSrcweir
~SecondariesCalculator()160cdf0e10cSrcweir SecondariesCalculator::~SecondariesCalculator()
161cdf0e10cSrcweir {
162cdf0e10cSrcweir }
163cdf0e10cSrcweir
164cdf0e10cSrcweir
165cdf0e10cSrcweir void
CheckAllInterfaceBases()166cdf0e10cSrcweir SecondariesCalculator::CheckAllInterfaceBases()
167cdf0e10cSrcweir {
168cdf0e10cSrcweir Module &
169cdf0e10cSrcweir rGlobalNamespace = pCes->GlobalNamespace();
170cdf0e10cSrcweir QualifiedName
171cdf0e10cSrcweir aXInterface("::com::sun::star::uno::XInterface","::");
172cdf0e10cSrcweir
173cdf0e10cSrcweir const Type &
174cdf0e10cSrcweir rType = pTypes->CheckIn_Type( aXInterface,
175cdf0e10cSrcweir 0,
176cdf0e10cSrcweir rGlobalNamespace.CeId(),
177cdf0e10cSrcweir 0 );
178cdf0e10cSrcweir Type_id
179cdf0e10cSrcweir nTypeXInterface = rType.TypeId();
180cdf0e10cSrcweir const ExplicitType &
181cdf0e10cSrcweir rExplType = ary_cast<ExplicitType>(rType);
182cdf0e10cSrcweir Ce_id
183cdf0e10cSrcweir nCeXInterface = lhf_Search_CeForType(rExplType);
184cdf0e10cSrcweir
185cdf0e10cSrcweir interface_iterator itEnd( my_CeStorage().End() );
186cdf0e10cSrcweir for ( interface_iterator it( my_CeStorage().BeginUnreserved() );
187cdf0e10cSrcweir it != itEnd;
188cdf0e10cSrcweir ++it )
189cdf0e10cSrcweir {
190cdf0e10cSrcweir if (NOT it.IsValid())
191cdf0e10cSrcweir continue;
192cdf0e10cSrcweir
193cdf0e10cSrcweir Interface &
194cdf0e10cSrcweir rInterface = *it;
195cdf0e10cSrcweir if ( NOT rInterface.HasBase() // According to UNO IDL syntax, an interface without base has com::sun::star::uno::XInterface as base.
196cdf0e10cSrcweir AND rInterface.CeId() != nCeXInterface ) // XInterface must not be base of itself.
197cdf0e10cSrcweir {
198cdf0e10cSrcweir rInterface.Add_Base(nTypeXInterface, 0);
199cdf0e10cSrcweir }
200cdf0e10cSrcweir } // end for
201cdf0e10cSrcweir }
202cdf0e10cSrcweir
203cdf0e10cSrcweir void
Connect_Types2Ces()204cdf0e10cSrcweir SecondariesCalculator::Connect_Types2Ces()
205cdf0e10cSrcweir {
206cdf0e10cSrcweir explicittype_iterator itEnd( my_TypeStorage().End() );
207cdf0e10cSrcweir for ( explicittype_iterator it( my_TypeStorage().BeginUnreserved() );
208cdf0e10cSrcweir it != itEnd;
209cdf0e10cSrcweir ++it )
210cdf0e10cSrcweir {
211cdf0e10cSrcweir if (NOT it.IsValid())
212cdf0e10cSrcweir continue;
213cdf0e10cSrcweir
214cdf0e10cSrcweir ExplicitType &
215cdf0e10cSrcweir rType = ary_cast<ExplicitType>(*it);
216cdf0e10cSrcweir Ce_id
217cdf0e10cSrcweir nRelatedCe = lhf_Search_CeForType(rType);
218cdf0e10cSrcweir if (nRelatedCe.IsValid())
219cdf0e10cSrcweir {
220cdf0e10cSrcweir Ce_Type *
221cdf0e10cSrcweir pNew = new Ce_Type(nRelatedCe, rType.TemplateParameters());
222cdf0e10cSrcweir my_TypeStorage().Replace_Entity( rType.TypeId(),
223cdf0e10cSrcweir *pNew );
224cdf0e10cSrcweir }
225cdf0e10cSrcweir } // end for
226cdf0e10cSrcweir }
227cdf0e10cSrcweir
228cdf0e10cSrcweir void
Gather_CrossReferences()229cdf0e10cSrcweir SecondariesCalculator::Gather_CrossReferences()
230cdf0e10cSrcweir {
231cdf0e10cSrcweir gather_Synonyms();
232cdf0e10cSrcweir
233cdf0e10cSrcweir for ( stg_iterator it = my_CeStorage().Begin();
234cdf0e10cSrcweir it != my_CeStorage().End();
235cdf0e10cSrcweir ++it )
236cdf0e10cSrcweir {
237cdf0e10cSrcweir (*it).Accept( static_cast< SPInst_asHost& >(*this) );
238cdf0e10cSrcweir
239cdf0e10cSrcweir } // end for
240cdf0e10cSrcweir
241cdf0e10cSrcweir sort_All2s();
242cdf0e10cSrcweir }
243cdf0e10cSrcweir
244cdf0e10cSrcweir void
Make_Links2DeveloperManual(const String & i_devman_reffilepath)245cdf0e10cSrcweir SecondariesCalculator::Make_Links2DeveloperManual(
246cdf0e10cSrcweir const String & i_devman_reffilepath )
247cdf0e10cSrcweir {
248cdf0e10cSrcweir // const autodoc::Options &
249cdf0e10cSrcweir // rOptions = TheAutodocManager().TheOptions();
250cdf0e10cSrcweir //
251cdf0e10cSrcweir // const String &
252cdf0e10cSrcweir // rDeveloperManual_URL
253cdf0e10cSrcweir // = rOptions.Get_Extra(autodoc::OPT_developer_guide);
254cdf0e10cSrcweir // const String
255cdf0e10cSrcweir // rDeveloperManual_ReferenceFile
256cdf0e10cSrcweir // = rOptions.Get_Extra(autodoc::OPT_developer_guide_refs_file);
257cdf0e10cSrcweir
258cdf0e10cSrcweir // if ( rDeveloperManual_URL.length() == 0
259cdf0e10cSrcweir // OR
260cdf0e10cSrcweir // rDeveloperManual_ReferenceFile.length() == 0 )
261cdf0e10cSrcweir // {
262cdf0e10cSrcweir // return;
263cdf0e10cSrcweir // }
264cdf0e10cSrcweir
265cdf0e10cSrcweir csv::File
266cdf0e10cSrcweir aFile(i_devman_reffilepath, csv::CFM_READ);
267cdf0e10cSrcweir csv::OpenCloseGuard
268cdf0e10cSrcweir aFileOpener(aFile);
269cdf0e10cSrcweir if (aFileOpener)
270cdf0e10cSrcweir {
271cdf0e10cSrcweir Read_Links2DevManual(aFile);
272cdf0e10cSrcweir }
273cdf0e10cSrcweir }
274cdf0e10cSrcweir
275cdf0e10cSrcweir namespace
276cdf0e10cSrcweir {
277cdf0e10cSrcweir
278cdf0e10cSrcweir enum E_LinkMode
279cdf0e10cSrcweir {
280cdf0e10cSrcweir link2descr,
281cdf0e10cSrcweir link2ref
282cdf0e10cSrcweir };
283cdf0e10cSrcweir
284cdf0e10cSrcweir struct OrderCeIdsByName
285cdf0e10cSrcweir {
OrderCeIdsByNameary::idl::__anond93647b00111::OrderCeIdsByName286cdf0e10cSrcweir OrderCeIdsByName(
287cdf0e10cSrcweir const Ce_Storage & i_storage )
288cdf0e10cSrcweir : rStorage(i_storage),
289cdf0e10cSrcweir aNameComparison() {}
operator ()ary::idl::__anond93647b00111::OrderCeIdsByName290cdf0e10cSrcweir bool operator()(
291cdf0e10cSrcweir Ce_id i_ce1,
292cdf0e10cSrcweir Ce_id i_ce2 ) const
293cdf0e10cSrcweir {
294cdf0e10cSrcweir return aNameComparison( rStorage[i_ce1].LocalName(),
295cdf0e10cSrcweir rStorage[i_ce2].LocalName() );
296cdf0e10cSrcweir }
297cdf0e10cSrcweir
298cdf0e10cSrcweir private:
299cdf0e10cSrcweir const Ce_Storage & rStorage;
300cdf0e10cSrcweir LesserName aNameComparison;
301cdf0e10cSrcweir };
302cdf0e10cSrcweir
303cdf0e10cSrcweir
304cdf0e10cSrcweir }
305cdf0e10cSrcweir
306cdf0e10cSrcweir
307cdf0e10cSrcweir
308cdf0e10cSrcweir void
do_Process(const Service & i_rData)309cdf0e10cSrcweir SecondariesCalculator::do_Process( const Service & i_rData )
310cdf0e10cSrcweir {
311cdf0e10cSrcweir const Service &
312cdf0e10cSrcweir rService = ary_cast<Service>(i_rData);
313cdf0e10cSrcweir
314cdf0e10cSrcweir // Interfaces:
315cdf0e10cSrcweir assignImplementation_toAServicesInterfaces( rService.CeId(),
316cdf0e10cSrcweir rService.CeId(),
317cdf0e10cSrcweir interface_2s_ExportingServices );
318cdf0e10cSrcweir // Services and their interfaces:
319cdf0e10cSrcweir recursive_AssignIncludingService(rService.CeId(), rService);
320cdf0e10cSrcweir }
321cdf0e10cSrcweir
322cdf0e10cSrcweir void
do_Process(const Interface & i_rData)323cdf0e10cSrcweir SecondariesCalculator::do_Process( const Interface & i_rData )
324cdf0e10cSrcweir {
325cdf0e10cSrcweir assign_AsDerivedInterface( ary_cast<Interface>(i_rData) );
326cdf0e10cSrcweir }
327cdf0e10cSrcweir
328cdf0e10cSrcweir void
do_Process(const Struct & i_rData)329cdf0e10cSrcweir SecondariesCalculator::do_Process( const Struct & i_rData )
330cdf0e10cSrcweir {
331cdf0e10cSrcweir assign_AsDerivedStruct( ary_cast<Struct>(i_rData) );
332cdf0e10cSrcweir }
333cdf0e10cSrcweir
334cdf0e10cSrcweir void
do_Process(const Exception & i_rData)335cdf0e10cSrcweir SecondariesCalculator::do_Process( const Exception & i_rData )
336cdf0e10cSrcweir {
337cdf0e10cSrcweir assign_AsDerivedException( ary_cast<Exception>(i_rData) );
338cdf0e10cSrcweir }
339cdf0e10cSrcweir
340cdf0e10cSrcweir void
do_Process(const Typedef &)341cdf0e10cSrcweir SecondariesCalculator::do_Process( const Typedef & )
342cdf0e10cSrcweir {
343cdf0e10cSrcweir // KORR_FUTURE
344cdf0e10cSrcweir // Find out what was meant here ???
345cdf0e10cSrcweir
346cdf0e10cSrcweir // const Typedef &
347cdf0e10cSrcweir // rTypedef = ary_cast<Typedef>(i_rData);
348cdf0e10cSrcweir }
349cdf0e10cSrcweir
350cdf0e10cSrcweir void
do_Process(const Singleton & i_rData)351cdf0e10cSrcweir SecondariesCalculator::do_Process( const Singleton & i_rData )
352cdf0e10cSrcweir {
353cdf0e10cSrcweir const Singleton &
354cdf0e10cSrcweir rSingleton = ary_cast<Singleton>(i_rData);
355cdf0e10cSrcweir
356cdf0e10cSrcweir Service *
357cdf0e10cSrcweir pServ = lhf_SearchService(rSingleton.AssociatedService());
358cdf0e10cSrcweir if (pServ != 0)
359cdf0e10cSrcweir {
360cdf0e10cSrcweir insert_into2sUnique( *pServ,
361cdf0e10cSrcweir service_2s_InstantiatingSingletons,
362cdf0e10cSrcweir rSingleton.CeId() );
363cdf0e10cSrcweir }
364cdf0e10cSrcweir
365cdf0e10cSrcweir // Interfaces:
366cdf0e10cSrcweir assignImplementation_toAServicesInterfaces( rSingleton.CeId(),
367cdf0e10cSrcweir lhf_Search_CeFromTypeId(rSingleton.AssociatedService()),
368cdf0e10cSrcweir interface_2s_ExportingSingletons );
369cdf0e10cSrcweir }
370cdf0e10cSrcweir
371cdf0e10cSrcweir void
do_Process(const SglIfcService & i_rData)372cdf0e10cSrcweir SecondariesCalculator::do_Process( const SglIfcService & i_rData )
373cdf0e10cSrcweir {
374cdf0e10cSrcweir const SglIfcService &
375cdf0e10cSrcweir rSglIfcService = ary_cast<SglIfcService>(i_rData);
376cdf0e10cSrcweir
377cdf0e10cSrcweir assignImplementation_toAServicesInterfaces( rSglIfcService.CeId(),
378cdf0e10cSrcweir rSglIfcService.CeId(),
379cdf0e10cSrcweir interface_2s_ExportingServices );
380cdf0e10cSrcweir }
381cdf0e10cSrcweir
382cdf0e10cSrcweir void
do_Process(const SglIfcSingleton & i_rData)383cdf0e10cSrcweir SecondariesCalculator::do_Process( const SglIfcSingleton & i_rData )
384cdf0e10cSrcweir {
385cdf0e10cSrcweir const SglIfcSingleton &
386cdf0e10cSrcweir rSglIfcSingleton = ary_cast<SglIfcSingleton>(i_rData);
387cdf0e10cSrcweir
388cdf0e10cSrcweir Type_id nBase = rSglIfcSingleton.BaseInterface();
389cdf0e10cSrcweir recursive_AssignImplementation_toExportedInterface( rSglIfcSingleton.CeId(),
390cdf0e10cSrcweir nBase,
391cdf0e10cSrcweir interface_2s_ExportingSingletons );
392cdf0e10cSrcweir }
393cdf0e10cSrcweir
394cdf0e10cSrcweir void
do_Process(const Function & i_rData)395cdf0e10cSrcweir SecondariesCalculator::do_Process( const Function & i_rData )
396cdf0e10cSrcweir {
397cdf0e10cSrcweir const Function &
398cdf0e10cSrcweir rFunction = ary_cast<Function>(i_rData);
399cdf0e10cSrcweir
400cdf0e10cSrcweir recursive_AssignFunction_toCeAsReturn(rFunction.CeId(), rFunction.ReturnType());
401cdf0e10cSrcweir
402cdf0e10cSrcweir for ( Function::ParamList::const_iterator itp = rFunction.Parameters().begin();
403cdf0e10cSrcweir itp != rFunction.Parameters().end();
404cdf0e10cSrcweir ++itp )
405cdf0e10cSrcweir {
406cdf0e10cSrcweir recursive_AssignFunction_toCeAsParameter(rFunction.CeId(), (*itp).Type());
407cdf0e10cSrcweir } // end for (itp)
408cdf0e10cSrcweir
409cdf0e10cSrcweir for ( Function::ExceptionList::const_iterator itx = rFunction.Exceptions().begin();
410cdf0e10cSrcweir itx != rFunction.Exceptions().end();
411cdf0e10cSrcweir ++itx )
412cdf0e10cSrcweir {
413cdf0e10cSrcweir Exception *
414cdf0e10cSrcweir pX = lhf_SearchException(*itx);
415cdf0e10cSrcweir if (pX != 0)
416cdf0e10cSrcweir {
417cdf0e10cSrcweir insert_into2sUnique(*pX, exception_2s_RaisingFunctions, rFunction.CeId());
418cdf0e10cSrcweir }
419cdf0e10cSrcweir } // end for (itx)
420cdf0e10cSrcweir }
421cdf0e10cSrcweir
422cdf0e10cSrcweir void
do_Process(const StructElement & i_rData)423cdf0e10cSrcweir SecondariesCalculator::do_Process( const StructElement & i_rData )
424cdf0e10cSrcweir {
425cdf0e10cSrcweir const StructElement &
426cdf0e10cSrcweir rStructElement = ary_cast<StructElement>(i_rData);
427cdf0e10cSrcweir
428cdf0e10cSrcweir recursive_AssignStructElement_toCeAsDataType(rStructElement.CeId(), rStructElement.Type());
429cdf0e10cSrcweir }
430cdf0e10cSrcweir
431cdf0e10cSrcweir void
do_Process(const Property & i_rData)432cdf0e10cSrcweir SecondariesCalculator::do_Process( const Property & i_rData )
433cdf0e10cSrcweir {
434cdf0e10cSrcweir const Property &
435cdf0e10cSrcweir rProperty = ary_cast<Property>(i_rData);
436cdf0e10cSrcweir
437cdf0e10cSrcweir recursive_AssignStructElement_toCeAsDataType(rProperty.CeId(), rProperty.Type());
438cdf0e10cSrcweir }
439cdf0e10cSrcweir
440cdf0e10cSrcweir Ce_id
lhf_Search_CeForType(const ExplicitType & i_rType) const441cdf0e10cSrcweir SecondariesCalculator::lhf_Search_CeForType( const ExplicitType & i_rType ) const
442cdf0e10cSrcweir {
443cdf0e10cSrcweir const ExplicitNameRoom &
444cdf0e10cSrcweir rExplicitNameRoom = ary_cast<ExplicitNameRoom>(
445cdf0e10cSrcweir my_TypeStorage()[i_rType.NameRoom()] );
446cdf0e10cSrcweir Find_ModuleNode
447cdf0e10cSrcweir rNodeFinder( my_CeStorage(),
448cdf0e10cSrcweir rExplicitNameRoom.NameChain_Begin(),
449cdf0e10cSrcweir rExplicitNameRoom.NameChain_End(),
450cdf0e10cSrcweir i_rType.Name() );
451cdf0e10cSrcweir
452cdf0e10cSrcweir if ( rExplicitNameRoom.IsAbsolute() )
453cdf0e10cSrcweir {
454cdf0e10cSrcweir const Module &
455cdf0e10cSrcweir rGlobalNamespace = ary_cast<Module>(
456cdf0e10cSrcweir my_CeStorage()[predefined::ce_GlobalNamespace]);
457cdf0e10cSrcweir return Search_SubTree( rGlobalNamespace,
458cdf0e10cSrcweir rNodeFinder );
459cdf0e10cSrcweir }
460cdf0e10cSrcweir else
461cdf0e10cSrcweir {
462cdf0e10cSrcweir const Module &
463cdf0e10cSrcweir rStartModule = ary_cast<Module>(
464cdf0e10cSrcweir my_CeStorage()[i_rType.ModuleOfOccurrence()]);
465cdf0e10cSrcweir Ce_id ret = Search_SubTree_UpTillRoot( rStartModule,
466cdf0e10cSrcweir rNodeFinder );
467cdf0e10cSrcweir return ret;
468cdf0e10cSrcweir } // endif (rExplicitNameRoom.IsAbsolute()) else
469cdf0e10cSrcweir }
470cdf0e10cSrcweir
471cdf0e10cSrcweir Ce_id
lhf_Search_CeFromTypeId(Type_id i_nType) const472cdf0e10cSrcweir SecondariesCalculator::lhf_Search_CeFromTypeId( Type_id i_nType ) const
473cdf0e10cSrcweir {
474cdf0e10cSrcweir if (NOT i_nType.IsValid())
475cdf0e10cSrcweir return Ce_id(0);
476cdf0e10cSrcweir const Ce_Type *
477cdf0e10cSrcweir pType = ary_cast<Ce_Type>( & my_TypeStorage()[i_nType] );
478cdf0e10cSrcweir return pType != 0
479cdf0e10cSrcweir ? pType->RelatedCe()
480cdf0e10cSrcweir : Ce_id_Null();
481cdf0e10cSrcweir }
482cdf0e10cSrcweir
483cdf0e10cSrcweir void
assign_CurLink(char * i_text,const String & i_link,const String & i_linkUI,bool i_isDescr,int i_lineCount)484cdf0e10cSrcweir SecondariesCalculator::assign_CurLink( char * i_text,
485cdf0e10cSrcweir const String & i_link,
486cdf0e10cSrcweir const String & i_linkUI,
487cdf0e10cSrcweir bool i_isDescr,
488cdf0e10cSrcweir int i_lineCount )
489cdf0e10cSrcweir {
490cdf0e10cSrcweir csv_assert(i_text != 0);
491cdf0e10cSrcweir
492cdf0e10cSrcweir const ary::idl::Module *
493cdf0e10cSrcweir pModule = & ary_cast<Module>(
494cdf0e10cSrcweir my_CeStorage()[predefined::ce_GlobalNamespace]);
495cdf0e10cSrcweir
496cdf0e10cSrcweir char * pPastNext = 0;
497cdf0e10cSrcweir char * pNext = i_text;
498cdf0e10cSrcweir for ( ;
499cdf0e10cSrcweir (pPastNext = strstr(pNext,".")) != 0;
500cdf0e10cSrcweir pNext = pPastNext + 1 )
501cdf0e10cSrcweir {
502cdf0e10cSrcweir String sNext(pNext, pPastNext-pNext);
503cdf0e10cSrcweir Ce_id nModule = pModule->Search_Name(sNext);
504cdf0e10cSrcweir if (nModule.IsValid())
505cdf0e10cSrcweir {
506cdf0e10cSrcweir pModule = ary_cast<Module>( & my_CeStorage()[nModule] );
507cdf0e10cSrcweir }
508cdf0e10cSrcweir else
509cdf0e10cSrcweir {
510cdf0e10cSrcweir pModule = 0;
511cdf0e10cSrcweir }
512cdf0e10cSrcweir
513cdf0e10cSrcweir if (pModule == 0)
514cdf0e10cSrcweir {
515cdf0e10cSrcweir Cerr() << "Warning: Invalid line nr. "
516cdf0e10cSrcweir << i_lineCount
517cdf0e10cSrcweir << " in DevelopersGuide reference file:\n"
518cdf0e10cSrcweir << reinterpret_cast< const char* >(i_text)
519cdf0e10cSrcweir << "\n"
520cdf0e10cSrcweir << Endl();
521cdf0e10cSrcweir return;
522cdf0e10cSrcweir }
523cdf0e10cSrcweir } // end for
524cdf0e10cSrcweir
525cdf0e10cSrcweir pPastNext = strchr(pNext,':');
526cdf0e10cSrcweir bool bMember = pPastNext != 0;
527cdf0e10cSrcweir String sCe( pNext, (bMember ? csv::str::size(pPastNext-pNext) : csv::str::maxsize) );
528cdf0e10cSrcweir
529cdf0e10cSrcweir // KORR_FUTURE
530cdf0e10cSrcweir // String sMember(bMember ? pPastNext+1, "");
531cdf0e10cSrcweir
532cdf0e10cSrcweir Ce_id nCe = pModule->Search_Name(sCe);
533cdf0e10cSrcweir if (NOT nCe.IsValid())
534cdf0e10cSrcweir {
535cdf0e10cSrcweir Cerr() << "Warning: Invalid line nr. "
536cdf0e10cSrcweir << i_lineCount
537cdf0e10cSrcweir << " in DevelopersGuide reference file:\n"
538cdf0e10cSrcweir << reinterpret_cast< const char* >(i_text)
539cdf0e10cSrcweir << "\n"
540cdf0e10cSrcweir << Endl();
541cdf0e10cSrcweir return;
542cdf0e10cSrcweir }
543cdf0e10cSrcweir
544cdf0e10cSrcweir CodeEntity &
545cdf0e10cSrcweir rCe = my_CeStorage()[nCe];
546cdf0e10cSrcweir if (NOT bMember)
547cdf0e10cSrcweir {
548cdf0e10cSrcweir if (i_isDescr)
549cdf0e10cSrcweir rCe.Secondaries().Add_Link2DescriptionInManual(i_link, i_linkUI);
550cdf0e10cSrcweir else
551cdf0e10cSrcweir rCe.Secondaries().Add_Link2RefInManual(i_link, i_linkUI);
552cdf0e10cSrcweir return;
553cdf0e10cSrcweir }
554cdf0e10cSrcweir else
555cdf0e10cSrcweir {
556cdf0e10cSrcweir // KORR_FUTURE
557cdf0e10cSrcweir // Provisorial just doing nothing (or may be
558cdf0e10cSrcweir // adding a link at main Ces lists).
559cdf0e10cSrcweir // if (i_isDescr)
560cdf0e10cSrcweir // rCe.Secondaries().Add_Link2DescriptionInManual(i_link);
561cdf0e10cSrcweir // else
562cdf0e10cSrcweir // rCe.Secondaries().Add_Link2RefInManual(i_link);
563cdf0e10cSrcweir }
564cdf0e10cSrcweir }
565cdf0e10cSrcweir
566cdf0e10cSrcweir void
gather_Synonyms()567cdf0e10cSrcweir SecondariesCalculator::gather_Synonyms()
568cdf0e10cSrcweir {
569cdf0e10cSrcweir const Ce_Storage &
570cdf0e10cSrcweir cstrg = my_CeStorage();
571cdf0e10cSrcweir typedef_citerator itEnd(cstrg.End());
572cdf0e10cSrcweir for ( typedef_citerator it(cstrg.Begin());
573cdf0e10cSrcweir it != itEnd;
574cdf0e10cSrcweir ++it )
575cdf0e10cSrcweir {
576cdf0e10cSrcweir if (NOT it.IsValid())
577cdf0e10cSrcweir continue;
578cdf0e10cSrcweir
579cdf0e10cSrcweir const Typedef &
580cdf0e10cSrcweir rTypedef = *it;
581cdf0e10cSrcweir recursive_AssignAsSynonym(rTypedef.CeId(), rTypedef);
582cdf0e10cSrcweir } // end for (itTd)
583cdf0e10cSrcweir }
584cdf0e10cSrcweir
585cdf0e10cSrcweir void
recursive_AssignAsSynonym(Ce_id i_synonymousTypedefsId,const Typedef & i_TypedefToCheck)586cdf0e10cSrcweir SecondariesCalculator::recursive_AssignAsSynonym( Ce_id i_synonymousTypedefsId,
587cdf0e10cSrcweir const Typedef & i_TypedefToCheck )
588cdf0e10cSrcweir {
589cdf0e10cSrcweir Ce_id
590cdf0e10cSrcweir nCe = lhf_Search_CeFromTypeId(i_TypedefToCheck.DefiningType());
591cdf0e10cSrcweir if (NOT nCe.IsValid())
592cdf0e10cSrcweir return;
593cdf0e10cSrcweir CodeEntity &
594cdf0e10cSrcweir rCe = my_CeStorage()[nCe];
595cdf0e10cSrcweir
596cdf0e10cSrcweir switch (rCe.AryClass()) // KORR_FUTURE: make this faster, remove switch.
597cdf0e10cSrcweir {
598cdf0e10cSrcweir case Interface::class_id:
599cdf0e10cSrcweir insert_into2sList( rCe,
600cdf0e10cSrcweir interface_2s_SynonymTypedefs,
601cdf0e10cSrcweir i_synonymousTypedefsId );
602cdf0e10cSrcweir break;
603cdf0e10cSrcweir case Struct::class_id:
604cdf0e10cSrcweir insert_into2sList( rCe,
605cdf0e10cSrcweir struct_2s_SynonymTypedefs,
606cdf0e10cSrcweir i_synonymousTypedefsId );
607cdf0e10cSrcweir break;
608cdf0e10cSrcweir case Enum::class_id:
609cdf0e10cSrcweir insert_into2sList( rCe,
610cdf0e10cSrcweir enum_2s_SynonymTypedefs,
611cdf0e10cSrcweir i_synonymousTypedefsId );
612cdf0e10cSrcweir break;
613cdf0e10cSrcweir case Typedef::class_id:
614cdf0e10cSrcweir insert_into2sList( rCe,
615cdf0e10cSrcweir typedef_2s_SynonymTypedefs,
616cdf0e10cSrcweir i_synonymousTypedefsId );
617cdf0e10cSrcweir recursive_AssignAsSynonym( i_synonymousTypedefsId,
618cdf0e10cSrcweir static_cast< Typedef& >(rCe) );
619cdf0e10cSrcweir break;
620cdf0e10cSrcweir // default: do nothing.
621cdf0e10cSrcweir }
622cdf0e10cSrcweir }
623cdf0e10cSrcweir
624cdf0e10cSrcweir void
recursive_AssignIncludingService(Ce_id i_includingServicesId,const Service & i_ServiceToCheckItsIncludes)625cdf0e10cSrcweir SecondariesCalculator::recursive_AssignIncludingService( Ce_id i_includingServicesId,
626cdf0e10cSrcweir const Service & i_ServiceToCheckItsIncludes )
627cdf0e10cSrcweir {
628cdf0e10cSrcweir Dyn_StdConstIterator<CommentedRelation>
629cdf0e10cSrcweir pIncludedServices;
630cdf0e10cSrcweir i_ServiceToCheckItsIncludes.Get_IncludedServices(pIncludedServices);
631cdf0e10cSrcweir
632cdf0e10cSrcweir for ( StdConstIterator<CommentedRelation> &
633cdf0e10cSrcweir itServ = *pIncludedServices;
634cdf0e10cSrcweir itServ;
635cdf0e10cSrcweir ++itServ )
636cdf0e10cSrcweir {
637cdf0e10cSrcweir Service *
638cdf0e10cSrcweir pServ = lhf_SearchService((*itServ).Type());
639cdf0e10cSrcweir if (pServ != 0)
640cdf0e10cSrcweir {
641cdf0e10cSrcweir insert_into2sUnique( *pServ,
642cdf0e10cSrcweir service_2s_IncludingServices,
643cdf0e10cSrcweir i_includingServicesId
644cdf0e10cSrcweir );
645cdf0e10cSrcweir recursive_AssignIncludingService(i_includingServicesId, *pServ);
646cdf0e10cSrcweir
647cdf0e10cSrcweir } // end if
648cdf0e10cSrcweir
649cdf0e10cSrcweir assignImplementation_toAServicesInterfaces( i_includingServicesId,
650cdf0e10cSrcweir lhf_Search_CeFromTypeId( (*itServ).Type() ),
651cdf0e10cSrcweir interface_2s_ExportingServices );
652cdf0e10cSrcweir } // end for
653cdf0e10cSrcweir }
654cdf0e10cSrcweir
655cdf0e10cSrcweir void
assign_AsDerivedInterface(const Interface & i_rDerived)656cdf0e10cSrcweir SecondariesCalculator::assign_AsDerivedInterface( const Interface & i_rDerived )
657cdf0e10cSrcweir {
658cdf0e10cSrcweir ary::Dyn_StdConstIterator<ary::idl::CommentedRelation>
659cdf0e10cSrcweir pHelp;
660cdf0e10cSrcweir ary::idl::ifc_interface::attr::Get_Bases(pHelp, i_rDerived);
661cdf0e10cSrcweir
662cdf0e10cSrcweir for ( ary::StdConstIterator<ary::idl::CommentedRelation> & it = *pHelp;
663cdf0e10cSrcweir it.operator bool();
664cdf0e10cSrcweir ++it )
665cdf0e10cSrcweir {
666cdf0e10cSrcweir Interface *
667cdf0e10cSrcweir pIfc = lhf_SearchInterface( (*it).Type() );
668cdf0e10cSrcweir if (pIfc == 0)
669cdf0e10cSrcweir continue;
670cdf0e10cSrcweir
671cdf0e10cSrcweir insert_into2sList( *pIfc,
672cdf0e10cSrcweir interface_2s_Derivations,
673cdf0e10cSrcweir i_rDerived.CeId() );
674cdf0e10cSrcweir } // end for
675cdf0e10cSrcweir }
676cdf0e10cSrcweir
677cdf0e10cSrcweir void
assign_AsDerivedStruct(const Struct & i_rDerived)678cdf0e10cSrcweir SecondariesCalculator::assign_AsDerivedStruct( const Struct & i_rDerived )
679cdf0e10cSrcweir {
680cdf0e10cSrcweir Type_id
681cdf0e10cSrcweir nBase = i_rDerived.Base();
682cdf0e10cSrcweir if (nBase.IsValid())
683cdf0e10cSrcweir {
684cdf0e10cSrcweir Struct *
685cdf0e10cSrcweir pParent = lhf_SearchStruct(nBase);
686cdf0e10cSrcweir if (pParent != 0)
687cdf0e10cSrcweir {
688cdf0e10cSrcweir insert_into2sList( *pParent,
689cdf0e10cSrcweir struct_2s_Derivations,
690cdf0e10cSrcweir i_rDerived.CeId() );
691cdf0e10cSrcweir }
692cdf0e10cSrcweir }
693cdf0e10cSrcweir }
694cdf0e10cSrcweir
695cdf0e10cSrcweir void
assign_AsDerivedException(const Exception & i_rDerived)696cdf0e10cSrcweir SecondariesCalculator::assign_AsDerivedException( const Exception & i_rDerived )
697cdf0e10cSrcweir {
698cdf0e10cSrcweir Type_id
699cdf0e10cSrcweir nBase = i_rDerived.Base();
700cdf0e10cSrcweir if (nBase.IsValid())
701cdf0e10cSrcweir {
702cdf0e10cSrcweir Exception *
703cdf0e10cSrcweir pParent = lhf_SearchException(nBase);
704cdf0e10cSrcweir if (pParent != 0)
705cdf0e10cSrcweir {
706cdf0e10cSrcweir insert_into2sList( *pParent,
707cdf0e10cSrcweir exception_2s_Derivations,
708cdf0e10cSrcweir i_rDerived.CeId() );
709cdf0e10cSrcweir } // end if
710cdf0e10cSrcweir } // end if
711cdf0e10cSrcweir }
712cdf0e10cSrcweir
713cdf0e10cSrcweir void
assignImplementation_toAServicesInterfaces(Ce_id i_nImpl,Ce_id i_nService,E_2s_of_Interface i_eList)714cdf0e10cSrcweir SecondariesCalculator::assignImplementation_toAServicesInterfaces(
715cdf0e10cSrcweir Ce_id i_nImpl,
716cdf0e10cSrcweir Ce_id i_nService,
717cdf0e10cSrcweir E_2s_of_Interface i_eList )
718cdf0e10cSrcweir {
719cdf0e10cSrcweir if (NOT i_nService.IsValid())
720cdf0e10cSrcweir return;
721cdf0e10cSrcweir Service *
722cdf0e10cSrcweir pService = ary_cast<Service>( & my_CeStorage()[i_nService] );
723cdf0e10cSrcweir SglIfcService *
724cdf0e10cSrcweir pSglIfcService = ary_cast<SglIfcService>( & my_CeStorage()[i_nService] );
725cdf0e10cSrcweir
726cdf0e10cSrcweir if (pService != 0)
727cdf0e10cSrcweir {
728cdf0e10cSrcweir Dyn_StdConstIterator<CommentedRelation>
729cdf0e10cSrcweir pSupportedInterfaces;
730cdf0e10cSrcweir pService->Get_SupportedInterfaces(pSupportedInterfaces);
731cdf0e10cSrcweir
732cdf0e10cSrcweir for ( StdConstIterator<CommentedRelation> &
733cdf0e10cSrcweir itInfc = *pSupportedInterfaces;
734cdf0e10cSrcweir itInfc.operator bool();
735cdf0e10cSrcweir ++itInfc )
736cdf0e10cSrcweir {
737cdf0e10cSrcweir recursive_AssignImplementation_toExportedInterface( i_nImpl,
738cdf0e10cSrcweir (*itInfc).Type(),
739cdf0e10cSrcweir i_eList );
740cdf0e10cSrcweir } // end for
741cdf0e10cSrcweir }
742cdf0e10cSrcweir else if (pSglIfcService != 0)
743cdf0e10cSrcweir {
744cdf0e10cSrcweir Type_id nBase = pSglIfcService->BaseInterface();
745cdf0e10cSrcweir recursive_AssignImplementation_toExportedInterface( i_nImpl,
746cdf0e10cSrcweir nBase,
747cdf0e10cSrcweir i_eList );
748cdf0e10cSrcweir } // end if
749cdf0e10cSrcweir }
750cdf0e10cSrcweir
751cdf0e10cSrcweir void
recursive_AssignImplementation_toExportedInterface(Ce_id i_nService,Type_id i_nExportedInterface,E_2s_of_Interface i_eList)752cdf0e10cSrcweir SecondariesCalculator::recursive_AssignImplementation_toExportedInterface(
753cdf0e10cSrcweir Ce_id i_nService,
754cdf0e10cSrcweir Type_id i_nExportedInterface,
755cdf0e10cSrcweir E_2s_of_Interface i_eList )
756cdf0e10cSrcweir {
757cdf0e10cSrcweir Interface *
758cdf0e10cSrcweir pIfc = lhf_SearchInterface(i_nExportedInterface);
759cdf0e10cSrcweir if (pIfc == 0)
760cdf0e10cSrcweir return;
761cdf0e10cSrcweir
762cdf0e10cSrcweir insert_into2sUnique( *pIfc,
763cdf0e10cSrcweir i_eList,
764cdf0e10cSrcweir i_nService );
765cdf0e10cSrcweir Dyn_StdConstIterator<CommentedRelation>
766cdf0e10cSrcweir pBases;
767cdf0e10cSrcweir ary::idl::ifc_interface::attr::Get_Bases(pBases, *pIfc);
768cdf0e10cSrcweir for ( StdConstIterator<CommentedRelation> & it = *pBases;
769cdf0e10cSrcweir it.operator bool();
770cdf0e10cSrcweir ++it )
771cdf0e10cSrcweir {
772cdf0e10cSrcweir recursive_AssignImplementation_toExportedInterface(i_nService, (*it).Type(), i_eList);
773cdf0e10cSrcweir }
774cdf0e10cSrcweir }
775cdf0e10cSrcweir
776cdf0e10cSrcweir void
recursive_AssignFunction_toCeAsReturn(Ce_id i_nFunction,Type_id i_nReturnType)777cdf0e10cSrcweir SecondariesCalculator::recursive_AssignFunction_toCeAsReturn( Ce_id i_nFunction,
778cdf0e10cSrcweir Type_id i_nReturnType )
779cdf0e10cSrcweir {
780cdf0e10cSrcweir Ce_id
781cdf0e10cSrcweir nCe = lhf_Search_CeFromTypeId(i_nReturnType);
782cdf0e10cSrcweir if (NOT nCe.IsValid())
783cdf0e10cSrcweir return;
784cdf0e10cSrcweir
785cdf0e10cSrcweir CodeEntity &
786cdf0e10cSrcweir rCe = my_CeStorage()[nCe];
787cdf0e10cSrcweir switch (rCe.AryClass()) // KORR_FUTURE: make this faster, remove switch.
788cdf0e10cSrcweir {
789cdf0e10cSrcweir case Interface::class_id:
790cdf0e10cSrcweir insert_into2sList( rCe,
791cdf0e10cSrcweir interface_2s_AsReturns,
792cdf0e10cSrcweir i_nFunction );
793cdf0e10cSrcweir break;
794cdf0e10cSrcweir case Struct::class_id:
795cdf0e10cSrcweir insert_into2sList( rCe,
796cdf0e10cSrcweir struct_2s_AsReturns,
797cdf0e10cSrcweir i_nFunction );
798cdf0e10cSrcweir break;
799cdf0e10cSrcweir case Enum::class_id:
800cdf0e10cSrcweir insert_into2sList( rCe,
801cdf0e10cSrcweir enum_2s_AsReturns,
802cdf0e10cSrcweir i_nFunction );
803cdf0e10cSrcweir break;
804cdf0e10cSrcweir case Typedef::class_id:
805cdf0e10cSrcweir insert_into2sList( rCe,
806cdf0e10cSrcweir typedef_2s_AsReturns,
807cdf0e10cSrcweir i_nFunction );
808cdf0e10cSrcweir recursive_AssignFunction_toCeAsReturn( i_nFunction,
809cdf0e10cSrcweir static_cast< Typedef& >(rCe).DefiningType() );
810cdf0e10cSrcweir break;
811cdf0e10cSrcweir // default: do nothing.
812cdf0e10cSrcweir }
813cdf0e10cSrcweir }
814cdf0e10cSrcweir
815cdf0e10cSrcweir void
recursive_AssignFunction_toCeAsParameter(Ce_id i_nFunction,Type_id i_nParameterType)816cdf0e10cSrcweir SecondariesCalculator::recursive_AssignFunction_toCeAsParameter( Ce_id i_nFunction,
817cdf0e10cSrcweir Type_id i_nParameterType )
818cdf0e10cSrcweir {
819cdf0e10cSrcweir Ce_id
820cdf0e10cSrcweir nCe = lhf_Search_CeFromTypeId(i_nParameterType);
821cdf0e10cSrcweir if (NOT nCe.IsValid())
822cdf0e10cSrcweir return;
823cdf0e10cSrcweir
824cdf0e10cSrcweir CodeEntity &
825cdf0e10cSrcweir rCe = my_CeStorage()[nCe];
826cdf0e10cSrcweir switch (rCe.AryClass()) // KORR_FUTURE: make this faster, remove switch.
827cdf0e10cSrcweir {
828cdf0e10cSrcweir case Interface::class_id:
829cdf0e10cSrcweir insert_into2sList( rCe,
830cdf0e10cSrcweir interface_2s_AsParameters,
831cdf0e10cSrcweir i_nFunction );
832cdf0e10cSrcweir break;
833cdf0e10cSrcweir case Struct::class_id:
834cdf0e10cSrcweir insert_into2sList( rCe,
835cdf0e10cSrcweir struct_2s_AsParameters,
836cdf0e10cSrcweir i_nFunction );
837cdf0e10cSrcweir break;
838cdf0e10cSrcweir case Enum::class_id:
839cdf0e10cSrcweir insert_into2sList( rCe,
840cdf0e10cSrcweir enum_2s_AsParameters,
841cdf0e10cSrcweir i_nFunction );
842cdf0e10cSrcweir break;
843cdf0e10cSrcweir case Typedef::class_id:
844cdf0e10cSrcweir insert_into2sList( rCe,
845cdf0e10cSrcweir typedef_2s_AsParameters,
846cdf0e10cSrcweir i_nFunction );
847cdf0e10cSrcweir recursive_AssignFunction_toCeAsParameter( i_nFunction,
848cdf0e10cSrcweir static_cast< Typedef& >(rCe).DefiningType() );
849cdf0e10cSrcweir break;
850cdf0e10cSrcweir // default: do nothing.
851cdf0e10cSrcweir }
852cdf0e10cSrcweir }
853cdf0e10cSrcweir
854cdf0e10cSrcweir void
recursive_AssignStructElement_toCeAsDataType(Ce_id i_nDataElement,Type_id i_nDataType)855cdf0e10cSrcweir SecondariesCalculator::recursive_AssignStructElement_toCeAsDataType( Ce_id i_nDataElement,
856cdf0e10cSrcweir Type_id i_nDataType )
857cdf0e10cSrcweir {
858cdf0e10cSrcweir Ce_id
859cdf0e10cSrcweir nCe = lhf_Search_CeFromTypeId(i_nDataType);
860cdf0e10cSrcweir if (NOT nCe.IsValid())
861cdf0e10cSrcweir return;
862cdf0e10cSrcweir
863cdf0e10cSrcweir CodeEntity &
864cdf0e10cSrcweir rCe = my_CeStorage()[nCe];
865cdf0e10cSrcweir switch (rCe.AryClass()) // KORR_FUTURE: make this faster, remove switch.
866cdf0e10cSrcweir {
867cdf0e10cSrcweir case Interface::class_id:
868cdf0e10cSrcweir insert_into2sList( rCe,
869cdf0e10cSrcweir interface_2s_AsDataTypes,
870cdf0e10cSrcweir i_nDataElement );
871cdf0e10cSrcweir break;
872cdf0e10cSrcweir case Struct::class_id:
873cdf0e10cSrcweir insert_into2sList( rCe,
874cdf0e10cSrcweir struct_2s_AsDataTypes,
875cdf0e10cSrcweir i_nDataElement );
876cdf0e10cSrcweir break;
877cdf0e10cSrcweir case Enum::class_id:
878cdf0e10cSrcweir insert_into2sList( rCe,
879cdf0e10cSrcweir enum_2s_AsDataTypes,
880cdf0e10cSrcweir i_nDataElement );
881cdf0e10cSrcweir break;
882cdf0e10cSrcweir case Typedef::class_id:
883cdf0e10cSrcweir insert_into2sList( rCe,
884cdf0e10cSrcweir typedef_2s_AsDataTypes,
885cdf0e10cSrcweir i_nDataElement );
886cdf0e10cSrcweir recursive_AssignFunction_toCeAsParameter( i_nDataElement,
887cdf0e10cSrcweir static_cast< Typedef& >(rCe).DefiningType() );
888cdf0e10cSrcweir break;
889cdf0e10cSrcweir // default: do nothing.
890cdf0e10cSrcweir } // end switch
891cdf0e10cSrcweir }
892cdf0e10cSrcweir
893cdf0e10cSrcweir void
insert_into2sUnique(CodeEntity & o_out,int i_listIndex,Ce_id i_nCe)894cdf0e10cSrcweir SecondariesCalculator::insert_into2sUnique( CodeEntity & o_out,
895cdf0e10cSrcweir int i_listIndex,
896cdf0e10cSrcweir Ce_id i_nCe )
897cdf0e10cSrcweir {
898cdf0e10cSrcweir std::vector<Ce_id> &
899cdf0e10cSrcweir rOut = o_out.Secondaries().Access_List(i_listIndex);
900cdf0e10cSrcweir if (std::find(rOut.begin(),rOut.end(),i_nCe) != rOut.end())
901cdf0e10cSrcweir return;
902cdf0e10cSrcweir rOut.push_back(i_nCe);
903cdf0e10cSrcweir }
904cdf0e10cSrcweir
905cdf0e10cSrcweir void
sort_All2s()906cdf0e10cSrcweir SecondariesCalculator::sort_All2s()
907cdf0e10cSrcweir {
908cdf0e10cSrcweir OrderCeIdsByName
909cdf0e10cSrcweir aIdOrdering(my_CeStorage());
910cdf0e10cSrcweir
911cdf0e10cSrcweir for ( stg_iterator it = my_CeStorage().Begin();
912cdf0e10cSrcweir it != my_CeStorage().End();
913cdf0e10cSrcweir ++it )
914cdf0e10cSrcweir {
915cdf0e10cSrcweir Ce_2s &
916cdf0e10cSrcweir r2s = (*it).Secondaries();
917cdf0e10cSrcweir int iCount = r2s.CountXrefLists();
918cdf0e10cSrcweir for (int i = 0; i < iCount; ++i)
919cdf0e10cSrcweir {
920cdf0e10cSrcweir std::sort( r2s.Access_List(i).begin(),
921cdf0e10cSrcweir r2s.Access_List(i).end(),
922cdf0e10cSrcweir aIdOrdering );
923cdf0e10cSrcweir } // end for (i)
924cdf0e10cSrcweir } // end for (it)
925cdf0e10cSrcweir }
926cdf0e10cSrcweir
927cdf0e10cSrcweir void
Read_Links2DevManual(csv::bstream & i_file)928cdf0e10cSrcweir SecondariesCalculator::Read_Links2DevManual( csv::bstream & i_file )
929cdf0e10cSrcweir {
930cdf0e10cSrcweir StreamLock aLine(300);
931cdf0e10cSrcweir StreamStr & rLine = aLine();
932cdf0e10cSrcweir
933cdf0e10cSrcweir
934cdf0e10cSrcweir String sCurLink;
935cdf0e10cSrcweir String sCurLinkUI;
936cdf0e10cSrcweir E_LinkMode eCurMode = link2ref;
937cdf0e10cSrcweir
938cdf0e10cSrcweir int lineCount = 0;
939cdf0e10cSrcweir const char * sLink = "LINK:";
940cdf0e10cSrcweir const char * sDescr = "DESCR:";
941cdf0e10cSrcweir const char * sTopic = "TOPIC:";
942cdf0e10cSrcweir const char * sRef = "REF:";
943cdf0e10cSrcweir const UINT8 cMaxASCIINumWhiteSpace = 32;
944cdf0e10cSrcweir
945cdf0e10cSrcweir while (NOT i_file.eod())
946cdf0e10cSrcweir {
947cdf0e10cSrcweir ++lineCount;
948cdf0e10cSrcweir
949cdf0e10cSrcweir rLine.reset();
950cdf0e10cSrcweir rLine.operator_read_line(i_file);
951cdf0e10cSrcweir
952cdf0e10cSrcweir if ( *rLine.c_str() >= 'a' )
953cdf0e10cSrcweir {
954cdf0e10cSrcweir assign_CurLink(rLine.begin(), sCurLink, sCurLinkUI, eCurMode == link2descr, lineCount);
955cdf0e10cSrcweir }
956cdf0e10cSrcweir else if ( strncmp(rLine.c_str(), sLink, strlen(sLink)) == 0 )
957cdf0e10cSrcweir {
958cdf0e10cSrcweir sCurLink = rLine.c_str()+5;
959cdf0e10cSrcweir sCurLinkUI.clear();
960cdf0e10cSrcweir }
961cdf0e10cSrcweir else if ( strncmp(rLine.c_str(), sDescr, strlen(sDescr)) == 0 )
962cdf0e10cSrcweir {
963cdf0e10cSrcweir sCurLinkUI = rLine.c_str()+6;
964cdf0e10cSrcweir }
965cdf0e10cSrcweir else if ( strncmp(rLine.c_str(), sTopic, strlen(sTopic)) == 0 )
966cdf0e10cSrcweir {
967cdf0e10cSrcweir eCurMode = link2descr;
968cdf0e10cSrcweir }
969cdf0e10cSrcweir else if ( strncmp(rLine.c_str(), sRef, strlen(sRef)) == 0 )
970cdf0e10cSrcweir {
971cdf0e10cSrcweir eCurMode = link2ref;
972cdf0e10cSrcweir }
973cdf0e10cSrcweir else if (static_cast<UINT8>(*rLine.c_str()) > cMaxASCIINumWhiteSpace)
974cdf0e10cSrcweir {
975cdf0e10cSrcweir assign_CurLink(rLine.begin(), sCurLink, sCurLinkUI, eCurMode == link2descr, lineCount);
976cdf0e10cSrcweir }
977cdf0e10cSrcweir // else
978cdf0e10cSrcweir // Ignore empty line.
979cdf0e10cSrcweir
980cdf0e10cSrcweir } // end while
981cdf0e10cSrcweir }
982cdf0e10cSrcweir
983cdf0e10cSrcweir
984cdf0e10cSrcweir
985cdf0e10cSrcweir } // namespace idl
986cdf0e10cSrcweir } // namespace ary
987