Name updated, Categories folder to ModbuPoints, less generic to be self documented

This commit is contained in:
2025-09-15 12:51:34 -05:00
parent 5a0b02ccdf
commit 14cf23281d
24 changed files with 274 additions and 297 deletions

View File

@@ -18,7 +18,7 @@
// Forward Declarations
template<typename T> class State;
template<typename T> class ModbusPoint;
template<typename T> class Modbus_Point;
/**
* @class Equipment
@@ -63,26 +63,26 @@ public:
/**
* @brief Adds a Modbus point to the equipment's internal map.
* @param description The unique string description used as a key.
* @param point A pointer to the ModbusPoint object.
* @param point A pointer to the Modbus_Point object.
*/
void addModbusPoint(const std::string& description, ModbusPoint<T>* point);
void addModbus_Point(const std::string& description, Modbus_Point<T>* point);
/**
* @brief Retrieves a Modbus point by its description.
* @param description The string key for the Modbus point.
* @return A pointer to the ModbusPoint object, or nullptr if not found.
* @return A pointer to the Modbus_Point object, or nullptr if not found.
*/
ModbusPoint<T>* getModbusPoint(const std::string& description);
Modbus_Point<T>* getModbus_Point(const std::string& description);
/**
* @brief Sets the value of a specific Modbus point.
* @param description The string key for the Modbus point.
* @param value The value to set. Note: This float may be truncated or cast
* depending on the underlying point's `setValue` implementation.
*/
void setModbusPoint(const std::string& description, float value);
void setModbus_Point(const std::string& description, float value);
private:
State<T>* _state; /**< @brief Pointer to the current state object. */
std::map<std::string, ModbusPoint<T>*> _points;/**< @brief Map of all Modbus points, keyed by description. */
std::map<std::string, Modbus_Point<T>*> _points;/**< @brief Map of all Modbus points, keyed by description. */
int _stateId; /**< @brief A simple integer identifier for the current state. */
T* _server;
};
@@ -141,20 +141,20 @@ void Equipment<T>::exitState() {
* The point is added to a map for quick lookup by description and to a
* vector for simple iteration.
* @param description The unique string description used as a key.
* @param point A pointer to the ModbusPoint object.
* @param point A pointer to the Modbus_Point object.
*/
template<typename T>
void Equipment<T>::addModbusPoint(const std::string& description, ModbusPoint<T>* point) {
void Equipment<T>::addModbus_Point(const std::string& description, Modbus_Point<T>* point) {
this->_points[description] = point;
}
/**
* @brief Retrieves a Modbus point by its description.
* @param description The string key for the Modbus point.
* @return A pointer to the ModbusPoint object, or nullptr if not found.
* @return A pointer to the Modbus_Point object, or nullptr if not found.
*/
template<typename T>
ModbusPoint<T>* Equipment<T>::getModbusPoint(const std::string& description) {
Modbus_Point<T>* Equipment<T>::getModbus_Point(const std::string& description) {
auto it = this->_points.find(description);
if (it != this->_points.end()) {
return it->second;
@@ -169,8 +169,8 @@ ModbusPoint<T>* Equipment<T>::getModbusPoint(const std::string& description) {
* @param value The value to set. This float is cast to an int before being passed.
*/
template<typename T>
void Equipment<T>::setModbusPoint(const std::string& description, float value) {
ModbusPoint<T>* point = getModbusPoint(description);
void Equipment<T>::setModbus_Point(const std::string& description, float value) {
Modbus_Point<T>* point = getModbus_Point(description);
if (point != nullptr) {
point->setValue(value);
}