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_C_OSIGNA_HXX 25 #define ARY_CPP_C_OSIGNA_HXX 26 27 // USED SERVICES 28 // BASE CLASSES 29 // OTHER 30 #include <ary/cpp/c_types4cpp.hxx> 31 32 namespace ary 33 { 34 namespace cpp 35 { 36 class Gate; 37 } 38 } 39 40 41 42 namespace ary 43 { 44 namespace cpp 45 { 46 47 48 /** The signature of a C++ function. That is: parameter types and 49 const/volatile modifiers. 50 */ 51 class OperationSignature 52 { 53 public: 54 typedef std::vector<Type_id> ParameterTypeList; 55 56 OperationSignature( 57 ParameterTypeList i_parameterTypes, // Non const, because it will be swapped with aParameterTypes. 58 E_ConVol i_conVol ); 59 60 bool operator==( 61 const OperationSignature & 62 i_rSig ) const; 63 bool operator<( 64 const OperationSignature & 65 i_rSig ) const; 66 67 // INQUIRY 68 const ParameterTypeList & 69 Parameters() const; 70 E_ConVol ConVol() const; 71 72 /** Compares the signatures by length an then by ids of 73 parameter types. So the result is not always human 74 reconstructable. 75 @return like in strcmp(). 76 */ 77 int Compare( 78 const OperationSignature & 79 i_rSig ) const; 80 private: 81 // DATA 82 ParameterTypeList aParameterTypes; 83 E_ConVol eConVol; 84 }; 85 86 87 88 89 // IMPLEMENTATION 90 inline bool operator ==(const OperationSignature & i_rSign) const91OperationSignature::operator==( const OperationSignature & i_rSign ) const 92 { 93 return Compare(i_rSign) == 0; 94 } 95 96 inline bool operator <(const OperationSignature & i_rSign) const97OperationSignature::operator<( const OperationSignature & i_rSign ) const 98 { 99 return Compare(i_rSign) < 0; 100 } 101 102 inline const OperationSignature::ParameterTypeList & Parameters() const103OperationSignature::Parameters() const 104 { 105 return aParameterTypes; 106 } 107 108 inline E_ConVol ConVol() const109OperationSignature::ConVol() const 110 { 111 return eConVol; 112 } 113 114 115 116 } // namespace cpp 117 } // namespace ary 118 #endif 119