41 std::uint32_t u32Sequence,
42 std::uint32_t u32Reference)
44 std::vector<std::string> names;
46 for(
int i = 0; i < statisticTable.names_size(); ++i)
48 names.push_back(statisticTable.names(i));
55 auto statisticTableInfo =
58 response.set_type(EMANERemoteControlPortAPI::Response::TYPE_RESPONSE_QUERY);
60 auto pQuery = response.mutable_query();
64 auto pStatisticTable = pQuery->mutable_statistictable();
66 pStatisticTable->set_buildid(statisticTable.buildid());
68 for(
const auto & table : statisticTableInfo)
70 auto pTable = pStatisticTable->add_tables();
72 pTable->set_name(table.first);
74 for(
const auto & row : table.second.second)
76 auto pRow = pTable->add_rows();
80 [pRow](
const Any & any)
82 auto pValue = pRow->add_values();
87 std::for_each(table.second.first.begin(),
88 table.second.first.end(),
89 [pTable](
const std::string & sLabel)
91 pTable->add_labels(sLabel);
97 response.set_type(EMANERemoteControlPortAPI::Response::TYPE_RESPONSE_ERROR);
99 auto pError = response.mutable_error();
101 pError->set_type(EMANERemoteControlPortAPI::Response::Error::TYPE_ERROR_PARAMETER);
103 pError->set_description(exp.
what());
106 response.set_reference(u32Reference);
108 response.set_sequence(u32Sequence);
110 std::string sSerialization;
112 if(!response.SerializeToString(&sSerialization))
117 return sSerialization;
int TYPE_QUERY_STATISTICTABLE
SerializationException is thrown when an exception occurs during serialization or deserialization of ...
std::map< std::string, std::pair< StatisticTableLabels, StatisticTableValues > > queryTable(BuildId, const std::vector< std::string > &names) const
const char * what() const
RegistrarException is thrown when an exception occurs during registration.
void convertToAny(EMANERemoteControlPortAPI::Any *pAny, const EMANE::Any &any)
static StatisticService * instance()
The Any class can contain an instance of one of any type in its support type set. ...
static std::string process(const EMANERemoteControlPortAPI::Request::Query::StatisticTable &statisticTable, std::uint32_t u32Sequence, std::uint32_t u32Reference)