SERiF 0.0.1a
3+1D Stellar Structure and Evolution
Loading...
Searching...
No Matches
Metadata.h
Go to the documentation of this file.
1/* ***********************************************************************
2//
3// Copyright (C) 2025 -- The 4D-STAR Collaboration
4// File Author: Emily Boudreaux
5// Last Modified: March 17, 2025
6//
7// 4DSSE is free software; you can use it and/or modify
8// it under the terms and restrictions the GNU General Library Public
9// License version 3 (GPLv3) as published by the Free Software Foundation.
10//
11// 4DSSE is distributed in the hope that it will be useful,
12// but WITHOUT ANY WARRANTY; without even the implied warranty of
13// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
14// See the GNU Library General Public License for more details.
15//
16// You should have received a copy of the GNU Library General Public License
17// along with this software; if not, write to the Free Software
18// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19//
20// *********************************************************************** */
21#ifndef METADATA_H
22#define METADATA_H
23
24#if defined(__APPLE__) || defined(__linux__)
25#define EXPORT_SYMBOL __attribute__((visibility("default")))
26#else
27#define EXPORT_SYMBOL
28#endif
29
30#include <string>
31#include <vector>
32#include <cstddef>
33#include <iostream>
34
42
52public:
56 Metadata() = default;
57
66 Metadata(std::size_t byteSize, std::string dataType, std::vector<std::size_t> dimensions, bool debugFlag = false);
67
72 [[nodiscard]] std::size_t getByteSize() const noexcept;
73
78 void setByteSize(std::size_t byteSize) noexcept;
79
84 [[nodiscard]] const std::string& getDataType() const noexcept;
85
90 void setDataType(const std::string& dataType);
91
96 [[nodiscard]] const std::vector<std::size_t>& getDimensions() const noexcept;
97
102 void setDimensions(const std::vector<std::size_t>& dimensions);
103
108 [[nodiscard]] bool isDebugEnabled() const noexcept;
109
114 void setDebugEnabled(bool debugFlag) noexcept;
115
123 friend std::ostream& operator<<(std::ostream& os, const Metadata& metadata);
124
125private:
126 int byteSize_ = 0;
127 std::string dataType_;
128 std::vector<std::size_t> dimensions_;
129 bool debugFlag_ = false;
130};
131
132#endif // METADATA_H
#define EXPORT_SYMBOL
Definition Metadata.h:27
void setByteSize(std::size_t byteSize) noexcept
Sets the total size of the data in bytes.
Definition Metadata.cpp:62
std::vector< std::size_t > dimensions_
Dimensions of the data (e.g., {3, 4} for a 3x4 matrix).
Definition Metadata.h:128
std::string dataType_
Type of the data (e.g., "float", "double").
Definition Metadata.h:127
void setDebugEnabled(bool debugFlag) noexcept
Sets the debugging flag.
Definition Metadata.cpp:132
const std::vector< std::size_t > & getDimensions() const noexcept
Gets the dimensions of the data.
Definition Metadata.cpp:98
bool debugFlag_
Indicates whether debugging is enabled.
Definition Metadata.h:129
void setDataType(const std::string &dataType)
Sets the type of the data.
Definition Metadata.cpp:86
bool isDebugEnabled() const noexcept
Checks if debugging information is enabled.
Definition Metadata.cpp:120
int byteSize_
Total size of the data in bytes.
Definition Metadata.h:126
std::size_t getByteSize() const noexcept
Gets the total size of the data in bytes.
Definition Metadata.cpp:50
Metadata()=default
Default constructor for Metadata.
const std::string & getDataType() const noexcept
Gets the type of the data.
Definition Metadata.cpp:74
void setDimensions(const std::vector< std::size_t > &dimensions)
Sets the dimensions of the data.
Definition Metadata.cpp:109