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

corelinux::Bridge Template Class 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

Inheritance graph
[legend]
Collaboration diagram for corelinux::Bridge:

Collaboration graph
[legend]
List of all members.

Public Methods

 Bridge ( Implementation aImplementation )
 Default Constructor requires a Implementation. More...

virtual ~Bridge ( void )
 Virtual Destructor.

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

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

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


Protected Methods

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

 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. More...

Implementation getImplementation ( void ) const
 Gets current theImplementation. More...

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

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


Detailed Description

template<class Implementation> template class corelinux::Bridge

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<classImplementation>
corelinux::Bridge<Implementation>::Bridge<Implementation> ( Implementation aImplementation )
 

Default Constructor requires a Implementation.

Parameters:
Implementation   instance

template<classImplementation>
corelinux::Bridge<Implementation>::Bridge<Implementation> ( 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<classImplementation>
corelinux::Bridge<Implementation>::Bridge<Implementation> ( 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<classImplementation>
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<classImplementation>
Implementation corelinux::Bridge<Implementation>::getImplementation ( void ) const [inline, protected]
 

Gets current theImplementation.

Returns:
Implementation instance

template<classImplementation>
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<classImplementation>
Bridge<Implementation> & 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<classImplementation>
bool corelinux::Bridge<Implementation>::operator== ( const Bridge<Implementation> & ) const [inline]
 

Equality operator overload.

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

template<classImplementation>
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