Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Namespace Members | Class Members | File Members | Examples

ScalarIdentifiers.hpp

00001 #if !defined (__SCALARIDENTIFIERS_HPP) 00002 #define __SCALARIDENTIFIERS_HPP 00003 00004 /* 00005 CoreLinux++ 00006 Copyright (C) 1999,2000 CoreLinux Consortium 00007 00008 The CoreLinux++ Library is free software; you can redistribute it and/or 00009 modify it under the terms of the GNU Library General Public License as 00010 published by the Free Software Foundation; either version 2 of the 00011 License, or (at your option) any later version. 00012 00013 The CoreLinux++ Library Library is distributed in the hope that it will 00014 be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of 00015 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00016 Library General Public License for more details. 00017 00018 You should have received a copy of the GNU Library General Public 00019 License along with the GNU C Library; see the file COPYING.LIB. If not, 00020 write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, 00021 Boston, MA 02111-1307, USA. 00022 */ 00023 00024 #if !defined IN_COMMON_HPP 00025 #error ScalarIdentifiers.hpp is included by Common.hpp only. 00026 #endif 00027 00028 namespace corelinux 00029 { 00036 template< class ScalarType > 00037 class ScalarIdentifier : public Identifier 00038 { 00039 00040 public: 00041 00042 // 00043 // Constructors and destructor 00044 // 00045 00047 00048 ScalarIdentifier( void ) 00049 : 00050 Identifier(), 00051 theScalar(0) 00052 { 00053 ; // do nothing 00054 } 00055 00057 00058 ScalarIdentifier( ScalarType aType ) 00059 : 00060 Identifier(), 00061 theScalar(aType) 00062 { 00063 ; // do nothing 00064 } 00065 00067 00068 ScalarIdentifier( const ScalarIdentifier &aScalar ) 00069 : 00070 Identifier(aScalar), 00071 theScalar( aScalar.getScalar() ) 00072 { 00073 ; // do nothing 00074 } 00075 00077 00078 virtual ~ScalarIdentifier( void ) 00079 { 00080 ; // do nothing 00081 } 00082 00083 // 00084 // Operator overloads 00085 // 00087 00088 inline ScalarType & operator=( ScalarType aScalar ) 00089 { 00090 theScalar = aScalar; 00091 return ( *this ); 00092 } 00093 00095 00096 inline ScalarIdentifier & operator=( const ScalarIdentifier &aScalar ) 00097 { 00098 theScalar = aScalar.getScalar(); 00099 return ( *this ); 00100 } 00101 00103 00104 inline operator ScalarType &( void ) 00105 { 00106 return theScalar; 00107 } 00108 00110 00111 inline operator ScalarType *( void ) 00112 { 00113 return &theScalar; 00114 } 00115 00116 // 00117 // Accessors 00118 // 00120 00121 inline const ScalarType & getScalar( void ) const 00122 { 00123 return theScalar; 00124 } 00125 00126 protected: 00127 00134 virtual bool isEqual( IdentifierCref aRef ) const 00135 { 00136 return ( theScalar == 00137 ((const ScalarIdentifier &)aRef).theScalar ); 00138 } 00139 00146 virtual bool isLessThan( IdentifierCref aRef ) const 00147 { 00148 return ( theScalar < 00149 ((const ScalarIdentifier &)aRef).theScalar ); 00150 } 00151 00158 virtual bool isLessThanOrEqual( IdentifierCref aRef ) const 00159 { 00160 return ( theScalar <= 00161 ((const ScalarIdentifier &)aRef).theScalar ); 00162 } 00163 00170 virtual bool isGreaterThan( IdentifierCref aRef ) const 00171 { 00172 return ( theScalar > 00173 ((const ScalarIdentifier &)aRef).theScalar ); 00174 } 00175 00182 virtual bool isGreaterThanOrEqual( IdentifierCref aRef ) const 00183 { 00184 return ( theScalar >= 00185 ((const ScalarIdentifier &)aRef).theScalar ); 00186 } 00187 00188 private: 00189 00191 00192 ScalarType theScalar; 00193 }; 00194 00195 } 00196 00197 using corelinux::Dword; 00198 using corelinux::Int; 00199 using corelinux::Short; 00200 using corelinux::Word; 00201 using corelinux::UnsignedInt; 00202 00204 00205 DECLARE_TYPE( CORELINUX(ScalarIdentifier<Int>), IntIdentifier ); 00206 00208 00209 DECLARE_TYPE( CORELINUX(ScalarIdentifier<UnsignedInt>), UnsignedIdentifier ); 00210 00212 00213 DECLARE_TYPE( CORELINUX(ScalarIdentifier<Short>), ShortIdentifier ); 00214 00216 00217 DECLARE_TYPE( CORELINUX(ScalarIdentifier<Dword>), DwordIdentifier ); 00218 00220 00221 DECLARE_TYPE( CORELINUX(ScalarIdentifier<Word>), WordIdentifier ); 00222 00224 00225 DECLARE_TYPE( ShortIdentifier, SemaphoreIdentifier ); 00226 00228 00229 DECLARE_TYPE( IntIdentifier, SemaphoreGroupIdentifier ); 00230 00232 00233 DECLARE_TYPE( IntIdentifier, ThreadIdentifier ); 00234 00236 00237 DECLARE_TYPE( IntIdentifier, ProcessIdentifier ); 00238 00240 00241 DECLARE_TYPE( IntIdentifier, MemoryIdentifier ); 00242 00244 00245 DECLARE_TYPE( UnsignedIdentifier, UserIdentifier ); 00246 00248 00249 DECLARE_TYPE( UnsignedIdentifier, GroupIdentifier ); 00250 00251 00252 #endif // if defined(__SCALARIDENTIFIERS_HPP) 00253 00254 /* 00255 Common rcs information do not modify 00256 $Author: frankc $ 00257 $Revision: 1.2 $ 00258 $Date: 2000/05/25 04:26:14 $ 00259 $Locker: $ 00260 */ 00261 00262

This is the CoreLinux++ reference manual
Provided by The CoreLinux Consortium