NNSize
class NNSize
{
public:
NNSize();
NNSize(uint32_t width, uint32_t height);
public:
void setWidth(uint32_t width);
uint32_t getWidth();
void setHeight(uint32_t height);
uint32_t getHeight();
public:
virtual std::string getType();
virtual std::string toString();
virtual std::shared_ptr<NNSize> clone(bool deep);
};
Introduction to the class
Represents the size of an object defined by its width and height.
The `NNSize` class provides methods to set and get the width and height of the size, as well as methods to retrieve the type of the size and to generate a string representation of it.
Additionally, it includes a method to clone the size object, optionally performing a deep copy. However, for a simple class like `NNSize` that contains only primitive types, a deep copy is typically not necessary and would be equivalent to a shallow copy.
Introduction to the Class's Methods
NNSize()
brief: Default constructor. Initializes the size with default values (typically zero).
NNSize(uint32_t width, uint32_t height)
brief: Parameterized constructor. Initializes the size with the specified width and height.
param
width: The width of the size.
height: The height of the size.
void setWidth(uint32_t width)
brief: Sets the width of the size.
param
width: The new width.
uint32_t getWidth()
brief: Gets the width of the size.
return uint32_t: The width of the size.
void setHeight(uint32_t height)
brief: Sets the height of the size.
param
height: The new height.
uint32_t getHeight()
brief: Gets the height of the size.
return uint32_t: The height of the size.
std::string getType()
brief: Gets the type of the size.
return string: A string representing the type of the size.
std::string toString()
brief: Generates a string representation of the size.
return string: A string representation of the size.
std::shared_ptr<NNSize> clone(bool deep)
brief: Creates a copy of the size. This method provides an option for deep copying, though in this simple class deep and shallow copying are equivalent.
param
deep: A boolean indicating whether to perform a deep copy. In this class, it has no effect.
return shared_ptr<NNSize>: A shared pointer to a copy of the size.