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_LOC_TRAITS_HXX 25 #define ARY_LOC_TRAITS_HXX 26 27 // USED SERVICES 28 // BASE CLASSES 29 // COMPONENTS 30 // PARAMETERS 31 #include <ary/loc/loc_types4loc.hxx> 32 33 34 namespace ary 35 { 36 namespace symtree 37 { 38 template <class> class Node; 39 } 40 } 41 42 43 44 45 namespace ary 46 { 47 namespace loc 48 { 49 50 51 52 /** Basic traits for derived ones of ->LocationEntity. 53 */ 54 struct Le_Traits 55 { 56 typedef LocationEntity entity_base_type; 57 typedef Le_id id_type; 58 59 static entity_base_type & 60 EntityOf_( 61 id_type i_id ); 62 }; 63 64 65 /** An instance of SYMBOL_TRAITS for ->::ary::symtree::Node. 66 67 @see ::ary::symtree::Node 68 */ 69 struct LeNode_Traits : public Le_Traits 70 { 71 static symtree::Node<LeNode_Traits> * 72 NodeOf_( 73 entity_base_type & i_entity ); 74 75 static entity_base_type * 76 ParentOf_( 77 const entity_base_type & 78 i_entity ); 79 template <class KEY> 80 static id_type Search_( 81 const entity_base_type & 82 i_entity, 83 const KEY & i_localKey ); 84 }; 85 86 87 88 /** An instance of COMPARE for ->::ary::SortedIds<>. 89 90 @see ::ary::SortedIds<> 91 */ 92 struct Le_Compare : public Le_Traits 93 { 94 typedef String key_type; 95 96 static const key_type & 97 KeyOf_( 98 const entity_base_type & 99 i_entity ); 100 static bool Lesser_( 101 const key_type & i_1, 102 const key_type & i_2 ); 103 }; 104 105 106 107 108 109 } // namespace loc 110 } // namespace ary 111 #endif 112