Advanced Multi-Physics (AMP)
On-Line Documentation
Public Types | Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
AMP::KeyData Class Referenceabstract

Base class to hold data of a given type. More...

#include <Database.h>

Inheritance diagram for AMP::KeyData:
Inheritance graph
[legend]

Public Types

using source_location = StackTrace::source_location
 

Public Member Functions

virtual ArraySize arraySize () const =0
 Return the array size.
 
virtual std::unique_ptr< KeyDataclone () const =0
 Copy the data.
 
virtual Array< double > convertToDouble () const =0
 Return the data as a Array<double> (throw error if this is not valid)
 
virtual Array< int64_t > convertToInt64 () const =0
 Return the data as a Array<int64_t> (throw error if this is not valid)
 
double convertUnits (const Units &, std::string_view="") const
 Return the conversion factor (if used)
 
template<class TYPE >
Array< TYPE > getArray (const Units &unit={}, std::string_view name="", source_location src=source_location::current()) const
 Convert the data to a scalar of the given type.
 
virtual typeID getClassType () const =0
 Return class type.
 
virtual typeID getDataType () const =0
 
template<class TYPE >
TYPE getScalar (const Units &unit={}, std::string_view name="", source_location src=source_location::current()) const
 Convert the data to a scalar of the given type.
 
virtual bool is_floating_point () const =0
 Return true if the type is a floating point type.
 
virtual bool is_integral () const =0
 Return true if the type is a integer point type.
 
template<class TYPE >
bool isType () const
 
bool operator!= (const KeyData &rhs) const
 Check if two sets of data are not equal.
 
virtual bool operator== (const KeyData &rhs) const =0
 Check if two sets of data are equal.
 
virtual size_t pack (std::byte *) const =0
 Pack the data to a buffer.
 
virtual size_t packSize () const =0
 Return the number of bytes required to pack the data.
 
virtual void print (std::ostream &os, std::string_view indent="", bool sort=true, bool printType=false) const =0
 Print the data to a stream.
 
virtual void readHDF5 (int64_t fid, const std::string &name)=0
 Read the data from HDF5.
 
const Unitsunit () const
 Return the units.
 
virtual size_t unpack (const std::byte *)=0
 Unpack the data from a buffer.
 
virtual void writeHDF5 (int64_t fid, const std::string &name) const =0
 Write the data to HDF5.
 
virtual ~KeyData ()
 Destructor.
 

Protected Member Functions

 KeyData ()
 
 KeyData (const KeyData &)=delete
 
 KeyData (const Units &unit)
 
 KeyData (KeyData &&)=delete
 
KeyDataoperator= (const KeyData &)=delete
 
KeyDataoperator= (KeyData &&)=delete
 

Protected Attributes

Units d_unit
 

Detailed Description

Base class to hold data of a given type.

Definition at line 36 of file Database.h.

Member Typedef Documentation

◆ source_location

using AMP::KeyData::source_location = StackTrace::source_location

Definition at line 39 of file Database.h.

Constructor & Destructor Documentation

◆ ~KeyData()

virtual AMP::KeyData::~KeyData ( )
inlinevirtual

Destructor.

Definition at line 41 of file Database.h.

◆ KeyData() [1/4]

AMP::KeyData::KeyData ( )
inlineprotected

Definition at line 96 of file Database.h.

◆ KeyData() [2/4]

AMP::KeyData::KeyData ( const Units unit)
inlineprotected

Definition at line 97 of file Database.h.

◆ KeyData() [3/4]

AMP::KeyData::KeyData ( KeyData &&  )
protecteddelete

◆ KeyData() [4/4]

AMP::KeyData::KeyData ( const KeyData )
protecteddelete

Member Function Documentation

◆ arraySize()

virtual ArraySize AMP::KeyData::arraySize ( ) const
pure virtual

Return the array size.

Implemented in AMP::Database.

◆ clone()

virtual std::unique_ptr< KeyData > AMP::KeyData::clone ( ) const
pure virtual

Copy the data.

Implemented in AMP::Database.

◆ convertToDouble()

virtual Array< double > AMP::KeyData::convertToDouble ( ) const
pure virtual

