OpenLB 1.8.1
Loading...
Searching...
No Matches
olb::AnyFieldTypeD< T, DESCRIPTOR, PLATFORM > Class Template Reference

Container for arbitrary data instances. More...

#include <data.h>

+ Collaboration diagram for olb::AnyFieldTypeD< T, DESCRIPTOR, PLATFORM >:

Public Member Functions

template<typename FIELD_TYPE , typename... ARGS>
 AnyFieldTypeD (meta::id< FIELD_TYPE > id, ARGS &&... args)
 
std::string getName () const
 
FieldTypePromise< T, DESCRIPTOR > getPromise () const
 
template<typename FIELD_TYPE >
const auto * as () const
 
template<typename FIELD_TYPE >
auto * as ()
 
SerializableasSerializable ()
 
template<typename TYPE >
std::optional< TYPE * > tryAs ()
 
void setProcessingContext (ProcessingContext context)
 

Detailed Description

template<typename T, typename DESCRIPTOR, Platform PLATFORM>
class olb::AnyFieldTypeD< T, DESCRIPTOR, PLATFORM >

Container for arbitrary data instances.

Enables runtime-allocated field storage in Data

Definition at line 200 of file data.h.

Constructor & Destructor Documentation

◆ AnyFieldTypeD()

template<typename T , typename DESCRIPTOR , Platform PLATFORM>
template<typename FIELD_TYPE , typename... ARGS>
olb::AnyFieldTypeD< T, DESCRIPTOR, PLATFORM >::AnyFieldTypeD ( meta::id< FIELD_TYPE > id,
ARGS &&... args )
inline

Definition at line 210 of file data.h.

210 :
212 _promise(id),
213 _data(new typename FIELD_TYPE::template type<T,DESCRIPTOR,PLATFORM>(
214 std::forward<decltype(args)>(args)...)),
215 _setProcessingContext([&](ProcessingContext context) {
216 static_cast<typename FIELD_TYPE::template type<T,DESCRIPTOR,PLATFORM>*>(_data.get())->setProcessingContext(context);
217 })
218 { }
std::string name()
Returns name of FIELD for human consumption.
Definition fields.h:49
ProcessingContext
OpenLB processing contexts.
Definition platform.h:54

References olb::AnyFieldTypeD< T, DESCRIPTOR, PLATFORM >::setProcessingContext().

+ Here is the call graph for this function:

Member Function Documentation

◆ as() [1/2]

template<typename T , typename DESCRIPTOR , Platform PLATFORM>
template<typename FIELD_TYPE >
auto * olb::AnyFieldTypeD< T, DESCRIPTOR, PLATFORM >::as ( )
inline

Definition at line 233 of file data.h.

233 {
234 return static_cast<typename FIELD_TYPE::template type<T,DESCRIPTOR,PLATFORM>*>(_data.get());
235 }

◆ as() [2/2]

template<typename T , typename DESCRIPTOR , Platform PLATFORM>
template<typename FIELD_TYPE >
const auto * olb::AnyFieldTypeD< T, DESCRIPTOR, PLATFORM >::as ( ) const
inline

Definition at line 229 of file data.h.

229 {
230 return static_cast<const typename FIELD_TYPE::template type<T,DESCRIPTOR,PLATFORM>*>(_data.get());
231 }

◆ asSerializable()

template<typename T , typename DESCRIPTOR , Platform PLATFORM>
Serializable * olb::AnyFieldTypeD< T, DESCRIPTOR, PLATFORM >::asSerializable ( )
inline

Definition at line 237 of file data.h.

237 {
238 return _data.get();
239 }

◆ getName()

template<typename T , typename DESCRIPTOR , Platform PLATFORM>
std::string olb::AnyFieldTypeD< T, DESCRIPTOR, PLATFORM >::getName ( ) const
inline

Definition at line 220 of file data.h.

220 {
221 return _name;
222 }

◆ getPromise()

template<typename T , typename DESCRIPTOR , Platform PLATFORM>
FieldTypePromise< T, DESCRIPTOR > olb::AnyFieldTypeD< T, DESCRIPTOR, PLATFORM >::getPromise ( ) const
inline

Definition at line 224 of file data.h.

224 {
225 return _promise;
226 }

◆ setProcessingContext()

template<typename T , typename DESCRIPTOR , Platform PLATFORM>
void olb::AnyFieldTypeD< T, DESCRIPTOR, PLATFORM >::setProcessingContext ( ProcessingContext context)
inline

Definition at line 250 of file data.h.

250 {
251 _setProcessingContext(context);
252 }
+ Here is the caller graph for this function:

◆ tryAs()

template<typename T , typename DESCRIPTOR , Platform PLATFORM>
template<typename TYPE >
std::optional< TYPE * > olb::AnyFieldTypeD< T, DESCRIPTOR, PLATFORM >::tryAs ( )
inline

Definition at line 242 of file data.h.

242 {
243 if (TYPE* ptr = dynamic_cast<TYPE*>(_data.get())) {
244 return std::optional<TYPE*>(ptr);
245 } else {
246 return std::nullopt;
247 }
248 }

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