Decorator.hpp
#if !defined (__DECORATOR_HPP)
#define __DECORATOR_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(__COMMON_HPP)
#include <Common.hpp>
#endif
namespace corelinux
{
template <class Implementation>
class Decorator : public CoreLinuxObject
{
public:
//
// Constructors
//
Decorator( Implementation aImplementation )
:
CoreLinuxObject(),
theImplementation(aImplementation)
{
; // do nothing
}
Decorator( const Decorator &aDecorator )
:
CoreLinuxObject(),
theImplementation
(
aDecorator.getImplementation()
)
{
; // do nothing
}
virtual ~Decorator( void )
{
; // do nothing
}
//
// Operator overloads
//
Decorator & operator=( const Decorator & aDecorator )
throw(Exception)
{
this->setImplementation
( aDecorator.getImplementation() );
return (*this);
}
bool operator==( const Decorator & aDecorator ) const
{
return
(
this == &aDecorator &&
(
this->getImplementation() ==
aDecorator.getImplementation()
)
);
}
//
// Accessors
//
virtual Implementation getImplementation( void ) const
{
return theImplementation;
}
//
// Mutators
//
virtual void setImplementation( Implementation aImplementation )
throw(Exception)
{
theImplementation = aImplementation;
}
protected:
//
// Constructors
//
Decorator( void )
throw (Assertion)
:
CoreLinuxObject()
{
NEVER_GET_HERE;
}
protected:
Implementation theImplementation;
};
}
#endif // if !defined(__DECORATOR_HPP)
/*
Common rcs information do not modify
$Author: prudhomm $
$Revision: 1.1 $
$Date: 2000/04/23 20:43:13 $
$Locker: $
*/
corelinux::Decorator
Decorators can attach additional responsibilities to an object dynamically which provide a more flexi...
Definition: Decorator.hpp:39
corelinux::Decorator::Decorator
Decorator(void)
Default Constructor Because a Decorator requires a implementation to work, you can not construct one ...
Definition: Decorator.hpp:163
corelinux::Decorator::Decorator
Decorator(Implementation aImplementation)
Default Constructor requires a Implementation.
Definition: Decorator.hpp:52
corelinux::Decorator::operator==
bool operator==(const Decorator &aDecorator) const
Equality operator overload.
Definition: Decorator.hpp:109
corelinux::Decorator::theImplementation
Implementation theImplementation
Storage for theImplementation object.
Definition: Decorator.hpp:176
corelinux::Decorator::setImplementation
virtual void setImplementation(Implementation aImplementation)
Sets current theImplementation to aImplementation.
Definition: Decorator.hpp:144
corelinux::Decorator::Decorator
Decorator(const Decorator &aDecorator)
Copy Constructor copies theImplementation.
Definition: Decorator.hpp:65
corelinux
Forward reference the various common classes.
Definition: AbstractAllocator.hpp:32
corelinux::Exception
Exception is the base exception class used in the CoreLinux++ libraries.
Definition: Exception.hpp:51
corelinux::Decorator::operator=
Decorator & operator=(const Decorator &aDecorator)
Assignment operator overload.
Definition: Decorator.hpp:94
corelinux::Assertion
Assertion is-a Exception created when an assertion fails.
Definition: Assertion.hpp:423
corelinux::CoreLinuxObject
An CoreLinuxObject is a base class for the library.
Definition: CoreLinuxObject.hpp:39
corelinux::Decorator::~Decorator
virtual ~Decorator(void)
Virtual Destructor.
Definition: Decorator.hpp:78
corelinux::Decorator::getImplementation
virtual Implementation getImplementation(void) const
Gets current theImplementation.
Definition: Decorator.hpp:130

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