|
Common System 0.2.0
Common interfaces and patterns for system integration
|
Interface adapter with type safety and depth tracking. More...
#include <adapter.h>


Public Member Functions | |
| interface_adapter (std::shared_ptr< Implementation > impl) | |
| Construct adapter with existing implementation. | |
| virtual | ~interface_adapter ()=default |
| std::shared_ptr< Implementation > | unwrap () const |
| Get the underlying implementation. | |
| bool | is_wrapped_adapter () const |
| Check if this adapter wraps another adapter. | |
| size_t | get_wrapper_depth () const |
| Get the current wrapper depth. | |
| size_t | get_adapter_depth () const override |
| Get the adapter depth (implements adapter_base) | |
| size_t | get_type_id () const override |
| Get unique type ID for this adapter type. | |
Public Member Functions inherited from kcenon::common::adapters::adapter_base | |
| virtual | ~adapter_base ()=default |
| virtual bool | is_adapter () const |
| Check if this is an adapter (always true for adapter_base) | |
Static Public Member Functions | |
| static std::string | adapter_type_name () |
| Get type name for debugging. | |
| static constexpr size_t | max_depth () |
| Get the maximum allowed wrapper depth. | |
| static size_t | get_static_type_id () |
| Get static type ID for this adapter type. | |
Protected Attributes | |
| std::shared_ptr< Implementation > | impl_ |
Static Private Member Functions | |
| static size_t | generate_type_id () |
| Generate a unique type ID. | |
| static size_t | calculate_depth (std::shared_ptr< Implementation > impl) |
| Calculate the depth of adapter wrapping. | |
Private Attributes | |
| size_t | wrapper_depth_ |
Static Private Attributes | |
| static constexpr size_t | max_wrapper_depth_ = 2 |
Interface adapter with type safety and depth tracking.
This template provides:
| Interface | The interface type being adapted to |
| Implementation | The concrete implementation being wrapped |
|
inlineexplicit |
Construct adapter with existing implementation.
| impl | Shared pointer to the implementation |
| std::runtime_error | if wrapper depth exceeds maximum |
Definition at line 313 of file adapter.h.
References kcenon::common::adapters::interface_adapter< Interface, Implementation >::max_wrapper_depth_, and kcenon::common::adapters::interface_adapter< Interface, Implementation >::wrapper_depth_.
|
virtualdefault |
|
inlinestatic |
|
inlinestaticprivate |
Calculate the depth of adapter wrapping.
| impl | The implementation to check |
Definition at line 398 of file adapter.h.
|
inlinestaticprivate |
Generate a unique type ID.
Definition at line 388 of file adapter.h.
Referenced by kcenon::common::adapters::interface_adapter< Interface, Implementation >::get_static_type_id().

|
inlineoverridevirtual |
Get the adapter depth (implements adapter_base)
Implements kcenon::common::adapters::adapter_base.
Definition at line 346 of file adapter.h.
References kcenon::common::adapters::interface_adapter< Interface, Implementation >::wrapper_depth_.
|
inlinestatic |
Get static type ID for this adapter type.
Definition at line 372 of file adapter.h.
References kcenon::common::adapters::interface_adapter< Interface, Implementation >::generate_type_id().
Referenced by kcenon::common::adapters::interface_adapter< Interface, Implementation >::get_type_id().


|
inlineoverridevirtual |
Get unique type ID for this adapter type.
Implements kcenon::common::adapters::adapter_base.
Definition at line 366 of file adapter.h.
References kcenon::common::adapters::interface_adapter< Interface, Implementation >::get_static_type_id().

|
inline |
Get the current wrapper depth.
Definition at line 340 of file adapter.h.
References kcenon::common::adapters::interface_adapter< Interface, Implementation >::wrapper_depth_.
|
inline |
Check if this adapter wraps another adapter.
Definition at line 334 of file adapter.h.
References kcenon::common::adapters::interface_adapter< Interface, Implementation >::wrapper_depth_.
|
inlinestaticconstexpr |
Get the maximum allowed wrapper depth.
Definition at line 360 of file adapter.h.
References kcenon::common::adapters::interface_adapter< Interface, Implementation >::max_wrapper_depth_.
|
inline |
Get the underlying implementation.
Definition at line 328 of file adapter.h.
References kcenon::common::adapters::interface_adapter< Interface, Implementation >::impl_.
|
protected |
Definition at line 378 of file adapter.h.
Referenced by kcenon::common::adapters::interface_adapter< Interface, Implementation >::unwrap().
|
staticconstexprprivate |
Definition at line 382 of file adapter.h.
Referenced by kcenon::common::adapters::interface_adapter< Interface, Implementation >::interface_adapter(), and kcenon::common::adapters::interface_adapter< Interface, Implementation >::max_depth().
|
private |
Definition at line 381 of file adapter.h.
Referenced by kcenon::common::adapters::interface_adapter< Interface, Implementation >::get_adapter_depth(), kcenon::common::adapters::interface_adapter< Interface, Implementation >::get_wrapper_depth(), kcenon::common::adapters::interface_adapter< Interface, Implementation >::interface_adapter(), and kcenon::common::adapters::interface_adapter< Interface, Implementation >::is_wrapped_adapter().