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

corelinux::Bridge< Implementation > Class Template Reference

When an abstraction can have one of several possible implementations, the usual way to accommodate them is to use inheritance. More...

#include <Bridge.hpp>

Inheritance diagram for corelinux::Bridge< Implementation >:

corelinux::CoreLinuxObject List of all members.

Public Member Functions

 Bridge (Implementation aImplementation)
 Default Constructor requires a Implementation.

virtual ~Bridge (void)
 Virtual Destructor.

Bridgeoperator= (const Bridge &aRef) throw (Exception)
 Assignment operator overload.

bool operator== (const Bridge &) const
 Equality operator overload.

bool operator!= (const Bridge &) const
 Non-equality operator overload.


Protected Member Functions

 Bridge (void) throw (Assertion)
 Default Constructor Because a Bridge requires a implementation to work, you can not construct one without it.

 Bridge (const Bridge &) throw (Assertion)
 Copy Constructor Because theImplementation is owned by the Bridge, only the assignment operator insures that the derivation is constructed and can be invoked for object management.

Implementation getImplementation (void) const
 Gets current theImplementation.

void setImplementation (Implementation aImpl) throw (Exception)
 Set theImplementation.

virtual Implementation cloneImplementation (Implementation)=0 throw (Exception)
 Pure virtual method to have the derivation contain theImplementation.by ownership.


Detailed Description

template<class Implementation>
class corelinux::Bridge< Implementation >

When an abstraction can have one of several possible implementations, the usual way to accommodate them is to use inheritance.

An abstract class defines the interface to the abstraction, and concrete subclasses implement it in different ways. But this approach isn't always flexible enough. Inheritance binds an implementation to the abstraction permanently, which makes it difficult to modify, extend, and reuse abstractions and implementations independently. A Bridge decouples an abstraction from its implementation so that the two can vary independently.


Constructor & Destructor Documentation

template<class Implementation>
corelinux::Bridge< Implementation >::Bridge Implementation  aImplementation  )  [inline]
 

Default Constructor requires a Implementation.

Parameters:
Implementation instance

template<class Implementation>
corelinux::Bridge< Implementation >::Bridge void   )  throw (Assertion) [inline, protected]
 

Default Constructor Because a Bridge requires a implementation to work, you can not construct one without it.

Parameters:
void 
Exceptions:
NEVER_GET_HERE 

template<class Implementation>
corelinux::Bridge< Implementation >::Bridge const Bridge< Implementation > &   )  throw (Assertion) [inline, protected]
 

Copy Constructor Because theImplementation is owned by the Bridge, only the assignment operator insures that the derivation is constructed and can be invoked for object management.

Parameters:
Bridge const reference
Exceptions:
NEVER_GET_HERE 


Member Function Documentation

template<class Implementation>
virtual Implementation corelinux::Bridge< Implementation >::cloneImplementation Implementation   )  throw (Exception) [protected, pure virtual]
 

Pure virtual method to have the derivation contain theImplementation.by ownership.

Parameters:
Implementation instance
Returns:
Implementation instance
Exceptions:
Exception - implementation defined

template<class Implementation>
Implementation corelinux::Bridge< Implementation >::getImplementation void   )  const [inline, protected]
 

Gets current theImplementation.

Returns:
Implementation instance

template<class Implementation>
bool corelinux::Bridge< Implementation >::operator!= const Bridge< Implementation > &   )  const [inline]
 

Non-equality operator overload.

Parameters:
Bridge const reference
Returns:
false if equal, true otherwise

template<class Implementation>
Bridge& corelinux::Bridge< Implementation >::operator= const Bridge< Implementation > &  aRef  )  throw (Exception) [inline]
 

Assignment operator overload.

This may throw Exception if there is a problem cloning theImplementation.

Parameters:
Bridge const reference
Returns:
Bridge reference to self
Exceptions:
Exception - implementation defined

template<class Implementation>
bool corelinux::Bridge< Implementation >::operator== const Bridge< Implementation > &   )  const [inline]
 

Equality operator overload.

Parameters:
Bridge const reference
Returns:
true if equal, false otherwise

template<class Implementation>
void corelinux::Bridge< Implementation >::setImplementation Implementation  aImpl  )  throw (Exception) [inline, protected]
 

Set theImplementation.

This in turn calls the pure-virtual method cloneImplementation so that a pointer unique to this object, or one which is referencable can be managed

Parameters:
Implementation instance
Exceptions:
Exception - implementation defined


The documentation for this class was generated from the following file:
This is the CoreLinux++ reference manual
Provided by The CoreLinux Consortium