Serialbox  2.2.0
Data serialization library and tools for C/C++, Python and Fortran
serialbox::gridtools::field_meta_info Class Reference

Meta-information of a data field. More...

#include <FieldMetainfo.h>

Public Member Functions

 field_meta_info ()
 Default constructor.
 
 field_meta_info (type_id type, const std::vector< int > &dims, const meta_info_map &meta_info)
 Construct field meta-information. More...
 
 field_meta_info (type_id type, const std::vector< int > &dims)
 Construct field meta-information. More...
 
template<class StorageType , class = typename std::enable_if<!std::is_same<typename std::decay<StorageType>::type, field_meta_info>::value>::type>
 field_meta_info (const StorageType &storage)
 Construct field meta-information with a gridtools storage. More...
 
 field_meta_info (const field_meta_info &other)=default
 Copy constructor. More...
 
 field_meta_info (field_meta_info &&)=default
 Move constructor.
 
field_meta_infooperator= (const field_meta_info &other)=default
 Copy assignment. More...
 
field_meta_infooperator= (field_meta_info &&)=default
 Move assignment.
 
field_meta_info clone () const
 Clone the current field_meta_info object by performing a deep copy. More...
 
 field_meta_info (const std::shared_ptr< FieldMetainfoImpl > &field_meta_info_ptr)
 Construct with FieldMetainfoImpl (internal use)
 
void swap (field_meta_info &other) noexcept
 Swap with other.
 
bool operator== (const field_meta_info &right) const noexcept
 Test for equality.
 
bool operator!= (const field_meta_info &right) const noexcept
 Test for inequality.
 
meta_info_map meta_info () const noexcept
 Access meta-info map.
 
const std::shared_ptr< FieldMetainfoImpl > & impl () const
 Get implementation pointer.
 
type_idtype () noexcept
 Access type_id.
 
const type_idtype () const noexcept
 
std::vector< int > & dims () noexcept
 Access dimensions.
 
const std::vector< int > & dims () const noexcept
 

Friends

std::ostream & operator<< (std::ostream &stream, const field_meta_info &f)
 Convert to stream.
 

Detailed Description

Meta-information of a data field.

Definition at line 33 of file FieldMetainfo.h.

Constructor & Destructor Documentation

◆ field_meta_info() [1/4]

serialbox::gridtools::field_meta_info::field_meta_info ( type_id  type,
const std::vector< int > &  dims,
const meta_info_map meta_info 
)
inline

Construct field meta-information.

Further meta-information can be added later on with field_meta_info::meta_info.

Parameters
typeType of the field
dimsDimension of the field
metaInfoMeta-information of the field

Definition at line 45 of file FieldMetainfo.h.

◆ field_meta_info() [2/4]

serialbox::gridtools::field_meta_info::field_meta_info ( type_id  type,
const std::vector< int > &  dims 
)
inline

Construct field meta-information.

Meta-information can be added later on with field_meta_info::meta_info.

Parameters
typeType of the field
dimsDimension of the field

Definition at line 54 of file FieldMetainfo.h.

◆ field_meta_info() [3/4]

template<class StorageType , class = typename std::enable_if<!std::is_same<typename std::decay<StorageType>::type, field_meta_info>::value>::type>
serialbox::gridtools::field_meta_info::field_meta_info ( const StorageType &  storage)
inline

Construct field meta-information with a gridtools storage.

Parameters
storagegridtools storage

Definition at line 63 of file FieldMetainfo.h.

◆ field_meta_info() [4/4]

serialbox::gridtools::field_meta_info::field_meta_info ( const field_meta_info other)
default

Copy constructor.

This performs a shallow copy, meaning the objects share the same underlying FieldMetainfoImpl. To deep copy the object call field_meta_info::clone().

Example

field_meta_info f1(type_id::Float32, std::vector<int>{10, 23, 30});
f1.meta_info().insert("key", true);
assert(f1 == f2); // f1 and f2 are equal as they share the same FieldMetainfoImpl
See also
field_meta_info::clone()

Member Function Documentation

◆ clone()

field_meta_info serialbox::gridtools::field_meta_info::clone ( ) const
inline

Clone the current field_meta_info object by performing a deep copy.

Example

field_meta_info f1(type_id::Float32, std::vector<int>{10, 23, 30});
field_meta_info f2 = f1.clone();
f1.meta_info().insert("key", true);
assert(f1 != f2); // f1 and f2 are NOT equal as the don't share the same FieldMetainfoImpl

Definition at line 122 of file FieldMetainfo.h.

◆ operator=()

field_meta_info& serialbox::gridtools::field_meta_info::operator= ( const field_meta_info other)
default

Copy assignment.

This performs a shallow copy, meaning the objects share the same underlying FieldMetainfoImpl. To deep copy the object call field_meta_info::clone().

Example ///

field_meta_info f1(type_id::Float32, std::vector<int>{10, 23, 30});
f1.meta_info().insert("key", true);
assert(f1 == f2); // f1 and f2 are equal as they share the same FieldMetainfoImpl
See also
field_meta_info::clone()

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