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 10cdf0e10cSrcweir * 11*d291ea28SAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0 12cdf0e10cSrcweir * 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. 19cdf0e10cSrcweir * 20*d291ea28SAndrew Rist *************************************************************/ 21cdf0e10cSrcweir 22cdf0e10cSrcweir #include <precomp.h> 23cdf0e10cSrcweir #include "c_reposypart.hxx" 24cdf0e10cSrcweir 25cdf0e10cSrcweir 26cdf0e10cSrcweir // NOT FULLY DECLARED SERVICES 27cdf0e10cSrcweir #include <ary/getncast.hxx> 28cdf0e10cSrcweir #include <ary/namesort.hxx> 29cdf0e10cSrcweir #include <ary/cpp/c_builtintype.hxx> 30cdf0e10cSrcweir #include <ary/cpp/c_class.hxx> 31cdf0e10cSrcweir #include <ary/cpp/c_cppentity.hxx> 32cdf0e10cSrcweir #include <ary/cpp/c_define.hxx> 33cdf0e10cSrcweir #include <ary/cpp/c_enum.hxx> 34cdf0e10cSrcweir #include <ary/cpp/c_enuval.hxx> 35cdf0e10cSrcweir #include <ary/cpp/c_funct.hxx> 36cdf0e10cSrcweir #include <ary/cpp/c_macro.hxx> 37cdf0e10cSrcweir #include <ary/cpp/c_namesp.hxx> 38cdf0e10cSrcweir #include <ary/cpp/c_tydef.hxx> 39cdf0e10cSrcweir #include <ary/cpp/c_type.hxx> 40cdf0e10cSrcweir #include <ary/cpp/usedtype.hxx> 41cdf0e10cSrcweir #include <ary/cpp/c_vari.hxx> 42cdf0e10cSrcweir #include <ary/loc/locp_le.hxx> 43cdf0e10cSrcweir #include <ary/getncast.hxx> 44cdf0e10cSrcweir #include <loc_internalgate.hxx> 45cdf0e10cSrcweir #include <reposy.hxx> 46cdf0e10cSrcweir #include "ca_ce.hxx" 47cdf0e10cSrcweir #include "ca_def.hxx" 48cdf0e10cSrcweir #include "ca_type.hxx" 49cdf0e10cSrcweir #include "cs_ce.hxx" 50cdf0e10cSrcweir #include "cs_def.hxx" 51cdf0e10cSrcweir #include "cs_type.hxx" 52cdf0e10cSrcweir 53cdf0e10cSrcweir 54cdf0e10cSrcweir 55cdf0e10cSrcweir namespace 56cdf0e10cSrcweir { 57cdf0e10cSrcweir 58cdf0e10cSrcweir using ::ary::GlobalId; 59cdf0e10cSrcweir using ::ary::Rid; 60cdf0e10cSrcweir using namespace ::ary::cpp; 61cdf0e10cSrcweir 62cdf0e10cSrcweir 63cdf0e10cSrcweir inline bool 64cdf0e10cSrcweir IsDefine( const GlobalId & i_id ) 65cdf0e10cSrcweir { 66cdf0e10cSrcweir return i_id.Class() == Define::class_id 67cdf0e10cSrcweir OR 68cdf0e10cSrcweir i_id.Class() == Macro::class_id; 69cdf0e10cSrcweir } 70cdf0e10cSrcweir 71cdf0e10cSrcweir 72cdf0e10cSrcweir /// Find Ces 73cdf0e10cSrcweir class TypeConnector 74cdf0e10cSrcweir { 75cdf0e10cSrcweir public: 76cdf0e10cSrcweir TypeConnector( 77cdf0e10cSrcweir Gate & i_gate ) 78cdf0e10cSrcweir : pGate(&i_gate) {} 79cdf0e10cSrcweir ~TypeConnector() {} 80cdf0e10cSrcweir 81cdf0e10cSrcweir void operator()( 82cdf0e10cSrcweir Type & io_rType ) const; 83cdf0e10cSrcweir private: 84cdf0e10cSrcweir // DATA 85cdf0e10cSrcweir Gate * pGate; 86cdf0e10cSrcweir }; 87cdf0e10cSrcweir 88cdf0e10cSrcweir /// Find Ces only known from base class name scope. 89cdf0e10cSrcweir class TypeConnector2ndTry 90cdf0e10cSrcweir { 91cdf0e10cSrcweir public: 92cdf0e10cSrcweir TypeConnector2ndTry( 93cdf0e10cSrcweir Gate & i_gate ) 94cdf0e10cSrcweir : pGate(&i_gate) {} 95cdf0e10cSrcweir ~TypeConnector2ndTry() {} 96cdf0e10cSrcweir 97cdf0e10cSrcweir void operator()( 98cdf0e10cSrcweir Type & io_rType ) const; 99cdf0e10cSrcweir private: 100cdf0e10cSrcweir // DATA 101cdf0e10cSrcweir Gate * pGate; 102cdf0e10cSrcweir }; 103cdf0e10cSrcweir 104cdf0e10cSrcweir /// Reconnect (in both directions) base-derived relations of classes. 105cdf0e10cSrcweir class HierarchyLinker 106cdf0e10cSrcweir { 107cdf0e10cSrcweir public: 108cdf0e10cSrcweir HierarchyLinker( 109cdf0e10cSrcweir Gate & i_gate ) 110cdf0e10cSrcweir : pGate(&i_gate) {} 111cdf0e10cSrcweir 112cdf0e10cSrcweir ~HierarchyLinker() {} 113cdf0e10cSrcweir 114cdf0e10cSrcweir void operator()( 115cdf0e10cSrcweir Class & io_rCe ) const; 116cdf0e10cSrcweir private: 117cdf0e10cSrcweir // DATA 118cdf0e10cSrcweir Gate * pGate; 119cdf0e10cSrcweir }; 120cdf0e10cSrcweir 121cdf0e10cSrcweir 122cdf0e10cSrcweir 123cdf0e10cSrcweir /// Helper functor for ->RepositoryPartition::Get_AlphabeticalList(). 124cdf0e10cSrcweir template <class TRAITS> 125cdf0e10cSrcweir struct MakeGlobalId 126cdf0e10cSrcweir { 127cdf0e10cSrcweir GlobalId operator()( 128cdf0e10cSrcweir typename TRAITS::id_type 129cdf0e10cSrcweir i_id ) const 130cdf0e10cSrcweir { 131cdf0e10cSrcweir return GlobalId( TRAITS::EntityOf_(i_id).AryClass(), 132cdf0e10cSrcweir i_id.Value() ); 133cdf0e10cSrcweir } 134cdf0e10cSrcweir }; 135cdf0e10cSrcweir 136cdf0e10cSrcweir 137cdf0e10cSrcweir 138cdf0e10cSrcweir 139cdf0e10cSrcweir /** Compare two {->GlobalId}s. 140cdf0e10cSrcweir 141cdf0e10cSrcweir 142cdf0e10cSrcweir @todo Move this up to the definition of GlobalId<>. 143cdf0e10cSrcweir */ 144cdf0e10cSrcweir struct LesserGlobal 145cdf0e10cSrcweir { 146cdf0e10cSrcweir LesserGlobal( 147cdf0e10cSrcweir const Ce_Storage & i_ces, 148cdf0e10cSrcweir const Def_Storage & i_des ) 149cdf0e10cSrcweir : rCes(i_ces), rDes(i_des) {} 150cdf0e10cSrcweir 151cdf0e10cSrcweir bool operator()( 152cdf0e10cSrcweir GlobalId i_1, 153cdf0e10cSrcweir GlobalId i_2 ) const; 154cdf0e10cSrcweir 155cdf0e10cSrcweir private: 156cdf0e10cSrcweir const String & NameOf( 157cdf0e10cSrcweir GlobalId i_id ) const; 158cdf0e10cSrcweir // DATA 159cdf0e10cSrcweir const Ce_Storage & rCes; 160cdf0e10cSrcweir const Def_Storage & rDes; 161cdf0e10cSrcweir ::ary::LesserName aLess; 162cdf0e10cSrcweir }; 163cdf0e10cSrcweir 164cdf0e10cSrcweir 165cdf0e10cSrcweir bool 166cdf0e10cSrcweir LesserGlobal::operator()( GlobalId i_1, 167cdf0e10cSrcweir GlobalId i_2 ) const 168cdf0e10cSrcweir { 169cdf0e10cSrcweir String s1 = NameOf(i_1); 170cdf0e10cSrcweir String s2 = NameOf(i_2); 171cdf0e10cSrcweir 172cdf0e10cSrcweir if (s1 != s2) 173cdf0e10cSrcweir return aLess(s1, s2); 174cdf0e10cSrcweir 175cdf0e10cSrcweir if ( IsDefine(i_1) != IsDefine(i_2) ) 176cdf0e10cSrcweir { 177cdf0e10cSrcweir return NOT IsDefine(i_2); 178cdf0e10cSrcweir } 179cdf0e10cSrcweir else if (IsDefine(i_1)) 180cdf0e10cSrcweir { 181cdf0e10cSrcweir return i_1.Class() < i_2.Class(); 182cdf0e10cSrcweir } 183cdf0e10cSrcweir 184cdf0e10cSrcweir return Ce_GlobalCompare::Lesser_( 185cdf0e10cSrcweir rCes[i_1.Id()], 186cdf0e10cSrcweir rCes[i_2.Id()] ); 187cdf0e10cSrcweir } 188cdf0e10cSrcweir 189cdf0e10cSrcweir 190cdf0e10cSrcweir } // namespace anonymous 191cdf0e10cSrcweir 192cdf0e10cSrcweir 193cdf0e10cSrcweir 194cdf0e10cSrcweir 195cdf0e10cSrcweir 196cdf0e10cSrcweir 197cdf0e10cSrcweir namespace ary 198cdf0e10cSrcweir { 199cdf0e10cSrcweir namespace cpp 200cdf0e10cSrcweir { 201cdf0e10cSrcweir 202cdf0e10cSrcweir DYN InternalGate & 203cdf0e10cSrcweir InternalGate::Create_Partition_(RepositoryCenter & i_center) 204cdf0e10cSrcweir { 205cdf0e10cSrcweir return *new RepositoryPartition(i_center); 206cdf0e10cSrcweir } 207cdf0e10cSrcweir 208cdf0e10cSrcweir 209cdf0e10cSrcweir RepositoryPartition::RepositoryPartition(RepositoryCenter & i_center) 210cdf0e10cSrcweir : pRepositoryCenter(&i_center), 211cdf0e10cSrcweir pCes(0), 212cdf0e10cSrcweir pTypes(0), 213cdf0e10cSrcweir pDefs(0), 214cdf0e10cSrcweir pLocations(& loc::InternalGate::Create_Locations_()) 215cdf0e10cSrcweir { 216cdf0e10cSrcweir pCes = new CeAdmin(*this); 217cdf0e10cSrcweir pTypes = new TypeAdmin(*this); 218cdf0e10cSrcweir pDefs = new DefAdmin(*this); 219cdf0e10cSrcweir pCes->Set_Related(*pTypes); 220cdf0e10cSrcweir } 221cdf0e10cSrcweir 222cdf0e10cSrcweir RepositoryPartition::~RepositoryPartition() 223cdf0e10cSrcweir { 224cdf0e10cSrcweir } 225cdf0e10cSrcweir 226cdf0e10cSrcweir void 227cdf0e10cSrcweir RepositoryPartition::Calculate_AllSecondaryInformation() 228cdf0e10cSrcweir // const ::autodoc::Options & ) 229cdf0e10cSrcweir { 230cdf0e10cSrcweir // KORR_FUTURE 231cdf0e10cSrcweir // Forward the options from here. 232cdf0e10cSrcweir 233cdf0e10cSrcweir Connect_AllTypes_2_TheirRelated_CodeEntites(); 234cdf0e10cSrcweir } 235cdf0e10cSrcweir 236cdf0e10cSrcweir const String & 237cdf0e10cSrcweir RepositoryPartition::RepositoryTitle() const 238cdf0e10cSrcweir { 239cdf0e10cSrcweir return static_cast< ary::Repository* >(pRepositoryCenter)->Title(); 240cdf0e10cSrcweir } 241cdf0e10cSrcweir 242cdf0e10cSrcweir const CodeEntity * 243cdf0e10cSrcweir RepositoryPartition::Search_RelatedCe(Type_id i_type) const 244cdf0e10cSrcweir { 245cdf0e10cSrcweir if (NOT i_type.IsValid()) 246cdf0e10cSrcweir return 0; 247cdf0e10cSrcweir 248cdf0e10cSrcweir Ce_id 249cdf0e10cSrcweir ce_id = pTypes->Find_Type(i_type).RelatedCe(); 250cdf0e10cSrcweir return ce_id.IsValid() 251cdf0e10cSrcweir ? & pCes->Find_Ce(ce_id) 252cdf0e10cSrcweir : (CodeEntity*)(0); 253cdf0e10cSrcweir } 254cdf0e10cSrcweir 255cdf0e10cSrcweir const ::ary::cpp::CppEntity * 256cdf0e10cSrcweir RepositoryPartition::Search_Entity(GlobalId i_id) const 257cdf0e10cSrcweir { 258cdf0e10cSrcweir if (i_id.Id() == 0) 259cdf0e10cSrcweir return 0; 260cdf0e10cSrcweir 261cdf0e10cSrcweir if ( NOT IsDefine(i_id) ) 262cdf0e10cSrcweir { 263cdf0e10cSrcweir // Shall make sure this is a C++ CodeEntity: 264cdf0e10cSrcweir csv_assert( i_id.Class() >= Namespace::class_id 265cdf0e10cSrcweir AND 266cdf0e10cSrcweir i_id.Class() < BuiltInType::class_id 267cdf0e10cSrcweir && "Unexpected entity type in cpp::RepositoryPartition" 268cdf0e10cSrcweir "::Search_Entity()." ); 269cdf0e10cSrcweir return & Ces().Find_Ce( Ce_id(i_id.Id()) ); 270cdf0e10cSrcweir } 271cdf0e10cSrcweir else 272cdf0e10cSrcweir { 273cdf0e10cSrcweir return & Defs().Find_Def( De_id(i_id.Id()) ); 274cdf0e10cSrcweir } 275cdf0e10cSrcweir } 276cdf0e10cSrcweir 277cdf0e10cSrcweir 278cdf0e10cSrcweir const CePilot & 279cdf0e10cSrcweir RepositoryPartition::Ces() const 280cdf0e10cSrcweir { 281cdf0e10cSrcweir csv_assert(pCes != 0); 282cdf0e10cSrcweir return *pCes; 283cdf0e10cSrcweir } 284cdf0e10cSrcweir 285cdf0e10cSrcweir const DefPilot & 286cdf0e10cSrcweir RepositoryPartition::Defs() const 287cdf0e10cSrcweir { 288cdf0e10cSrcweir csv_assert(pDefs != 0); 289cdf0e10cSrcweir return *pDefs; 290cdf0e10cSrcweir } 291cdf0e10cSrcweir 292cdf0e10cSrcweir const TypePilot & 293cdf0e10cSrcweir RepositoryPartition::Types() const 294cdf0e10cSrcweir { 295cdf0e10cSrcweir csv_assert(pTypes != 0); 296cdf0e10cSrcweir return *pTypes; 297cdf0e10cSrcweir } 298cdf0e10cSrcweir 299cdf0e10cSrcweir const loc::LocationPilot & 300cdf0e10cSrcweir RepositoryPartition::Locations() const 301cdf0e10cSrcweir { 302cdf0e10cSrcweir csv_assert(pLocations != 0); 303cdf0e10cSrcweir return *pLocations; 304cdf0e10cSrcweir } 305cdf0e10cSrcweir 306cdf0e10cSrcweir CePilot & 307cdf0e10cSrcweir RepositoryPartition::Ces() 308cdf0e10cSrcweir { 309cdf0e10cSrcweir csv_assert(pCes != 0); 310cdf0e10cSrcweir return *pCes; 311cdf0e10cSrcweir } 312cdf0e10cSrcweir 313cdf0e10cSrcweir DefPilot & 314cdf0e10cSrcweir RepositoryPartition::Defs() 315cdf0e10cSrcweir { 316cdf0e10cSrcweir csv_assert(pDefs != 0); 317cdf0e10cSrcweir return *pDefs; 318cdf0e10cSrcweir } 319cdf0e10cSrcweir 320cdf0e10cSrcweir TypePilot & 321cdf0e10cSrcweir RepositoryPartition::Types() 322cdf0e10cSrcweir { 323cdf0e10cSrcweir csv_assert(pTypes != 0); 324cdf0e10cSrcweir return *pTypes; 325cdf0e10cSrcweir } 326cdf0e10cSrcweir 327cdf0e10cSrcweir loc::LocationPilot & 328cdf0e10cSrcweir RepositoryPartition::Locations() 329cdf0e10cSrcweir { 330cdf0e10cSrcweir csv_assert(pLocations != 0); 331cdf0e10cSrcweir return *pLocations; 332cdf0e10cSrcweir } 333cdf0e10cSrcweir 334cdf0e10cSrcweir 335cdf0e10cSrcweir void 336cdf0e10cSrcweir RepositoryPartition::Connect_AllTypes_2_TheirRelated_CodeEntites() 337cdf0e10cSrcweir { 338cdf0e10cSrcweir TypeConnector 339cdf0e10cSrcweir aConnector(*this); 340cdf0e10cSrcweir std::for_each( pTypes->Storage().BeginUnreserved(), 341cdf0e10cSrcweir pTypes->Storage().End(), 342cdf0e10cSrcweir aConnector ); 343cdf0e10cSrcweir 344cdf0e10cSrcweir typedef ::ary::stg::filter_iterator<CodeEntity,Class> 345cdf0e10cSrcweir filter_class_iter; 346cdf0e10cSrcweir 347cdf0e10cSrcweir HierarchyLinker 348cdf0e10cSrcweir aHierarchyLinker(*this); 349cdf0e10cSrcweir filter_class_iter itEnd( pCes->Storage().End() ); 350cdf0e10cSrcweir for ( filter_class_iter it( pCes->Storage().BeginUnreserved() ); 351cdf0e10cSrcweir it != itEnd; 352cdf0e10cSrcweir ++it ) 353cdf0e10cSrcweir { 354cdf0e10cSrcweir if (NOT it.IsValid()) 355cdf0e10cSrcweir continue; 356cdf0e10cSrcweir 357cdf0e10cSrcweir if (is_type<Class>(*it)) 358cdf0e10cSrcweir aHierarchyLinker(ary_cast<Class>(*it)); 359cdf0e10cSrcweir } 360cdf0e10cSrcweir 361cdf0e10cSrcweir TypeConnector2ndTry 362cdf0e10cSrcweir aConnector2ndTry(*this); 363cdf0e10cSrcweir std::for_each( pTypes->Storage().BeginUnreserved(), 364cdf0e10cSrcweir pTypes->Storage().End(), 365cdf0e10cSrcweir aConnector2ndTry ); 366cdf0e10cSrcweir } 367cdf0e10cSrcweir 368cdf0e10cSrcweir template <class COMPARE> 369cdf0e10cSrcweir void Add2Result( 370cdf0e10cSrcweir List_GlobalIds & o_result, 371cdf0e10cSrcweir const SortedIds<COMPARE> & 372cdf0e10cSrcweir i_data, 373cdf0e10cSrcweir const char * i_begin, 374cdf0e10cSrcweir const char * i_end ); 375cdf0e10cSrcweir template <class COMPARE> 376cdf0e10cSrcweir void 377cdf0e10cSrcweir Add2Result( List_GlobalIds & o_result, 378cdf0e10cSrcweir const SortedIds<COMPARE> & i_data, 379cdf0e10cSrcweir const char * i_begin, 380cdf0e10cSrcweir const char * i_end ) 381cdf0e10cSrcweir { 382cdf0e10cSrcweir const size_t 383cdf0e10cSrcweir previous_size = o_result.size(); 384cdf0e10cSrcweir typename std::vector<typename COMPARE::id_type>::const_iterator 385cdf0e10cSrcweir it_beg = i_data.LowerBound(i_begin); 386cdf0e10cSrcweir typename std::vector<typename COMPARE::id_type>::const_iterator 387cdf0e10cSrcweir it_end = i_data.LowerBound(i_end); 388cdf0e10cSrcweir size_t 389cdf0e10cSrcweir count_added = static_cast<size_t>( std::distance(it_beg,it_end) ); 390cdf0e10cSrcweir o_result.insert( o_result.end(), 391cdf0e10cSrcweir count_added, 392cdf0e10cSrcweir GlobalId() ); 393cdf0e10cSrcweir List_GlobalIds::iterator 394cdf0e10cSrcweir it_out = o_result.begin() + previous_size; 395cdf0e10cSrcweir std::transform( it_beg, it_end, 396cdf0e10cSrcweir it_out, 397cdf0e10cSrcweir MakeGlobalId<COMPARE>() ); 398cdf0e10cSrcweir } 399cdf0e10cSrcweir 400cdf0e10cSrcweir 401cdf0e10cSrcweir uintt 402cdf0e10cSrcweir RepositoryPartition::Get_AlphabeticalList( List_GlobalIds & o_result, 403cdf0e10cSrcweir const char * i_begin, 404cdf0e10cSrcweir const char * i_end ) const 405cdf0e10cSrcweir { 406cdf0e10cSrcweir size_t 407cdf0e10cSrcweir ret = o_result.size(); 408cdf0e10cSrcweir 409cdf0e10cSrcweir const Ce_Storage & 410cdf0e10cSrcweir ce_storage = pCes->Storage(); 411cdf0e10cSrcweir const Def_Storage & 412cdf0e10cSrcweir def_storage = pDefs->Storage(); 413cdf0e10cSrcweir 414cdf0e10cSrcweir Add2Result( o_result, 415cdf0e10cSrcweir ce_storage.TypeIndex(), 416cdf0e10cSrcweir i_begin, i_end ); 417cdf0e10cSrcweir Add2Result( o_result, 418cdf0e10cSrcweir ce_storage.OperationIndex(), 419cdf0e10cSrcweir i_begin, i_end ); 420cdf0e10cSrcweir Add2Result( o_result, 421cdf0e10cSrcweir ce_storage.DataIndex(), 422cdf0e10cSrcweir i_begin, i_end ); 423cdf0e10cSrcweir Add2Result( o_result, 424cdf0e10cSrcweir def_storage.DefineIndex(), 425cdf0e10cSrcweir i_begin, i_end ); 426cdf0e10cSrcweir Add2Result( o_result, 427cdf0e10cSrcweir def_storage.MacroIndex(), 428cdf0e10cSrcweir i_begin, i_end ); 429cdf0e10cSrcweir 430cdf0e10cSrcweir LesserGlobal 431cdf0e10cSrcweir aLess(ce_storage, def_storage); 432cdf0e10cSrcweir 433cdf0e10cSrcweir std::sort(o_result.begin(), o_result.end(), aLess); 434cdf0e10cSrcweir 435cdf0e10cSrcweir return o_result.size() - ret; 436cdf0e10cSrcweir } 437cdf0e10cSrcweir 438cdf0e10cSrcweir 439cdf0e10cSrcweir 440cdf0e10cSrcweir 441cdf0e10cSrcweir } // namespace cpp 442cdf0e10cSrcweir } // namespace ary 443cdf0e10cSrcweir 444cdf0e10cSrcweir 445cdf0e10cSrcweir 446cdf0e10cSrcweir 447cdf0e10cSrcweir 448cdf0e10cSrcweir namespace 449cdf0e10cSrcweir { 450cdf0e10cSrcweir 451cdf0e10cSrcweir 452cdf0e10cSrcweir void 453cdf0e10cSrcweir TypeConnector::operator()( Type & io_rType ) const 454cdf0e10cSrcweir { 455cdf0e10cSrcweir csv_assert(pGate != 0); 456cdf0e10cSrcweir UsedType * 457cdf0e10cSrcweir pt = ::ary::ary_cast<UsedType>(&io_rType); 458cdf0e10cSrcweir if (pt != 0) 459cdf0e10cSrcweir pt->Connect2Ce(pGate->Ces()); 460cdf0e10cSrcweir } 461cdf0e10cSrcweir 462cdf0e10cSrcweir void 463cdf0e10cSrcweir TypeConnector2ndTry::operator()( Type & io_rType ) const 464cdf0e10cSrcweir { 465cdf0e10cSrcweir csv_assert(pGate != 0); 466cdf0e10cSrcweir UsedType * 467cdf0e10cSrcweir pt = ::ary::ary_cast<UsedType>(&io_rType); 468cdf0e10cSrcweir if (pt != 0) 469cdf0e10cSrcweir pt->Connect2CeOnlyKnownViaBaseClass(*pGate); 470cdf0e10cSrcweir } 471cdf0e10cSrcweir 472cdf0e10cSrcweir void 473cdf0e10cSrcweir HierarchyLinker::operator()( Class & io_rCe ) const 474cdf0e10cSrcweir { 475cdf0e10cSrcweir csv_assert( ::ary::is_type<Class>(io_rCe) ); 476cdf0e10cSrcweir Class & 477cdf0e10cSrcweir rClass = io_rCe; 478cdf0e10cSrcweir 479cdf0e10cSrcweir for ( List_Bases::const_iterator it = rClass.BaseClasses().begin(); 480cdf0e10cSrcweir it != rClass.BaseClasses().end(); 481cdf0e10cSrcweir ++it ) 482cdf0e10cSrcweir { 483cdf0e10cSrcweir const CodeEntity * 484cdf0e10cSrcweir pCe = 0; 485cdf0e10cSrcweir Type_id 486cdf0e10cSrcweir nTid = (*it).nId; 487cdf0e10cSrcweir for ( pCe = pGate->Search_RelatedCe(nTid); 488cdf0e10cSrcweir ary::ary_cast<Typedef>(pCe) != 0; 489cdf0e10cSrcweir pCe = pGate->Search_RelatedCe(nTid) ) 490cdf0e10cSrcweir { 491cdf0e10cSrcweir nTid = static_cast< const Typedef* >(pCe)->DescribingType(); 492cdf0e10cSrcweir } 493cdf0e10cSrcweir const Class * 494cdf0e10cSrcweir pClass = ary::ary_cast<Class>(pCe); 495cdf0e10cSrcweir if (pClass == 0) 496cdf0e10cSrcweir return; 497cdf0e10cSrcweir // KORR_FUTURE: we need a non const Find_Class() 498cdf0e10cSrcweir const_cast< Class* >(pClass)->Add_KnownDerivative( io_rCe.CeId() ); 499cdf0e10cSrcweir } 500cdf0e10cSrcweir } 501cdf0e10cSrcweir 502cdf0e10cSrcweir const String & 503cdf0e10cSrcweir LesserGlobal::NameOf(GlobalId i_id) const 504cdf0e10cSrcweir { 505cdf0e10cSrcweir if ( NOT IsDefine(i_id) ) 506cdf0e10cSrcweir { 507cdf0e10cSrcweir return rCes[i_id.Id()].LocalName(); 508cdf0e10cSrcweir } 509cdf0e10cSrcweir else 510cdf0e10cSrcweir { 511cdf0e10cSrcweir return rDes[i_id.Id()].LocalName(); 512cdf0e10cSrcweir } 513cdf0e10cSrcweir } 514cdf0e10cSrcweir 515cdf0e10cSrcweir 516cdf0e10cSrcweir 517cdf0e10cSrcweir } // namespace anonymous 518