00001
#if !defined (__SCALARIDENTIFIERS_HPP)
00002
#define __SCALARIDENTIFIERS_HPP
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
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
00044
00045
00047
00048 ScalarIdentifier(
void )
00049 :
00050
Identifier(),
00051 theScalar(0)
00052 {
00053 ;
00054 }
00055
00057
00058 ScalarIdentifier( ScalarType aType )
00059 :
00060
Identifier(),
00061 theScalar(aType)
00062 {
00063 ;
00064 }
00065
00067
00068 ScalarIdentifier(
const ScalarIdentifier &aScalar )
00069 :
00070
Identifier(aScalar),
00071 theScalar( aScalar.
getScalar() )
00072 {
00073 ;
00074 }
00075
00077
00078 virtual ~ScalarIdentifier(
void )
00079 {
00080 ;
00081 }
00082
00083
00084
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
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
00256
00257
00258
00259
00260
00261
00262