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 <ary/idl/i_module.hxx> 24cdf0e10cSrcweir #include <ary/idl/ik_module.hxx> 25cdf0e10cSrcweir 26cdf0e10cSrcweir // NOT FULLY DECLARED SERVICES 27cdf0e10cSrcweir #include <cosv/tpl/processor.hxx> 28cdf0e10cSrcweir #include <ary/idl/i_gate.hxx> 29cdf0e10cSrcweir #include <ary/idl/i_module.hxx> 30cdf0e10cSrcweir #include <ary/idl/i_service.hxx> 31cdf0e10cSrcweir #include <ary/idl/i_interface.hxx> 32cdf0e10cSrcweir #include <ary/idl/i_struct.hxx> 33cdf0e10cSrcweir #include <ary/idl/i_exception.hxx> 34cdf0e10cSrcweir #include <ary/idl/i_enum.hxx> 35cdf0e10cSrcweir #include <ary/idl/i_typedef.hxx> 36cdf0e10cSrcweir #include <ary/idl/i_constgroup.hxx> 37cdf0e10cSrcweir #include <ary/idl/i_singleton.hxx> 38cdf0e10cSrcweir #include <ary/idl/i_siservice.hxx> 39cdf0e10cSrcweir #include <ary/idl/i_sisingleton.hxx> 40cdf0e10cSrcweir #include <ary/idl/ip_ce.hxx> 41cdf0e10cSrcweir #include <nametreenode.hxx> 42cdf0e10cSrcweir 43cdf0e10cSrcweir 44cdf0e10cSrcweir namespace ary 45cdf0e10cSrcweir { 46cdf0e10cSrcweir namespace idl 47cdf0e10cSrcweir { 48cdf0e10cSrcweir 49cdf0e10cSrcweir Module::Module() 50cdf0e10cSrcweir : pImpl( new NameTreeNode<Ce_id> ) 51cdf0e10cSrcweir { 52cdf0e10cSrcweir } 53cdf0e10cSrcweir 54cdf0e10cSrcweir Module::Module( const String & i_sName, 55cdf0e10cSrcweir const Module & i_rParent ) 56cdf0e10cSrcweir : pImpl( new NameTreeNode<Ce_id>( i_sName, 57cdf0e10cSrcweir *i_rParent.pImpl, 58cdf0e10cSrcweir i_rParent.CeId() ) ) 59cdf0e10cSrcweir { 60cdf0e10cSrcweir } 61cdf0e10cSrcweir 62cdf0e10cSrcweir Module::~Module() 63cdf0e10cSrcweir { 64cdf0e10cSrcweir } 65cdf0e10cSrcweir 66cdf0e10cSrcweir void 67cdf0e10cSrcweir Module::Add_Name( const String & i_sName, 68cdf0e10cSrcweir Ce_id i_nCodeEntity ) 69cdf0e10cSrcweir { 70cdf0e10cSrcweir pImpl->Add_Name(i_sName, i_nCodeEntity); 71cdf0e10cSrcweir } 72cdf0e10cSrcweir 73cdf0e10cSrcweir Ce_id 74cdf0e10cSrcweir Module::Search_Name( const String & i_sName ) const 75cdf0e10cSrcweir { 76cdf0e10cSrcweir return pImpl->Search_Name(i_sName); 77cdf0e10cSrcweir } 78cdf0e10cSrcweir 79cdf0e10cSrcweir void 80cdf0e10cSrcweir Module::Get_Names( Dyn_StdConstIterator<Ce_id> & o_rResult ) const 81cdf0e10cSrcweir { 82cdf0e10cSrcweir pImpl->Get_Names( o_rResult ); 83cdf0e10cSrcweir } 84cdf0e10cSrcweir 85cdf0e10cSrcweir void 86cdf0e10cSrcweir Module::do_Accept( csv::ProcessorIfc & io_processor ) const 87cdf0e10cSrcweir { 88cdf0e10cSrcweir csv::CheckedCall(io_processor, *this); 89cdf0e10cSrcweir } 90cdf0e10cSrcweir 91cdf0e10cSrcweir ClassId 92cdf0e10cSrcweir Module::get_AryClass() const 93cdf0e10cSrcweir { 94cdf0e10cSrcweir return class_id; 95cdf0e10cSrcweir } 96cdf0e10cSrcweir 97cdf0e10cSrcweir const String & 98cdf0e10cSrcweir Module::inq_LocalName() const 99cdf0e10cSrcweir { 100cdf0e10cSrcweir return pImpl->Name(); 101cdf0e10cSrcweir } 102cdf0e10cSrcweir 103cdf0e10cSrcweir Ce_id 104cdf0e10cSrcweir Module::inq_NameRoom() const 105cdf0e10cSrcweir { 106cdf0e10cSrcweir return pImpl->Parent(); 107cdf0e10cSrcweir } 108cdf0e10cSrcweir 109cdf0e10cSrcweir Ce_id 110cdf0e10cSrcweir Module::inq_Owner() const 111cdf0e10cSrcweir { 112cdf0e10cSrcweir return pImpl->Parent(); 113cdf0e10cSrcweir } 114cdf0e10cSrcweir 115cdf0e10cSrcweir E_SightLevel 116cdf0e10cSrcweir Module::inq_SightLevel() const 117cdf0e10cSrcweir { 118cdf0e10cSrcweir return sl_Module; 119cdf0e10cSrcweir } 120cdf0e10cSrcweir 121cdf0e10cSrcweir 122cdf0e10cSrcweir namespace ifc_module 123cdf0e10cSrcweir { 124cdf0e10cSrcweir 125cdf0e10cSrcweir inline const Module & 126cdf0e10cSrcweir module_cast( const CodeEntity & i_ce ) 127cdf0e10cSrcweir { 128cdf0e10cSrcweir csv_assert( i_ce.AryClass() == Module::class_id ); 129cdf0e10cSrcweir return static_cast< const Module& >(i_ce); 130cdf0e10cSrcweir } 131cdf0e10cSrcweir 132cdf0e10cSrcweir typedef NameTreeNode<Ce_id>::Map_LocalNames NameMap; 133cdf0e10cSrcweir 134cdf0e10cSrcweir void 135cdf0e10cSrcweir attr::Get_AllChildrenSeparated( std::vector< const CodeEntity* > & o_nestedModules, 136cdf0e10cSrcweir std::vector< const CodeEntity* > & o_services, 137cdf0e10cSrcweir std::vector< const CodeEntity* > & o_interfaces, 138cdf0e10cSrcweir std::vector< const CodeEntity* > & o_structs, 139cdf0e10cSrcweir std::vector< const CodeEntity* > & o_exceptions, 140cdf0e10cSrcweir std::vector< const CodeEntity* > & o_enums, 141cdf0e10cSrcweir std::vector< const CodeEntity* > & o_typedefs, 142cdf0e10cSrcweir std::vector< const CodeEntity* > & o_constantGroups, 143cdf0e10cSrcweir std::vector< const CodeEntity* > & o_singletons, 144cdf0e10cSrcweir const CePilot & i_pilot, 145cdf0e10cSrcweir const CodeEntity & i_ce ) 146cdf0e10cSrcweir { 147cdf0e10cSrcweir const CodeEntity * 148cdf0e10cSrcweir pCe = 0; 149cdf0e10cSrcweir NameMap::const_iterator 150cdf0e10cSrcweir itEnd = module_cast(i_ce).pImpl->LocalNames().end(); 151cdf0e10cSrcweir for ( NameMap::const_iterator 152cdf0e10cSrcweir it = module_cast(i_ce).pImpl->LocalNames().begin(); 153cdf0e10cSrcweir it != itEnd; 154cdf0e10cSrcweir ++it ) 155cdf0e10cSrcweir { 156cdf0e10cSrcweir pCe = &i_pilot.Find_Ce( (*it).second ); 157cdf0e10cSrcweir switch (pCe->AryClass()) 158cdf0e10cSrcweir { 159cdf0e10cSrcweir case Module::class_id: 160cdf0e10cSrcweir o_nestedModules.push_back(pCe); 161cdf0e10cSrcweir break; 162cdf0e10cSrcweir case SglIfcService::class_id: 163cdf0e10cSrcweir case Service::class_id: 164cdf0e10cSrcweir o_services.push_back(pCe); 165cdf0e10cSrcweir break; 166cdf0e10cSrcweir case Interface::class_id: 167cdf0e10cSrcweir o_interfaces.push_back(pCe); 168cdf0e10cSrcweir break; 169cdf0e10cSrcweir case Struct::class_id: 170cdf0e10cSrcweir o_structs.push_back(pCe); 171cdf0e10cSrcweir break; 172cdf0e10cSrcweir case Exception::class_id: 173cdf0e10cSrcweir o_exceptions.push_back(pCe); 174cdf0e10cSrcweir break; 175cdf0e10cSrcweir case Enum::class_id: 176cdf0e10cSrcweir o_enums.push_back(pCe); 177cdf0e10cSrcweir break; 178cdf0e10cSrcweir case Typedef::class_id: 179cdf0e10cSrcweir o_typedefs.push_back(pCe); 180cdf0e10cSrcweir break; 181cdf0e10cSrcweir case ConstantsGroup::class_id: 182cdf0e10cSrcweir o_constantGroups.push_back(pCe); 183cdf0e10cSrcweir break; 184cdf0e10cSrcweir case SglIfcSingleton::class_id: 185cdf0e10cSrcweir case Singleton::class_id: 186cdf0e10cSrcweir o_singletons.push_back(pCe); 187cdf0e10cSrcweir break; 188cdf0e10cSrcweir } 189cdf0e10cSrcweir } // end for 190cdf0e10cSrcweir } 191cdf0e10cSrcweir 192cdf0e10cSrcweir 193cdf0e10cSrcweir } // namespace ifc_module 194cdf0e10cSrcweir 195cdf0e10cSrcweir 196cdf0e10cSrcweir 197cdf0e10cSrcweir } // namespace idl 198cdf0e10cSrcweir } // namespace ary 199