hikyuu2/libs/hikyuu/data_driver/KDataDriver.h

83 lines
2.1 KiB
C++
Raw Normal View History

2015-01-07 01:26:14 +08:00
/*
* KDataDriver.h
*
* Created on: 2012-9-8
* Author: fasiondog
*/
#ifndef KDATADRIVER_H_
#define KDATADRIVER_H_
#include "KDataDriverImp.h"
namespace hku {
/**
* K线数据驱动基类
*/
class KDataDriver {
public:
KDataDriver() {}
KDataDriver(const shared_ptr<IniParser>& config);
virtual ~KDataDriver() { }
/**
* K线数据加载至缓存
* @param market
* @param code
* @param kType K线类型
* @param start_ix
* @param end_ix
* @param out_buffer [out]
*/
virtual void loadKData(const string& market, const string& code,
2015-01-07 01:26:14 +08:00
KQuery::KType kType, size_t start_ix, size_t end_ix,
KRecordList* out_buffer) ;
/**
* K线数据量
* @param market
* @param code
* @param kType K线类型
* @return
*/
virtual size_t getCount(const string& market, const string& code,
2015-01-07 01:26:14 +08:00
KQuery::KType kType);
/**
* K线记录索引
* @param market
* @param code
* @param query
* @param out_start [out] K线记录位置
* @param out_end [out] K线记录位置
* @return
*/
virtual bool getIndexRangeByDate(const string& market, const string& code,
2015-01-07 01:26:14 +08:00
const KQuery& query, size_t& out_start, size_t& out_end);
/**
* K线记录
* @param market
* @param code
* @param pos K线记录索引
* @param kType K线类型
* @return
*/
virtual KRecord getKRecord(const string& market, const string& code,
2015-01-07 01:26:14 +08:00
size_t pos, KQuery::KType kType);
private:
KDataDriverImpPtr _getImpPtr(const string& market, KQuery::KType);
private:
2015-01-07 01:26:14 +08:00
map<KQuery::KType, string> m_suffix;
map<string, KDataDriverImpPtr> m_imp; /* key: market + _day */
};
typedef shared_ptr<KDataDriver> KDataDriverPtr;
} /* namespace */
#endif /* KDATADRIVER_H_ */