Shamrock 2025.10.0
Astrophysical Code
Loading...
Searching...
No Matches
shamrock::patch::PatchDataLayerLayout Class Reference

Public Member Functions

template<class T>
void add_field (const std::string &field_name, u32 nvar, SourceLocation loc=SourceLocation{})
 add a field of type T to the layout
bool has_field_name (const std::string &field_name) const
 Check whether a field with the given name already exists.
template<class T>
FieldDescriptor< T > get_field (const std::string &field_name)
 Get the field description id if matching name & type.
template<class T>
FieldDescriptor< T > get_field (u32 idx)
 Get the field description at given index.
template<class T>
u32 get_field_idx (const std::string &field_name) const
 Get the field id if matching name & type.
template<class T>
u32 get_field_idx (const std::string &field_name, u32 nvar) const
 Get the field id if matching name & type & nvar.
template<class T>
bool check_field_type (u32 idx)
 check that field of id @idx is of type T
template<class T>
bool check_main_field_type ()
 check that main field (id=0)is of type T
const var_t & get_main_field_any () const
 Get the main field description as a variant object.
std::string get_description_str () const
 Get the description of the layout.
std::vector< std::string > get_field_names ()
 Get the list of field names.
template<class Functor>
void for_each_field_any (Functor &&func) const
 for each visit of each field
void add_field_t (std::string fname, u32 nvar, std::string type)
 Add a field with type specified as a string.

Friends

bool operator== (const PatchDataLayerLayout &lhs, const PatchDataLayerLayout &rhs)
 Overloaded equality operator for PatchDataLayerLayout class.

Detailed Description

Definition at line 64 of file PatchDataLayerLayout.hpp.

Member Function Documentation

◆ add_field()

template<class T>
void shamrock::patch::PatchDataLayerLayout::add_field ( const std::string & field_name,
u32 nvar,
SourceLocation loc = SourceLocation{} )

add a field of type T to the layout

Template Parameters
Ttype of the field
Parameters
field_namefield name
nvarnumber of varaible per object

Definition at line 111 of file PatchDataLayerLayout.cpp.

Here is the call graph for this function:

◆ add_field_t()

void shamrock::patch::PatchDataLayerLayout::add_field_t ( std::string fname,
u32 nvar,
std::string type )
inline

Add a field with type specified as a string.

Parameters
fnamethe name of the field
nvarthe number of variables
typethe type of the field as a string

Definition at line 201 of file PatchDataLayerLayout.hpp.

Here is the call graph for this function:

◆ check_field_type()

template<class T>
bool shamrock::patch::PatchDataLayerLayout::check_field_type ( u32 idx)
inline

check that field of id @idx is of type T

Template Parameters
T
Parameters
idx
Returns
true
false

Definition at line 326 of file PatchDataLayerLayout.hpp.

◆ check_main_field_type()

template<class T>
bool shamrock::patch::PatchDataLayerLayout::check_main_field_type ( )
inline

check that main field (id=0)is of type T

Template Parameters
T
Returns
true
false

Definition at line 154 of file PatchDataLayerLayout.hpp.

Here is the call graph for this function:

◆ for_each_field_any()

template<class Functor>
void shamrock::patch::PatchDataLayerLayout::for_each_field_any ( Functor && func) const
inline

for each visit of each field

Template Parameters
Functorthe signature of the lambda must be : [?](auto & arg){...}
Parameters
func

Definition at line 186 of file PatchDataLayerLayout.hpp.

◆ get_description_str()

std::string shamrock::patch::PatchDataLayerLayout::get_description_str ( ) const

Get the description of the layout.

Returns
std::string

Definition at line 24 of file PatchDataLayerLayout.cpp.

◆ get_field() [1/2]

template<class T>
PatchDataLayerLayout::FieldDescriptor< T > shamrock::patch::PatchDataLayerLayout::get_field ( const std::string & field_name)
inline

Get the field description id if matching name & type.

Template Parameters
T
Parameters
field_name
Returns
FieldDescriptor<T>

Definition at line 298 of file PatchDataLayerLayout.hpp.

Here is the call graph for this function:

◆ get_field() [2/2]

template<class T>
PatchDataLayerLayout::FieldDescriptor< T > shamrock::patch::PatchDataLayerLayout::get_field ( u32 idx)
inline

Get the field description at given index.

Template Parameters
T
Parameters
idx
Returns
FieldDescriptor<T>

Definition at line 314 of file PatchDataLayerLayout.hpp.

Here is the call graph for this function:

◆ get_field_idx() [1/2]

template<class T>
u32 shamrock::patch::PatchDataLayerLayout::get_field_idx ( const std::string & field_name) const

Get the field id if matching name & type.

Template Parameters
T
Parameters
field_name
Returns
u32

Definition at line 130 of file PatchDataLayerLayout.cpp.

Here is the call graph for this function:

◆ get_field_idx() [2/2]

template<class T>
u32 shamrock::patch::PatchDataLayerLayout::get_field_idx ( const std::string & field_name,
u32 nvar ) const

Get the field id if matching name & type & nvar.

Template Parameters
T
Parameters
field_name
nvar
Returns
u32

Definition at line 149 of file PatchDataLayerLayout.cpp.

Here is the call graph for this function:

◆ get_field_names()

std::vector< std::string > shamrock::patch::PatchDataLayerLayout::get_field_names ( )

Get the list of field names.

Returns
std::vector<std::string>

Definition at line 87 of file PatchDataLayerLayout.cpp.

◆ get_main_field_any()

const var_t & shamrock::patch::PatchDataLayerLayout::get_main_field_any ( ) const
inlinenodiscard

Get the main field description as a variant object.

Returns
const var_t& the variant field description

Definition at line 163 of file PatchDataLayerLayout.hpp.

◆ has_field_name()

bool shamrock::patch::PatchDataLayerLayout::has_field_name ( const std::string & field_name) const
nodiscard

Check whether a field with the given name already exists.

Parameters
field_namefield name to look up
Returns
true if a field with that name is already in the layout

Definition at line 99 of file PatchDataLayerLayout.cpp.

◆ operator==

bool operator== ( const PatchDataLayerLayout & lhs,
const PatchDataLayerLayout & rhs )
friend

Overloaded equality operator for PatchDataLayerLayout class.

This operator is used to check if two PatchDataLayerLayout objects are equal. It compares the fields of the objects and returns true if they are equal, and false otherwise.

Parameters
lhsThe first PatchDataLayerLayout object to compare
rhsThe second PatchDataLayerLayout object to compare
Returns
true if the two objects are equal, false otherwise

Definition at line 231 of file PatchDataLayerLayout.cpp.


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