Loading...
Searching...
No Matches
Metadata Class Reference

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.

## Detailed Description

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.

## Constructor & Destructor Documentation

## Metadata() [1/2]

Metadata::Metadata | ( |  | ) |

default

Default constructor for Metadata.

## Metadata() [2/2]

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.

Definition at line 40 of file Metadata.cpp.

## Member Function Documentation

## 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.

Definition at line 50 of file Metadata.cpp.

## 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.

Definition at line 74 of file Metadata.cpp.

## 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.

Definition at line 98 of file Metadata.cpp.

## 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.

Definition at line 120 of file Metadata.cpp.

## 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.

Definition at line 62 of file Metadata.cpp.

## 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.

Definition at line 86 of file Metadata.cpp.

## 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.

Definition at line 132 of file Metadata.cpp.

## 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.

Definition at line 109 of file Metadata.cpp.

## Friends And Related Symbol Documentation

## 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.

Definition at line 146 of file Metadata.cpp.

## Member Data Documentation

## byteSize_

int Metadata::byteSize_ = 0

private

Total size of the data in bytes.

Definition at line 126 of file Metadata.h.

## dataType_

std::string Metadata::dataType_

private

Type of the data (e.g., "float", "double").

Definition at line 127 of file Metadata.h.

## debugFlag_

bool Metadata::debugFlag_ = false

private

Indicates whether debugging is enabled.

Definition at line 129 of file Metadata.h.

## dimensions_

std::vector<std::size_t> Metadata::dimensions_

private

Dimensions of the data (e.g., {3, 4} for a 3x4 matrix).

Definition at line 128 of file Metadata.h.

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

- src/dobj/public/Metadata.h
- src/dobj/private/Metadata.cpp