98 bool,
short int, int,
long int, float, double,
99 long double, std::string, std::monostate, std::vector<int>,
100 std::vector<float>, std::vector<double>, std::vector<std::string>,
101 std::vector<std::vector<int>>, std::vector<std::vector<float>>,
102 std::vector<std::vector<double>>,
103 std::vector<std::vector<std::vector<int>>>,
104 std::vector<std::vector<std::vector<float>>>,
105 std::vector<std::vector<std::vector<double>>>
110 {0,
"bool"}, {1,
"short int"}, {2,
"int"}, {3,
"long int"}, {4,
"float"},
111 {5,
"double"}, {6,
"long double"}, {7,
"string"}, {8,
"std::monostate"},
112 {9,
"vector<int>"}, {10,
"vector<float>"}, {11,
"vector<double>"},
113 {12,
"vector<string>"}, {13,
"vector<vector<int>"},
114 {14,
"vector<vector<float>"}, {15,
"vector<vector<double>"},
115 {16,
"vector<vector<vector<int>>"}, {17,
"vector<vector<vector<float>>"},
116 {18,
"vector<vector<vector<double>>"}
155 template <typename T>
157 if (std::holds_alternative<T>(
data_)) {
158 return std::get<T>(
data_);
160 throw std::bad_variant_access();
248 friend std::ostream& operator<<(std::ostream& os, const
DObject& obj);
A universal data container class.
DObject()
Default constructor.
void runAllPlugins()
Executes all registered plugins in the registry.
void registerPlugin(const std::string &id, Plugin plugin)
Registers a plugin with the DObject.
std::map< int, std::string > dataTypeMap
int setErrorCode(int code) noexcept
const DataType & getData() const noexcept
Retrieves the data stored in the DObject.
std::variant< bool, short int, int, long int, float, double, long double, std::string, std::monostate, std::vector< int >, std::vector< float >, std::vector< double >, std::vector< std::string >, std::vector< std::vector< int > >, std::vector< std::vector< float > >, std::vector< std::vector< double > >, std::vector< std::vector< std::vector< int > > >, std::vector< std::vector< std::vector< float > > >, std::vector< std::vector< std::vector< double > > > > DataType
Supported data types for the DObject.
void setDebugging(bool enableDebug)
Enables or disables debugging and tracing for the DObject.
void runPlugin(const std::string &id)
Executes a plugin by its identifier.
void unregisterPlugin(const std::string &id)
Unregisters a plugin by its identifier.
void setData(const DataType &data)
Sets the data for the DObject.
T getDataAs() const
Retrieves the data stored in the DObject as a typed object so that std::get<T>() is not needed.
bool debugEnabled_
Indicates whether debugging is enabled.
DataType data_
The main data stored in the DObject.
int errorCode_
Error code tracked by the DObject.
bool isDebuggingEnabled() const noexcept
Checks if debugging is enabled for the DObject.
std::map< std::string, Plugin > plugins_
Registry for dynamically registered plugins.
std::function< void(DObject &)> Plugin
Placeholder type for plugins.
int getErrorCode() const noexcept
Get the error code tracked by the DObject.