Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #pragma once
- #include "mapbox/variant.hpp"
- #include <map>
- #include <memory>
- namespace media {
- namespace diagnostic {
- using CounterVariant = mapbox::util::variant<
- vbl::baselong,
- vbl::CVBLString,
- SCounter
- >;
- struct CounterHolder {
- public:
- CounterHolder() = default;
- explicit CounterHolder(CounterVariant val)
- : valid(true)
- , value(val) {
- }
- CounterVariant& Get() {
- VBL_ASSERT(valid);
- return value;
- }
- vbl::basebool valid{ false };
- private:
- CounterVariant value;
- };
- using CounterMap = std::map<vbl::CVBLString, CounterHolder>;
- using CounterMapPtr = std::shared_ptr<CounterMap>;
- // IProvider represents a read-only interface for counter receiving.
- class IProvider {
- public:
- // Destroy.
- virtual ~IProvider() = default;
- // Returns the counter for the provided @p key.
- //
- // @remarks
- // It is safe to modify received counter.
- virtual CounterHolder Get(const vbl::CVBLString& key) const = 0;
- // Returns all existing counters.
- //
- // @remarks
- // It is safe to modify received counters.
- virtual CounterMap GetAll() const = 0;
- };
- } // diagnostic namespace
- } // media namespace
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement