NNObject
class NNObject
{
public:
virtual uint64_t getID();
virtual void setID(uint64_t dataID);
virtual uint64_t getTime();
public:
// Integer data storage and retrieval methods
virtual void setInt(uint32_t key, int32_t value);
virtual int getInt(uint32_t key, int32_t& value);
// Boolean data storage and retrieval methods
virtual void setBool(uint32_t key, bool value);
virtual int getBool(uint32_t key, bool& value);
// Float data storage and retrieval methods
virtual void setFloat(uint32_t key, float value);
virtual int getFloat(uint32_t key, float& value);
// String data storage and retrieval methods
virtual void setString(uint32_t key, std::string value);
virtual int getString(uint32_t key, std::string& value);
// Raw data storage and retrieval methods
virtual void setRawData(uint32_t key, std::shared_ptr<NNRawData> value);
virtual int getRawData(uint32_t key, std::shared_ptr<NNRawData>& value);
};
Introduction to the class
A base class for neural network objects that encapsulates common attributes and methods for data storage and retrieval.
This class provides a framework for storing and retrieving various types of data (integers, booleans, floats, strings, and raw data) associated with a unique ID and timestamp. It uses virtual methods to allow for extension and customization in derived classes.
Introduction to the class's methods
uint64_t getID()
brief: Gets the unique ID associated with this object
return uint64_t: The unique ID.
void setID(uint64_t dataID)
brief: Sets the unique ID for this object.
param
dataID: A shared pointer to an `NNResultListener` object.
uint64_t getTime()
brief: Gets the timestamp associated with this object.
return uint64_t: The timestamp.
void setInt(uint32_t key, int32_t value)
brief: Sets an integer value associated with a specific key.
param
key: The key to associate the value with.
value: The integer value to set.
int getInt(uint32_t key, int32_t& value)
brief: Gets an integer value associated with a specific key.
param
key: The key to retrieve the value for.
value: A reference to store the retrieved integer value.
return int: 0 if the key is found and value is set, otherwise a non-zero error code.
void setBool(uint32_t key, bool value)
brief: Sets an boolean value associated with a specific key.
param
key: The key to associate the value with.
value: The boolean value to set.
int getBool(uint32_t key, bool& value)
brief: Gets an boolean value associated with a specific key.
param
key: The key to retrieve the value for.
value: A reference to store the retrieved boolean value..
return bool: 0 if the key is found and value is set, otherwise a non-zero error code.
void setFloat(uint32_t key, float value)
brief: Sets an float value associated with a specific key.
param
key: The key to associate the value with.
value: The float value to set.
int getFloat(uint32_t key, float& value)
brief: Gets an float value associated with a specific key.
param
key: The key to retrieve the value for.
value: A reference to store the retrieved float value.
return float: 0 if the key is found and value is set, otherwise a non-zero error code.
void setString(uint32_t key, std::string value)
brief: Sets an string value associated with a specific key.
param
key: The key to associate the value with.
value: The string value to set.
int getString(uint32_t key, std::string& value)
brief: Gets an string value associated with a specific key.
param
key: The key to retrieve the value for.
value: A reference to store the retrieved string value..
return float: 0 if the key is found and value is set, otherwise a non-zero error code.
void setRawData(uint32_t key, std::shared_ptr<NNRawData> value)
brief: Sets raw data associated with a specific key.
param
key: The key to associate the value with.
value: The shared pointer to raw data to set.
int getRawData(uint32_t key, std::shared_ptr<NNRawData>& value)
brief: Gets raw data associated with a specific key.
param
key: The key to retrieve the value for.
value: A reference to store the retrieved shared pointer to raw data.
return float: 0 if the key is found and value is set, otherwise a non-zero error code.