-#ifndef __SENSORS_H__
-#define __SENSORS_H__
+#pragma once
-#include <map>
+#include "value2os.h"
+#include "types.h"
#include "stg/users.h"
#include "stg/user.h"
#include "stg/traffcounter.h"
#include "stg/user_property.h"
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wold-style-cast"
#include "stg/ObjectSyntax.h"
+#pragma GCC diagnostic pop
-#include "value2os.h"
-#include "types.h"
+#include <map>
class Sensor {
public:
virtual ~Sensor() = default;
- virtual bool GetValue(ObjectSyntax_t * objectSyntax) const = 0;
+ virtual void GetValue(ObjectSyntax_t * objectSyntax) const = 0;
#ifdef DEBUG
virtual std::string ToString() const = 0;
#endif
public:
explicit TotalUsersSensor(const STG::Users & u) : users(u) {}
- bool GetValue(ObjectSyntax_t * objectSyntax) const override
+ void GetValue(ObjectSyntax_t * objectSyntax) const override
{
ValueToOS(users.Count(), objectSyntax);
- return true;
}
#ifdef DEBUG
public:
explicit UsersSensor(STG::Users & u) : users(u) {}
- bool GetValue(ObjectSyntax_t * objectSyntax) const override;
+ void GetValue(ObjectSyntax_t * objectSyntax) const override;
#ifdef DEBUG
std::string ToString() const override;
#endif
public:
explicit TotalTariffsSensor(const STG::Tariffs & t) : tariffs(t) {}
- bool GetValue(ObjectSyntax_t * objectSyntax) const override
+ void GetValue(ObjectSyntax_t * objectSyntax) const override
{
ValueToOS(tariffs.Count(), objectSyntax);
- return true;
}
#ifdef DEBUG
public:
explicit TotalAdminsSensor(const STG::Admins & a) : admins(a) {}
- bool GetValue(ObjectSyntax_t * objectSyntax) const override
+ void GetValue(ObjectSyntax_t * objectSyntax) const override
{
ValueToOS(admins.count(), objectSyntax);
- return true;
}
#ifdef DEBUG
public:
explicit TotalServicesSensor(const STG::Services & s) : services(s) {}
- bool GetValue(ObjectSyntax_t * objectSyntax) const override
+ void GetValue(ObjectSyntax_t * objectSyntax) const override
{
ValueToOS(services.Count(), objectSyntax);
- return true;
}
#ifdef DEBUG
public:
explicit TotalCorporationsSensor(const STG::Corporations & c) : corporations(c) {}
- bool GetValue(ObjectSyntax_t * objectSyntax) const override
+ void GetValue(ObjectSyntax_t * objectSyntax) const override
{
ValueToOS(corporations.Count(), objectSyntax);
- return true;
}
#ifdef DEBUG
public:
explicit TotalRulesSensor(const STG::TraffCounter & t) : traffcounter(t) {}
- bool GetValue(ObjectSyntax_t * objectSyntax) const override
+ void GetValue(ObjectSyntax_t * objectSyntax) const override
{
ValueToOS(traffcounter.rulesCount(), objectSyntax);
- return true;
}
#ifdef DEBUG
public:
explicit ConstSensor(const T & v) : value(v) {}
- bool GetValue(ObjectSyntax * objectSyntax) const override
- { return ValueToOS(value, objectSyntax); }
+ void GetValue(ObjectSyntax * objectSyntax) const override
+ {
+ ValueToOS(value, objectSyntax);
+ }
#ifdef DEBUG
std::string ToString() const override
return value;
}
#endif
-
-#endif