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_CPP_CS_DE_HXX 25 #define ARY_CPP_CS_DE_HXX 26 27 28 29 // USED SERVICES 30 // BASE CLASSES 31 #include <store/s_storage.hxx> 32 // OTHER 33 #include <ary/cpp/c_de.hxx> 34 #include <ary/cpp/c_traits.hxx> 35 #include <sortedids.hxx> 36 37 38 39 namespace ary 40 { 41 namespace cpp 42 { 43 44 45 46 47 /** The data base for all ->ary::cpp::Type objects. 48 */ 49 class Def_Storage : public ::ary::stg::Storage<DefineEntity> 50 { 51 public: 52 typedef SortedIds<Def_Compare> Index; 53 54 // LIFECYCLE 55 Def_Storage(); 56 virtual ~Def_Storage(); 57 58 De_id Store_Define( 59 DYN DefineEntity & pass_de ); 60 De_id Store_Macro( 61 DYN DefineEntity & pass_de ); 62 DefineIndex() const63 const Index & DefineIndex() const { return aDefines; } MacroIndex() const64 const Index & MacroIndex() const { return aMacros; } 65 DefineIndex()66 Index & DefineIndex() { return aDefines; } MacroIndex()67 Index & MacroIndex() { return aMacros; } 68 69 static Def_Storage & Instance_()70 Instance_() { csv_assert(pInstance_ != 0); 71 return *pInstance_; } 72 private: 73 // DATA 74 Index aDefines; 75 Index aMacros; 76 77 78 static Def_Storage * 79 pInstance_; 80 }; 81 82 83 84 85 namespace predefined 86 { 87 88 enum E_DefineEntity 89 { 90 // 0 is always unused with repository storages. 91 de_MAX = 1 92 }; 93 94 } // namespace predefined 95 96 97 98 99 100 101 } // namespace cpp 102 } // namespace ary 103 #endif 104