ScalarIdentifiers.hpp
#if !defined (__SCALARIDENTIFIERS_HPP)
#define __SCALARIDENTIFIERS_HPP
/*
CoreLinux++
Copyright (C) 1999,2000 CoreLinux Consortium
The CoreLinux++ Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public License as
published by the Free Software Foundation; either version 2 of the
License, or (at your option) any later version.
The CoreLinux++ Library Library is distributed in the hope that it will
be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public
License along with the GNU C Library; see the file COPYING.LIB. If not,
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
#if !defined IN_COMMON_HPP
#error ScalarIdentifiers.hpp is included by Common.hpp only.
#endif
namespace corelinux
{
template< class ScalarType >
class ScalarIdentifier : public Identifier
{
public:
//
// Constructors and destructor
//
ScalarIdentifier( void )
:
Identifier(),
theScalar(0)
{
; // do nothing
}
ScalarIdentifier( ScalarType aType )
:
Identifier(),
theScalar(aType)
{
; // do nothing
}
ScalarIdentifier( const ScalarIdentifier &aScalar )
:
Identifier(aScalar),
theScalar( aScalar.getScalar() )
{
; // do nothing
}
virtual ~ScalarIdentifier( void )
{
; // do nothing
}
//
// Operator overloads
//
inline ScalarType & operator=( ScalarType aScalar )
{
theScalar = aScalar;
return ( *this );
}
inline ScalarIdentifier & operator=( const ScalarIdentifier &aScalar )
{
theScalar = aScalar.getScalar();
return ( *this );
}
inline operator ScalarType &( void )
{
return theScalar;
}
inline operator ScalarType *( void )
{
return &theScalar;
}
//
// Accessors
//
inline const ScalarType & getScalar( void ) const
{
return theScalar;
}
protected:
virtual bool isEqual( IdentifierCref aRef ) const
{
return ( theScalar ==
((const ScalarIdentifier &)aRef).theScalar );
}
virtual bool isLessThan( IdentifierCref aRef ) const
{
return ( theScalar <
((const ScalarIdentifier &)aRef).theScalar );
}
virtual bool isLessThanOrEqual( IdentifierCref aRef ) const
{
return ( theScalar <=
((const ScalarIdentifier &)aRef).theScalar );
}
virtual bool isGreaterThan( IdentifierCref aRef ) const
{
return ( theScalar >
((const ScalarIdentifier &)aRef).theScalar );
}
virtual bool isGreaterThanOrEqual( IdentifierCref aRef ) const
{
return ( theScalar >=
((const ScalarIdentifier &)aRef).theScalar );
}
private:
ScalarType theScalar;
};
}
using corelinux::Dword;
using corelinux::Int;
using corelinux::Short;
using corelinux::Word;
using corelinux::UnsignedInt;
DECLARE_TYPE( CORELINUX(ScalarIdentifier<Int>), IntIdentifier );
DECLARE_TYPE( CORELINUX(ScalarIdentifier<UnsignedInt>), UnsignedIdentifier );
DECLARE_TYPE( CORELINUX(ScalarIdentifier<Short>), ShortIdentifier );
DECLARE_TYPE( CORELINUX(ScalarIdentifier<Dword>), DwordIdentifier );
DECLARE_TYPE( CORELINUX(ScalarIdentifier<Word>), WordIdentifier );
DECLARE_TYPE( ShortIdentifier, SemaphoreIdentifier );
DECLARE_TYPE( IntIdentifier, SemaphoreGroupIdentifier );
DECLARE_TYPE( IntIdentifier, ThreadIdentifier );
DECLARE_TYPE( IntIdentifier, ProcessIdentifier );
DECLARE_TYPE( IntIdentifier, MemoryIdentifier );
DECLARE_TYPE( UnsignedIdentifier, UserIdentifier );
DECLARE_TYPE( UnsignedIdentifier, GroupIdentifier );
#endif // if defined(__SCALARIDENTIFIERS_HPP)
/*
Common rcs information do not modify
$Author: frankc $
$Revision: 1.2 $
$Date: 2000/05/25 04:26:14 $
$Locker: $
*/
corelinux::ScalarIdentifier::ScalarIdentifier
ScalarIdentifier(void)
Default constructor.
Definition: ScalarIdentifiers.hpp:48
corelinux::ScalarIdentifier::~ScalarIdentifier
virtual ~ScalarIdentifier(void)
Virtual Destructor.
Definition: ScalarIdentifiers.hpp:78
corelinux::ScalarIdentifier::ScalarIdentifier
ScalarIdentifier(const ScalarIdentifier &aScalar)
Copy constructor.
Definition: ScalarIdentifiers.hpp:68
corelinux::ScalarIdentifier::getScalar
const ScalarType & getScalar(void) const
Returns a const reference.
Definition: ScalarIdentifiers.hpp:121
corelinux::ScalarIdentifier::isGreaterThan
virtual bool isGreaterThan(IdentifierCref aRef) const
Greater than method.
Definition: ScalarIdentifiers.hpp:170
corelinux::Identifier
An Identifier is a abstract representation of identity.
Definition: Identifier.hpp:40
corelinux::ScalarIdentifier::isGreaterThanOrEqual
virtual bool isGreaterThanOrEqual(IdentifierCref aRef) const
Greater than or equal method.
Definition: ScalarIdentifiers.hpp:182
corelinux
Forward reference the various common classes.
Definition: AbstractAllocator.hpp:32
corelinux::ScalarIdentifier::operator=
ScalarType & operator=(ScalarType aScalar)
Operator assignment for scalars.
Definition: ScalarIdentifiers.hpp:88
corelinux::ScalarIdentifier
ScalarIdentifier provides a templated interface for declaring CoreLinux Identifiers for simple scalar...
Definition: ScalarIdentifiers.hpp:37
corelinux::ScalarIdentifier::ScalarIdentifier
ScalarIdentifier(ScalarType aType)
Initializing constructor.
Definition: ScalarIdentifiers.hpp:58
corelinux::ScalarIdentifier::isLessThanOrEqual
virtual bool isLessThanOrEqual(IdentifierCref aRef) const
Less than or equal method.
Definition: ScalarIdentifiers.hpp:158
corelinux::ScalarIdentifier::isLessThan
virtual bool isLessThan(IdentifierCref aRef) const
Less than method.
Definition: ScalarIdentifiers.hpp:146
corelinux::ScalarIdentifier::operator=
ScalarIdentifier & operator=(const ScalarIdentifier &aScalar)
Operator assignment of Identifiers.
Definition: ScalarIdentifiers.hpp:96
corelinux::ScalarIdentifier::isEqual
virtual bool isEqual(IdentifierCref aRef) const
Equality method.
Definition: ScalarIdentifiers.hpp:134

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