object_adapter_pattern
-
namespace object_adapter_pattern
Namespace for the Object Adapter pattern.
-
class Adaptee
- #include <object_adapter.hpp>
The Adaptee class provides existing functionality needing adaptation.
The Adaptee defines methods that are incompatible with the Target interface but offer useful functionality. The Adapter class bridges the gap between the Adaptee and the Target interface, enabling seamless integration.
-
class Adapter : public object_adapter_pattern::Target
- #include <object_adapter.hpp>
The Adapter class adapts the Adaptee to the Target interface.
The Adapter uses composition to hold an instance of Adaptee and translates calls from the Target interface into calls to the Adaptee’s methods. This enables the client to interact with Adaptee functionality seamlessly.
Public Functions
-
class Target
- #include <object_adapter.hpp>
The Target interface defines the expected interface for the client.
The Target interface acts as a standard contract for clients that interact with the system. By abstracting specific implementation details, this interface promotes flexibility and decoupling between the client and concrete implementations.
Subclassed by object_adapter_pattern::Adapter
Public Functions
-
virtual ~Target() = default
Virtual destructor ensures proper cleanup of derived objects.
-
virtual void request() const = 0
Standard method expected by the client.
Derived classes implement this method to provide behavior tailored to the client’s expectations.
-
virtual ~Target() = default
-
class Adaptee