You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
lokinet/llarp/util/status.hpp

63 lines
1.1 KiB
C++

#ifndef LLARP_UTIL_STATUS_HPP
#define LLARP_UTIL_STATUS_HPP
#ifdef USE_ABYSS
#include <abyss/json.hpp>
#endif
#include <vector>
namespace llarp
{
namespace util
{
#ifdef USE_ABYSS
using StatusObject_Impl = ::abyss::json::Document;
using Value_t = ::abyss::json::Value;
#else
struct StatusObject_Impl
{
};
6 years ago
struct Value_t
{
}
#endif
struct StatusObject
{
StatusObject();
~StatusObject();
void
PutInt(const char* name, uint64_t val);
void
PutString(const char* name, const std::string& val);
void
PutBool(const char* name, bool val);
void
6 years ago
PutObject(const char* name, StatusObject& obj);
void
6 years ago
PutStringArray(const char* name, std::vector< std::string >& arr);
void
6 years ago
PutObjectArray(const char* name, std::vector< StatusObject >& arr);
StatusObject_Impl Impl;
};
/// an entity that has a status that can be extracted
struct IStateful
{
virtual ~IStateful(){};
virtual void
ExtractStatus(StatusObject& state) const = 0;
};
} // namespace util
} // namespace llarp
#endif