IOFormat 1.12.0
Loading...
Searching...
No Matches
GeneralOptions.h
1#pragma once
2
3#include <ioformat/IOFormatAPI.h>
4#include <ioformat/OptionMap.h>
5
6namespace ioformat
7{
8
31class IOFORMAT_API GeneralOptions : public OptionMap
32{
33public:
34 GeneralOptions() = default;
35 ~GeneralOptions() = default;
36
37 GeneralOptions(const GeneralOptions& other) = default;
38 GeneralOptions& operator=(const GeneralOptions& other) = default;
39 GeneralOptions(GeneralOptions&& other) noexcept = default;
40 GeneralOptions& operator=(GeneralOptions&& other) noexcept = default;
41
42 // ====== //
43 // BASICS //
44 // ====== //
45
49 bool has(const std::string& key) const;
50
54 iolink::DataType dtype(const std::string& key) const;
55
59 size_t count(const std::string& key) const;
60
64 void remove(const std::string& key);
65
66 // === //
67 // GET //
68 // === //
69
73 bool getBool(const std::string& key) const;
74
78 const std::string& getString(const std::string& key) const;
79
83 const int64_t* getIntPtr(const std::string& key) const;
84
88 int64_t getInt(const std::string& key, size_t index) const;
89
93 int64_t getInt(const std::string& key) const;
94
98 const double* getFloatPtr(const std::string& key) const;
99
103 double getFloat(const std::string& key, size_t index) const;
104
108 double getFloat(const std::string& key) const;
109
110 // === //
111 // SET //
112 // === //
113
117 void setBool(const std::string& key, bool value);
118
122 void setString(const std::string& key, const std::string& value);
123
127 void setInt(const std::string& key, const int64_t* values, size_t count);
128
132 void setInt(const std::string& key, int64_t value);
133
137 void setFloat(const std::string& key, const double* values, size_t count);
138
142 void setFloat(const std::string& key, double value);
143
162 OptionMap select(const std::string& plugin, const std::string& format) const;
163
164private:
165 std::string convert(const std::string& key) const;
166};
167
168} // namespace ioformat
A collection of general options.
Definition GeneralOptions.h:32
const int64_t * getIntPtr(const std::string &key) const
Get a pointer to the integer array first value.
bool has(const std::string &key) const
Check if a key is present.
const double * getFloatPtr(const std::string &key) const
Get a pointer to the float array first value.
void setFloat(const std::string &key, const double *values, size_t count)
Associate a float array with a specific key.
void remove(const std::string &key)
Remove a key from the option map.
iolink::DataType dtype(const std::string &key) const
Get the option data type.
void setString(const std::string &key, const std::string &value)
Associate a string value with a specific key.
void setBool(const std::string &key, bool value)
Associate a boolean value with a specific key.
double getFloat(const std::string &key, size_t index) const
Get the float value at the given index.
void setInt(const std::string &key, const int64_t *values, size_t count)
Associate an integer array with a specific key.
int64_t getInt(const std::string &key) const
Get an integer value.
OptionMap select(const std::string &plugin, const std::string &format) const
Select a subset of options.
void setFloat(const std::string &key, double value)
Associate a float value with a specific key.
int64_t getInt(const std::string &key, size_t index) const
Get the integer value at a given index.
size_t count(const std::string &key) const
Get the number of values associated with a key.
void setInt(const std::string &key, int64_t value)
Associate an integer value with a specific key.
double getFloat(const std::string &key) const
Get a float value.
const std::string & getString(const std::string &key) const
Get a string value.
bool getBool(const std::string &key) const
Get a boolean value.
A map of heterogeneous options.
Definition OptionMap.h:34
Global namespace which contains all methods to encode/decode data from/into different resources (file...
Definition Error.h:6