commands.h
资源名称:stocks.rar [点击查看]
上传用户:wenyu2k02
上传日期:2016-04-13
资源大小:28k
文件大小:2k
源码类别:
金融证券系统
开发平台:
Delphi
- #ifndef _STOCK_COMMAND_H_
- #define _STOCK_COMMAND_H_
- #include <boost/tuple/tuple.hpp>
- #include <loki/singleton.h>
- namespace StockMarket
- {
- using namespace std;
- using namespace boost;
- struct InstantTransShareData
- {
- string current_stock;
- };
- class InstantTransReq : public Request
- {
- public:
- InstantTransReq( int count);
- InstantTransReq(const string& stock_code, int count);
- char* buff();
- ulong len();
- void send(TcpSocket& soc);
- InstantTransReq& operator++();
- operator bool ();
- protected:
- #pragma pack(push)
- #pragma pack(1)
- struct InstantTransStruct
- {
- InstantTransStruct();
- InstantTransStruct(const string& stock_code, ushort record_offset, ushort record_count );
- void set_stock_code(const string& stock_code);
- ReqHead header;
- ushort location;
- char code[MarketInfo::StocksCodeLen];
- ushort offset; //
- ushort count; //
- }s;
- #pragma pack(pop)
- public:
- typedef map<uint, string> IntStringMap;
- private:
- bool finished;
- string current_stock;
- bool all_stock;
- uint dt;
- };
- class InstantTransRes: public StockRes
- {
- public:
- static recursive_mutex inst_trans_res_map_mutex;
- void operator()();
- };
- struct HisTransShareData
- {
- uint date;
- string current_stock;
- ushort to_get_offset;
- ushort total_got_count;
- bool got_one_stock;
- };
- class HisTransReq : public Request
- {
- public:
- HisTransReq(const string& stock_code, uint record_date);
- HisTransReq(uint record_date);
- char* buff();
- ulong len();
- void send(TcpSocket& soc);
- HisTransReq& operator++();
- operator bool ();
- static const ushort to_get_count = 1800;
- protected:
- #pragma pack(push)
- #pragma pack(1)
- struct HisTransStruct //0x0fb5
- {
- public:
- HisTransStruct();
- HisTransStruct(const string& stock_code, uint record_date, ushort record_offset, ushort record_count);
- void set_stock_code(const string& stock_code);
- void set_offset(ushort off);
- ReqHead header;
- uint date; // 年月日 20050411 = 0x0131f1e8
- ushort location; // ????
- char code[6];
- ushort offset;
- ushort count;
- }s;
- #pragma pack(pop)
- private:
- bool finished;
- bool all_stock;
- string current_stock;
- };
- class HisTransRes : public StockRes
- {
- public:
- static recursive_mutex his_trans_res_map_mutex;
- void operator()();
- };
- extern StockRes* CreateInstantTransRes();
- extern StockRes* CreateHisTransRes();
- }
- #endif