#ifndef _WIN32 #include "Product.h" #include #include namespace bts { namespace api { std::string product_to_string(const api::Product& p) { std::string buffer = p.symbol(); buffer += ":"; buffer += SecurityType_Name(p.type()); buffer += ":"; buffer += Venue_Name(p.exchange()); return buffer; } std::optional string_to_product(const std::string& s) { boost::tokenizer> tok { s }; std::vector parts; for (const auto& t : tok) { parts.push_back(t); } if (parts.size() != 3) return std::nullopt; SecurityType type = SecurityType::SECURITYTYPE_UNSET; if (!SecurityType_Parse(parts[1], &type)) return std::nullopt; Venue v = Venue::VENUE_UNSET; if (!Venue_Parse(parts[2], &v)) return std::nullopt; Product p; p.set_symbol(parts[0]); p.set_type(type); p.set_exchange(v); return {p}; } }}//ns #endif