lucid  0.0.1
Lifting-based Uncertain Control Invariant Dynamics
Loading...
Searching...
No Matches
lucid::PolymorphicScopedValue< T, B, Tags > Class Template Referencefinal

Generic scoped value class that can hold a value of type T, while interfacing with a base class B. More...

#include <ScopedValue.h>

Inheritance diagram for lucid::PolymorphicScopedValue< T, B, Tags >:
lucid::BaseScopedValue< B, Tags... >

Public Member Functions

const Bvalue () const override
 Get read-only access to the value of the current scoped value.
 
- Public Member Functions inherited from lucid::BaseScopedValue< B, Tags... >
 BaseScopedValue ()
 Construct a new scoped value instance and add it to the scope stack of instances.
 
 BaseScopedValue (const BaseScopedValue &)
 Copy constructor that adds the current instance to the scope stack of instances.
 
virtual ~BaseScopedValue ()
 Destructor that removes the current instance from the scope stack of instances.
 
Bvalue ()
 Get read-write access to the value of the current scoped value.
 
void swap (BaseScopedValue &other) noexcept
 Swap the values of two scoped value instances.
 
void * operator new (std::size_t)=delete
 Disabled standard new.
 
void * operator new (std::size_t, void *)=delete
 Disabled placement new.
 
void * operator new[] (std::size_t)=delete
 Disabled array new.
 
void * operator new[] (std::size_t, void *)=delete
 Disabled placement array new.
 

Additional Inherited Members

- Static Public Member Functions inherited from lucid::BaseScopedValue< B, Tags... >
static BaseScopedValuetop ()
 Get read-only access to the most recently created scoped value instance of the scope stack.
 
static BaseScopedValuebottom ()
 Get read-only access to the oldest created scoped value instance of the scope stack.
 
static const std::vector< BaseScopedValue * > & scope_stack ()
 Get read-only access to the all scoped value instances of the scope stack.
 
static void set_scopes (std::vector< BaseScopedValue * > new_scopes)
 Set the entire stack of scoped value instances.
 

Detailed Description

template<class T, class B, class... Tags>
class lucid::PolymorphicScopedValue< T, B, Tags >

Generic scoped value class that can hold a value of type T, while interfacing with a base class B.

This allows for polymorphic behavior when T is derived from B. The class maintains a stack of instances, allowing access to the most recently created (top) and the first created (bottom) instances.

Template Parameters
TType of the value to be scoped. Must be derived from B.
BBase class type for polymorphic behavior.
TagsVariadic template parameters to uniquely identify different scoped value types.

Member Function Documentation

◆ value()

template<class T, class B, class... Tags>
const B & lucid::PolymorphicScopedValue< T, B, Tags >::value ( ) const
inlineoverridevirtual

Get read-only access to the value of the current scoped value.

Returns
value of the current scoped value

Implements lucid::BaseScopedValue< B, Tags... >.


The documentation for this class was generated from the following file: