Represents metadata information for data objects in the dobj module.
More...
#include <Metadata.h>
|
|
| 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.
|
| |
|
| 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.
◆ 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.
- Parameters
-
| 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. |
◆ getByteSize()
| std::size_t Metadata::getByteSize |
( |
| ) |
const |
|
nodiscardnoexcept |
Gets the total size of the data in bytes.
- Returns
- The total byte size of the data.
The size is often required for memory allocation and validation in numerical routines.
- Returns
- The total byte size of the data.
◆ getDataType()
| const std::string & Metadata::getDataType |
( |
| ) |
const |
|
nodiscardnoexcept |
Gets the type of the data.
- Returns
- A string representing the data type.
The type (e.g., "float", "double") is critical for casting raw data or interfacing with libraries that require specific types.
- Returns
- A string representing the data type.
◆ getDimensions()
| const std::vector< std::size_t > & Metadata::getDimensions |
( |
| ) |
const |
|
nodiscardnoexcept |
Gets the dimensions of the data.
- Returns
- A vector representing the size of each dimension.
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.
- Returns
- A vector representing the size of each dimension.
◆ isDebugEnabled()
| bool Metadata::isDebugEnabled |
( |
| ) |
const |
|
nodiscardnoexcept |
Checks if debugging information is enabled.
- Returns
- True if debugging is enabled, false otherwise.
Debugging flags can be useful for tracking performance metrics or error provenance.
- Returns
- True if debugging is enabled, false otherwise.
◆ setByteSize()
| void Metadata::setByteSize |
( |
std::size_t | byteSize | ) |
|
|
noexcept |
Sets the total size of the data in bytes.
- Parameters
-
| 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.
- Parameters
-
| byteSize | The total byte size to set. |
◆ setDataType()
| void Metadata::setDataType |
( |
const std::string & | dataType | ) |
|
Sets the type of the data.
- Parameters
-
| 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.
- Parameters
-
| dataType | A string representing the data type. |
◆ setDebugEnabled()
| void Metadata::setDebugEnabled |
( |
bool | debugFlag | ) |
|
|
noexcept |
Sets the debugging flag.
- Parameters
-
| debugFlag | Whether debugging is enabled. |
Enabling debugging can introduce performance overhead but provides valuable insights during development or testing.
- Parameters
-
| debugFlag | Whether debugging is enabled. |
◆ setDimensions()
| void Metadata::setDimensions |
( |
const std::vector< std::size_t > & | dimensions | ) |
|
Sets the dimensions of the data.
- Parameters
-
| dimensions | A vector representing the size of each dimension. |
When modifying dimensions, verify that they are consistent with the actual data representation.
- Parameters
-
| dimensions | A vector representing the size of each dimension. |
◆ operator<<
| std::ostream & operator<< |
( |
std::ostream & | os, |
|
|
const Metadata & | metadata ) |
|
friend |
Prints the metadata information for debugging purposes.
- Parameters
-
| os | The output stream to print to. |
| metadata | The Metadata object to print. |
- Returns
- A reference to the output stream.
This function provides a human-readable summary of the metadata. Useful for quick checks or logging during debugging sessions.
- Parameters
-
| os | The output stream to print to. |
| metadata | The Metadata object to print. |
- Returns
- A reference to the output stream.
The documentation for this class was generated from the following files: