![]() System : Linux absol.cf 5.4.0-198-generic #218-Ubuntu SMP Fri Sep 27 20:18:53 UTC 2024 x86_64 User : www-data ( 33) PHP Version : 7.4.33 Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare, Directory : /usr/local/lib/node_modules/mediasoup/worker/include/RTC/ |
Upload File : |
#ifndef MS_RTC_PARAMETERS_HPP #define MS_RTC_PARAMETERS_HPP #include "common.hpp" #include <json.hpp> #include <string> #include <unordered_map> #include <vector> using json = nlohmann::json; namespace RTC { class Parameters { public: class Value { public: enum class Type { BOOLEAN = 1, INTEGER, DOUBLE, STRING, ARRAY_OF_INTEGERS }; public: explicit Value(bool booleanValue) : type(Type::BOOLEAN), booleanValue(booleanValue) { } explicit Value(int32_t integerValue) : type(Type::INTEGER), integerValue(integerValue) { } explicit Value(double doubleValue) : type(Type::DOUBLE), doubleValue(doubleValue) { } explicit Value(std::string& stringValue) : type(Type::STRING), stringValue(stringValue) { } explicit Value(std::string&& stringValue) : type(Type::STRING), stringValue(stringValue) { } explicit Value(std::vector<int32_t>& arrayOfIntegers) : type(Type::ARRAY_OF_INTEGERS), arrayOfIntegers(arrayOfIntegers) { } public: Type type; bool booleanValue{ false }; int32_t integerValue{ 0 }; double doubleValue{ 0.0 }; const std::string stringValue; const std::vector<int32_t> arrayOfIntegers; }; public: void FillJson(json& jsonObject) const; void Set(json& data); bool HasBoolean(const std::string& key) const; bool HasInteger(const std::string& key) const; bool HasPositiveInteger(const std::string& key) const; bool HasDouble(const std::string& key) const; bool HasString(const std::string& key) const; bool HasArrayOfIntegers(const std::string& key) const; bool IncludesInteger(const std::string& key, int32_t integer) const; bool GetBoolean(const std::string& key) const; int32_t GetInteger(const std::string& key) const; double GetDouble(const std::string& key) const; const std::string& GetString(const std::string& key) const; const std::vector<int32_t>& GetArrayOfIntegers(const std::string& key) const; private: std::unordered_map<std::string, Value> mapKeyValues; }; } // namespace RTC #endif