]> git.stg.codes - stg.git/blobdiff - projects/stargazer/plugins/other/smux/sensors.h
New sensor added: ActiveUsers
[stg.git] / projects / stargazer / plugins / other / smux / sensors.h
index 7c11751eca9551e5ee75f93910fcca8c773daf40..3787611f4263c3cbfe06fe10fac41f5e751b1e03 100644 (file)
@@ -18,6 +18,7 @@
 
 class Sensor {
     public:
+        virtual ~Sensor() {}
         virtual bool GetValue(ObjectSyntax_t * objectSyntax) const = 0;
 #ifdef DEBUG
         virtual std::string ToString() const = 0;
@@ -159,7 +160,16 @@ class TariffChangeUsersSensor : public UsersSensor {
 
     private:
         bool UserPredicate(USER_PTR userPtr) const
-        { return userPtr->GetProperty().nextTariff.ConstData().empty(); }
+        { return !userPtr->GetProperty().nextTariff.ConstData().empty(); }
+};
+
+class ActiveUsersSensor : public UsersSensor {
+    public:
+        ActiveUsersSensor(USERS & u) : UsersSensor(u) {}
+        virtual ~ActiveUsersSensor() {}
+
+    private:
+        bool UserPredicate(USER_PTR userPtr) const;
 };
 
 class TotalTariffsSensor : public Sensor {
@@ -280,11 +290,13 @@ class ConstSensor : public Sensor {
         T value;
 };
 
+#ifdef DEBUG
 template <>
 inline
 std::string ConstSensor<std::string>::ToString() const
 {
 return value;
 }
+#endif
 
 #endif