static Parser get_parser(const SessionData &sd, std::iostream &out)
{
auto dw = get_data_writer(sd.get_type(), out);
- ParserOptions opt(sd.get_version(), sd.get_cpu_num(), sd.get_devs_num(), dw, sd.get_api_map());
+ ParserOptions opt(sd.get_version(), sd.get_cpu_num(), sd.get_devs_num(), dw, std::move(sd.get_api_map()));
return Parser(opt);
}
//! Structure used to initialize Parser.
struct ParserOptions
{
- const std::string version; //!< Trace's protocol version
- const int cpu_num; //!< Number of traget CPUs
- const int devs_num; //!< Number of target energy devices
- std::shared_ptr<DataWriter> writer; //!< Writer pointer
- std::map<int, std::string> &api_map; //!< Reference to API map list
+ const std::string version; //!< Trace's protocol version
+ const int cpu_num; //!< Number of traget CPUs
+ const int devs_num; //!< Number of target energy devices
+ std::shared_ptr<DataWriter> writer; //!< Writer pointer
+ const std::map<int, std::string> &api_map; //!< Reference to API map list
//! Initialized with structure members
ParserOptions(const std::string &version, const int cpu_num, const int devs_num,
- std::shared_ptr<DataWriter> writer, std::map<int, std::string> api_map) :
+ std::shared_ptr<DataWriter> writer, const std::map<int, std::string> &api_map) :
version(version),
cpu_num(cpu_num),
devs_num(devs_num),
const int cpu_num = init_data.cpu_num;
const int devs_num = init_data.devs_num;
std::shared_ptr<DataWriter> dw = init_data.writer;
- std::map<int, std::string> &api_map = init_data.api_map;
+ const std::map<int, std::string> &api_map = init_data.api_map;
if (!init_data.version.compare(v30))
- protocol_ = std::make_unique<Protocol30>(dw, cpu_num, devs_num, api_map);
+ protocol_ = std::make_unique<Protocol30>(dw, cpu_num, devs_num, std::move(api_map));
else if (!init_data.version.compare(v40))
- protocol_ = std::make_unique<Protocol40>(dw, cpu_num, devs_num, api_map);
+ protocol_ = std::make_unique<Protocol40>(dw, cpu_num, devs_num, std::move(api_map));
else if (!init_data.version.compare(v41))
- protocol_ = std::make_unique<Protocol41>(dw, cpu_num, devs_num, api_map);
+ protocol_ = std::make_unique<Protocol41>(dw, cpu_num, devs_num, std::move(api_map));
else if (!init_data.version.compare(v42))
- protocol_ = std::make_unique<Protocol42>(dw, cpu_num, devs_num, api_map);
+ protocol_ = std::make_unique<Protocol42>(dw, cpu_num, devs_num, std::move(api_map));
else
throw std::logic_error((boost::format("Wrong protocol version <%1%>. \
Suppotred versions are <%2%>, \