|
SERiF 0.0.1a
3+1D Stellar Structure and Evolution
|
Represents metadata information for data objects in the dobj module. More...
#include <Metadata.h>
Public Member Functions | |
| Metadata ()=default | |
| Default constructor for Metadata. | |
| Metadata (std::size_t byteSize, std::string dataType, std::vector< std::size_t > dimensions, bool debugFlag=false) | |
| Constructor to initialize Metadata with specific attributes. | |
| std::size_t | getByteSize () const noexcept |
| Gets the total size of the data in bytes. | |
| void | setByteSize (std::size_t byteSize) noexcept |
| Sets the total size of the data in bytes. | |
| const std::string & | getDataType () const noexcept |
| Gets the type of the data. | |
| void | setDataType (const std::string &dataType) |
| Sets the type of the data. | |
| const std::vector< std::size_t > & | getDimensions () const noexcept |
| Gets the dimensions of the data. | |
| void | setDimensions (const std::vector< std::size_t > &dimensions) |
| Sets the dimensions of the data. | |
| bool | isDebugEnabled () const noexcept |
| Checks if debugging information is enabled. | |
| void | setDebugEnabled (bool debugFlag) noexcept |
| Sets the debugging flag. | |
Private Attributes | |
| int | byteSize_ = 0 |
| Total size of the data in bytes. | |
| std::string | dataType_ |
| Type of the data (e.g., "float", "double"). | |
| std::vector< std::size_t > | dimensions_ |
| Dimensions of the data (e.g., {3, 4} for a 3x4 matrix). | |
| bool | debugFlag_ = false |
| Indicates whether debugging is enabled. | |
Friends | |
| std::ostream & | operator<< (std::ostream &os, const Metadata &metadata) |
| Prints the metadata information for debugging purposes. | |
Represents metadata information for data objects in the dobj module.
The Metadata class encapsulates details such as data size, type, dimensions, and optional debugging flags. It is designed to provide descriptive attributes in a lightweight and efficient manner.
Definition at line 51 of file Metadata.h.
|
default |
Default constructor for Metadata.
| Metadata::Metadata | ( | std::size_t | byteSize, |
| std::string | dataType, | ||
| std::vector< std::size_t > | dimensions, | ||
| bool | debugFlag = false ) |
Constructor to initialize Metadata with specific attributes.
| byteSize | The total size of the data in bytes. |
| dataType | The type of the data (e.g., "float", "double"). |
| dimensions | A vector representing the size of each dimension (e.g., {3, 4} for a 3x4 matrix). |
| debugFlag | Whether debugging information is enabled for this Metadata instance. |
Definition at line 40 of file Metadata.cpp.
|
nodiscardnoexcept |
Gets the total size of the data in bytes.
The size is often required for memory allocation and validation in numerical routines.
Definition at line 50 of file Metadata.cpp.
|
nodiscardnoexcept |
Gets the type of the data.
The type (e.g., "float", "double") is critical for casting raw data or interfacing with libraries that require specific types.
Definition at line 74 of file Metadata.cpp.
|
nodiscardnoexcept |
Gets the dimensions of the data.
Dimensions define the shape of the data (e.g., 2D arrays, 3D matrices). This is essential for ensuring that operations (e.g., matrix multiplication) are performed correctly.
Definition at line 98 of file Metadata.cpp.
|
nodiscardnoexcept |
Checks if debugging information is enabled.
Debugging flags can be useful for tracking performance metrics or error provenance.
Definition at line 120 of file Metadata.cpp.
|
noexcept |
Sets the total size of the data in bytes.
| byteSize | The total byte size to set. |
It's important to ensure this matches the actual data size in memory to prevent overflows or incorrect computations downstream.
| byteSize | The total byte size to set. |
Definition at line 62 of file Metadata.cpp.
| void Metadata::setDataType | ( | const std::string & | dataType | ) |
Sets the type of the data.
| dataType | A string representing the data type. |
When setting the data type, ensure it aligns with the underlying data representation. Mismatched types can lead to undefined behavior in numerical calculations.
| dataType | A string representing the data type. |
Definition at line 86 of file Metadata.cpp.
|
noexcept |
Sets the debugging flag.
| debugFlag | Whether debugging is enabled. |
Enabling debugging can introduce performance overhead but provides valuable insights during development or testing.
| debugFlag | Whether debugging is enabled. |
Definition at line 132 of file Metadata.cpp.
| void Metadata::setDimensions | ( | const std::vector< std::size_t > & | dimensions | ) |
Sets the dimensions of the data.
| dimensions | A vector representing the size of each dimension. |
When modifying dimensions, verify that they are consistent with the actual data representation.
| dimensions | A vector representing the size of each dimension. |
Definition at line 109 of file Metadata.cpp.
|
friend |
Prints the metadata information for debugging purposes.
| os | The output stream to print to. |
| metadata | The Metadata object to print. |
This function provides a human-readable summary of the metadata. Useful for quick checks or logging during debugging sessions.
| os | The output stream to print to. |
| metadata | The Metadata object to print. |
Definition at line 146 of file Metadata.cpp.
|
private |
Total size of the data in bytes.
Definition at line 126 of file Metadata.h.
|
private |
Type of the data (e.g., "float", "double").
Definition at line 127 of file Metadata.h.
|
private |
Indicates whether debugging is enabled.
Definition at line 129 of file Metadata.h.
|
private |
Dimensions of the data (e.g., {3, 4} for a 3x4 matrix).
Definition at line 128 of file Metadata.h.