7 #pragma GCC diagnostic push
8 #pragma GCC diagnostic ignored "-Wold-style-cast"
9 #include "stg/INTEGER.h"
10 #pragma GCC diagnostic pop
12 void UsersSensor::GetValue(ObjectSyntax_t * objectSyntax) const
14 int handle = users.OpenSearch();
15 assert(handle && "USERS::OpenSearch is always correct");
19 while (!users.SearchNext(handle, &user))
21 if (UserPredicate(user))
25 users.CloseSearch(handle);
27 ValueToOS(count, objectSyntax);
31 std::string UsersSensor::ToString() const
33 int handle = users.OpenSearch();
34 assert(handle && "USERS::OpenSearch is always correct");
38 while (!users.SearchNext(handle, &user))
40 if (UserPredicate(user))
44 users.CloseSearch(handle);
46 return std::to_string(count);
50 bool ActiveUsersSensor::UserPredicate(STG::User* userPtr) const
52 if (!userPtr->GetConnected())
54 for (size_t i = 0; i < DIR_NUM; ++i)
56 if (userPtr->GetSessionUpload()[i] > 0 ||
57 userPtr->GetSessionDownload()[i] > 0)