OpenLB 1.7
Loading...
Searching...
No Matches
Public Member Functions | List of all members
olb::AnyFieldType< T, DESCRIPTOR, PLATFORM > Class Template Reference

Helper for referring to arbitrary data instances. More...

#include <data.h>

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

Public Member Functions

template<typename FIELD_TYPE , typename... ARGS>
 AnyFieldType (meta::id< FIELD_TYPE >, ARGS &&... args)
 
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::AnyFieldType< T, DESCRIPTOR, PLATFORM >

Helper for referring to arbitrary data instances.

Enables runtime-allocated field storage in Data

Definition at line 72 of file data.h.

Constructor & Destructor Documentation

◆ AnyFieldType()

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

Definition at line 79 of file data.h.

79 :
80 _data(new typename FIELD_TYPE::template type<T,DESCRIPTOR,PLATFORM>(
81 std::forward<decltype(args)>(args)...)),
82 _setProcessingContext([&](ProcessingContext context) {
83 static_cast<typename FIELD_TYPE::template type<T,DESCRIPTOR,PLATFORM>*>(_data.get())->setProcessingContext(context);
84 })
85 { }
ProcessingContext
OpenLB processing contexts.
Definition platform.h:55

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

+ Here is the call graph for this function:

Member Function Documentation

◆ as()

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

Definition at line 88 of file data.h.

88 {
89 return static_cast<typename FIELD_TYPE::template type<T,DESCRIPTOR,PLATFORM>*>(_data.get());
90 }

◆ asSerializable()

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

Definition at line 92 of file data.h.

92 {
93 return _data.get();
94 }

◆ setProcessingContext()

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

Definition at line 105 of file data.h.

105 {
106 _setProcessingContext(context);
107 }
+ Here is the caller graph for this function:

◆ tryAs()

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

Definition at line 97 of file data.h.

97 {
98 if (TYPE* ptr = dynamic_cast<TYPE*>(_data.get())) {
99 return std::optional<TYPE*>(ptr);
100 } else {
101 return std::nullopt;
102 }
103 }

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