hikyuu2/libs/hikyuu/data_driver/KDataDriver.h

99 lines
2.2 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 "../utilities/Parameter.h"
2015-01-07 01:26:14 +08:00
#include "KDataDriverImp.h"
namespace hku {
/**
* K线数据驱动基类
*/
class HKU_API KDataDriver {
PARAMETER_SUPPORT
2015-01-07 01:26:14 +08:00
public:
KDataDriver() {}
KDataDriver(const string& name);
2015-01-07 01:26:14 +08:00
virtual ~KDataDriver() { }
const string& name() const;
bool init(const Parameter&);
virtual bool _init() {
return true;
}
2015-01-07 01:26:14 +08:00
/**
* 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:
bool checkType();
2015-01-07 01:26:14 +08:00
private:
string m_name;
2015-01-07 01:26:14 +08:00
};
2015-01-07 01:26:14 +08:00
typedef shared_ptr<KDataDriver> KDataDriverPtr;
inline const string& KDataDriver::name() const {
return m_name;
}
2015-01-07 01:26:14 +08:00
} /* namespace */
#endif /* KDATADRIVER_H_ */