Return the data as a Array<double> (throw error if this is not valid)

Implemented in AMP::Database.

◆ convertToInt64()

virtual Array< int64_t > AMP::KeyData::convertToInt64 ( ) const
pure virtual

Return the data as a Array<int64_t> (throw error if this is not valid)

Implemented in AMP::Database.

◆ convertUnits()

double AMP::KeyData::convertUnits ( const Units ,
std::string_view  = "" 
) const

Return the conversion factor (if used)

◆ getArray()

template<class TYPE >
Array< TYPE > AMP::KeyData::getArray ( const Units unit = {},
std::string_view  name = "",
source_location  src = source_location::current() 
) const

Convert the data to a scalar of the given type.

◆ getClassType()

virtual typeID AMP::KeyData::getClassType ( ) const
pure virtual

Return class type.

Implemented in AMP::Database.

◆ getDataType()

virtual typeID AMP::KeyData::getDataType ( ) const
pure virtual

Implemented in AMP::Database.

◆ getScalar()

template<class TYPE >
TYPE AMP::KeyData::getScalar ( const Units unit = {},
std::string_view  name = "",
source_location  src = source_location::current() 
) const

Convert the data to a scalar of the given type.

◆ is_floating_point()

virtual bool AMP::KeyData::is_floating_point ( ) const
pure virtual

Return true if the type is a floating point type.

Implemented in AMP::Database.

◆ is_integral()

virtual bool AMP::KeyData::is_integral ( ) const
pure virtual

Return true if the type is a integer point type.

Implemented in AMP::Database.

◆ isType()

template<class TYPE >
bool AMP::KeyData::isType ( ) const

◆ operator!=()

bool AMP::KeyData::operator!= ( const KeyData rhs) const
inline

Check if two sets of data are not equal.

Definition at line 69 of file Database.h.

References operator==().

◆ operator=() [1/2]

KeyData & AMP::KeyData::operator= ( const KeyData )
protecteddelete

◆ operator=() [2/2]

KeyData & AMP::KeyData::operator= ( KeyData &&  )
protecteddelete

◆ operator==()

virtual bool AMP::KeyData::operator== ( const KeyData rhs) const
pure virtual

Check if two sets of data are equal.

Implemented in AMP::Database.

Referenced by operator!=().

◆ pack()

virtual size_t AMP::KeyData::pack ( std::byte *  ) const
pure virtual

Pack the data to a buffer.

Implemented in AMP::Database.

◆ packSize()

virtual size_t AMP::KeyData::packSize ( ) const
pure virtual

Return the number of bytes required to pack the data.

Implemented in AMP::Database.

◆ print()

virtual void AMP::KeyData::print ( std::ostream &  os,
std::string_view  indent = "",
bool  sort = true,
bool  printType = false 
) const
pure virtual

Print the data to a stream.

Implemented in AMP::Database.

◆ readHDF5()

virtual void AMP::KeyData::readHDF5 ( int64_t  fid,
const std::string &  name 
)
pure virtual

Read the data from HDF5.

Implemented in AMP::Database.

◆ unit()

const Units & AMP::KeyData::unit ( ) const
inline

Return the units.

Definition at line 71 of file Database.h.

References d_unit.

Referenced by AMP::Database::addArgsWithUnits().

◆ unpack()

virtual size_t AMP::KeyData::unpack ( const std::byte *  )
pure virtual

Unpack the data from a buffer.

Implemented in AMP::Database.

◆ writeHDF5()

virtual void AMP::KeyData::writeHDF5 ( int64_t  fid,
const std::string &  name 
) const
pure virtual

Write the data to HDF5.

Implemented in AMP::Database.

Member Data Documentation

◆ d_unit

Units AMP::KeyData::d_unit
protected

Definition at line 105 of file Database.h.

Referenced by unit().


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



Advanced Multi-Physics (AMP)
Oak Ridge National Laboratory
Idaho National Laboratory
Los Alamos National Laboratory
This page automatically produced from the
source code by doxygen
Last updated: Tue Mar 10 2026 13:06:42.
Comments on this page