2015-01-07 01:26:14 +08:00
|
|
|
/*
|
|
|
|
* KDataDriver.cpp
|
|
|
|
*
|
|
|
|
* Created on: 2014年9月2日
|
|
|
|
* Author: fasiondog
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "../StockManager.h"
|
|
|
|
#include "KDataDriver.h"
|
|
|
|
|
|
|
|
namespace hku {
|
|
|
|
|
2017-10-14 03:08:49 +08:00
|
|
|
KDataDriver::KDataDriver(): m_name("") {
|
2015-01-07 01:26:14 +08:00
|
|
|
|
|
|
|
}
|
|
|
|
|
2017-10-14 03:08:49 +08:00
|
|
|
KDataDriver::KDataDriver(const string& name): m_name(name) {
|
|
|
|
boost::to_upper(m_name);
|
2015-01-07 01:26:14 +08:00
|
|
|
}
|
|
|
|
|
2017-10-12 01:58:08 +08:00
|
|
|
bool KDataDriver::checkType() {
|
|
|
|
bool result = false;
|
|
|
|
try {
|
|
|
|
string type = getParam<string>("type");
|
|
|
|
boost::to_upper(type);
|
|
|
|
if (type == m_name) {
|
|
|
|
result = true;
|
|
|
|
} else {
|
|
|
|
result = false;
|
|
|
|
HKU_WARN("Type of driver mismatch! ("
|
|
|
|
<< type << " != " << m_name << ") "
|
|
|
|
<< "[KDataDriver::checkType]");
|
|
|
|
}
|
|
|
|
|
|
|
|
} catch(...) {
|
|
|
|
result = false;
|
|
|
|
HKU_ERROR("Can't get type of driver! [KDataDriver::checkType]");
|
|
|
|
}
|
|
|
|
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
2017-10-14 03:08:49 +08:00
|
|
|
|
2017-10-12 01:58:08 +08:00
|
|
|
bool KDataDriver::init(const Parameter& params) {
|
|
|
|
if (m_params == params) {
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
m_params = params;
|
|
|
|
if (!checkType()) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
return _init();
|
|
|
|
}
|
|
|
|
|
2017-10-14 03:08:49 +08:00
|
|
|
void KDataDriver::
|
|
|
|
loadKData(const string& market, const string& code, KQuery::KType kType,
|
|
|
|
size_t start_ix, size_t end_ix, KRecordList* out_buffer) {
|
|
|
|
}
|
|
|
|
|
|
|
|
size_t KDataDriver::
|
|
|
|
getCount(const string& market, const string& code, KQuery::KType kType) {
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool KDataDriver::
|
|
|
|
getIndexRangeByDate(const string& market, const string& code,
|
|
|
|
const KQuery& query, size_t& out_start, size_t& out_end) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
KRecord KDataDriver::
|
|
|
|
getKRecord(const string& market, const string& code,
|
|
|
|
size_t pos, KQuery::KType kType) {
|
|
|
|
return Null<KRecord>();
|
|
|
|
}
|
|
|
|
|
2015-01-07 01:26:14 +08:00
|
|
|
} /* namespace hku */
|
|
|
|
|
|
|
|
|
|
|
|
|