Bridge.hpp
#if !defined (__BRIDGE_HPP)
#define __BRIDGE_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 Bridge : public CoreLinuxObject
{
public:
Bridge( Implementation aImplementation )
:
CoreLinuxObject(),
theImplementation(aImplementation)
{
; // do nothing
}
virtual ~Bridge( void )
{
; // do nothing
}
//
// Operator overloads
//
Bridge & operator=( const Bridge & aRef ) throw(Exception)
{
this->setImplementation( aRef.getImplementation() );
return (*this);
}
bool operator==( const Bridge & ) const
{
return (this == &aRef);
}
bool operator!=( const Bridge & ) const
{
return !(*this == aRef);
}
protected:
Bridge( void ) throw (Assertion)
{
NEVER_GET_HERE;
}
Bridge( const Bridge & ) throw (Assertion)
{
NEVER_GET_HERE;
}
//
// Accessors
//
Implementation getImplementation( void ) const
{
return theImplementation;
}
//
// Mutators
//
void setImplementation( Implementation aImpl ) throw(Exception)
{
theImplementation = cloneImplementation(aImpl);
}
virtual Implementation cloneImplementation
(
Implementation
) throw(Exception) = 0;
private:
Implementation theImplementation;
};
}
#endif // if !defined(__BRIDGE_HPP)
/*
Common rcs information do not modify
$Author: prudhomm $
$Revision: 1.1 $
$Date: 2000/04/23 20:43:13 $
$Locker: $
*/
corelinux::Bridge::Bridge
Bridge(Implementation aImplementation)
Default Constructor requires a Implementation.
Definition: Bridge.hpp:53
corelinux::Bridge::setImplementation
void setImplementation(Implementation aImpl)
Set theImplementation.
Definition: Bridge.hpp:160
corelinux::Bridge::operator=
Bridge & operator=(const Bridge &aRef)
Assignment operator overload.
Definition: Bridge.hpp:80
corelinux::Bridge::cloneImplementation
virtual Implementation cloneImplementation(Implementation)=0
Pure virtual method to have the derivation contain theImplementation.by ownership.
corelinux::Bridge::~Bridge
virtual ~Bridge(void)
Virtual Destructor.
Definition: Bridge.hpp:64
corelinux::Bridge
When an abstraction can have one of several possible implementations, the usual way to accommodate th...
Definition: Bridge.hpp:44
corelinux::Bridge::getImplementation
Implementation getImplementation(void) const
Gets current theImplementation.
Definition: Bridge.hpp:143
corelinux::Bridge::operator!=
bool operator!=(const Bridge &) const
Non-equality operator overload.
Definition: Bridge.hpp:103
corelinux::Bridge::Bridge
Bridge(const Bridge &)
Copy Constructor Because theImplementation is owned by the Bridge, only the assignment operator insu...
Definition: Bridge.hpp:131
corelinux::Exception
Exception is the base exception class used in the CoreLinux++ libraries.
Definition: Exception.hpp:51
corelinux::Bridge::Bridge
Bridge(void)
Default Constructor Because a Bridge requires a implementation to work, you can not construct one wi...
Definition: Bridge.hpp:117
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::Bridge::operator==
bool operator==(const Bridge &) const
Equality operator overload.
Definition: Bridge.hpp:92

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