📄 commands.h
字号:
#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
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -