Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <string>
- #include <vector>
- #include <unordered_map>
- #include <main/enums.hpp>
- #include <strategy/enums.hpp>
- #include <parsing/enums.hpp>
- namespace mira {
- struct input_parameter_wrapper { // проблема, что нет взаимоисключения, что если PLAIN_PARAMETER, то обязательно ТОЛЬКО parameter должен быть
- struct market_parameter {
- mira::parsing::e_market market;
- mira::e_strategy strategy;
- std::string symbol_str;
- };
- e_input_parameter_type type;
- union { // м.б. вместо union использовать std::variant?
- std::string parameter;
- std::vector<market_parameter> market_parameters;
- };
- static std::unordered_map<std::string, std::string> convert_market_input_to_plain(const std::unordered_map<std::string, input_parameter_wrapper>&);
- e_input_parameter_type& operator=(input_parameter_wrapper& other) {
- type = other.type;
- if (type == e_input_parameter_type::PLAIN_PARAMETER) {
- parameter = other.parameter;
- } else if (type == e_input_parameter_type::MARKET_PARAMETER) {
- market_parameters = other.market_parameters;
- }
- }
- ~input_parameter_wrapper() { // is it necessary to do?
- if (type == e_input_parameter_type::MARKET_PARAMETER) {
- market_parameters.~vector();
- } else if (type == e_input_parameter_type::PLAIN_PARAMETER) {
- parameter.~basic_string();
- }
- }
- };
- } // namespace mira
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement