#pragma once #include "Production.h" #include "Market.h" #include using std::pair; using std::map; class SellProduction { public: using Amount = float; using Price = float; using PriceList = pair; using PriceMap = pair; SellProduction(shared_ptr pt_pdt) : p_pdt(pt_pdt) {} // 委托请求接口 void new_request(shared_ptr pn_req); bool cancel_request(shared_ptr pn_req); const float get_average_price(); const float get_selling_amount(); const float get_buying_amount(); private: // 价位表 map pce_s_lst, pce_b_lst; // 产品指针 shared_ptr p_pdt; // 销售交易委托 vector> reqs_sl; // 购买交易委托 vector> reqs_by; // 交易统计 float buy_amt = 0.0, sell_amt = 0.0; // 平均价格 float price_avg = 0.0; // 更新价位表接口 void update_buying_map(Price price, Amount amount); void update_selling_map(Price price, Amount amount); void update_map(map& pce_map, Price price, Amount amount); };