---
name: "corelinux_Bridge"
section: "3"
platform: "linux"
package: "libcorelinux-dev"
version: "0.4.32-5"
release: "Debian 3.1 (Sarge)"
platforms: ["linux"]
url: "https://new.carta.tech/corelinux_Bridge"
---

# corelinux\_Bridge(3)

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

## NAME

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

## SYNOPSIS

`#include <Bridge.hpp>`

Inherits **corelinux::CoreLinuxObject**.

### Public Member Functions

**Bridge** (Implementation aImplementation)\
 *Default Constructor requires a Implementation.*  virtual **~Bridge** (void)\
 *Virtual Destructor.*  **Bridge** & **operator=** (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* .RE

**Exceptions:**

*NEVER\_GET\_HERE* .RE

### 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* .RE

## 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

## Author

Generated automatically by Doxygen for CoreLinux++ from the source code.
