Change Enum KQuery::KType to string (continue)

This commit is contained in:
fasiondog 2018-10-06 02:03:02 +08:00
parent cb86c1cbf1
commit 178ad8a394
7 changed files with 27 additions and 15 deletions

View File

@ -29,7 +29,8 @@ string KData::toString() const {
KData::KData(const Stock& stock, const KQuery& query) {
if (stock.isNull() || query.kType() >= KQuery::INVALID_KTYPE) {
//if (stock.isNull() || query.kType() >= KQuery::INVALID_KTYPE) {
if (stock.isNull()) {
return;
}
if (query.kType() < KQuery::DAY) {

View File

@ -26,7 +26,7 @@ const string KQuery::HOUR2("HOUR2");
const string KQuery::HOUR4("HOUR4");
const string KQuery::HOUR6("HOUR5");
const string KQuery::HOUR12("HOUR12");
const string KQuery::INVALID_KTYPE("Z");
//const string KQuery::INVALID_KTYPE("Z");
string KQuery::getQueryTypeName(QueryType queryType) {
switch(queryType){

View File

@ -66,7 +66,7 @@ public:
static const string HOUR4;
static const string HOUR6;
static const string HOUR12;
static const string INVALID_KTYPE;
//static const string INVALID_KTYPE;
/**
*
@ -255,7 +255,7 @@ public:
operator KQuery() {
return KQuery(Null<hku_int64>(),
Null<hku_int64>(),
KQuery::INVALID_KTYPE,
"", //KQuery::INVALID_KTYPE,
KQuery::INVALID_RECOVER_TYPE,
KQuery::INVALID
);

View File

@ -304,7 +304,8 @@ bool Stock::isNull() const {
void Stock::releaseKDataBuffer(KQuery::KType kType) {
if (!m_data || kType >= KQuery::INVALID_KTYPE)
//if (!m_data || kType >= KQuery::INVALID_KTYPE)
if (!m_data)
return;
//if (m_data->pKData[kType])
@ -316,7 +317,8 @@ void Stock::releaseKDataBuffer(KQuery::KType kType) {
void Stock::loadKDataToBuffer(KQuery::KType kType) {
if (!m_data || kType >= KQuery::INVALID_KTYPE)
//if (!m_data || kType >= KQuery::INVALID_KTYPE)
if (!m_data)
return;
releaseKDataBuffer(kType);
@ -357,7 +359,8 @@ KData Stock::getKData(const KQuery& query) const {
size_t Stock::getCount(KQuery::KType kType) const {
if (!m_data || kType >= KQuery::INVALID_KTYPE)
//if (!m_data || kType >= KQuery::INVALID_KTYPE)
if (!m_data)
return 0;
if (m_data->pKData.find(kType) != m_data->pKData.end())
@ -418,7 +421,7 @@ Stock::getIndexRange(const KQuery& query, size_t& out_start, size_t& out_end) c
return _getIndexRangeByIndex(query, out_start, out_end);
if ((KQuery::DATE != query.queryType())
|| (query.kType() >= KQuery::INVALID_KTYPE)
//|| (query.kType() >= KQuery::INVALID_KTYPE)
|| query.startDatetime() >= query.endDatetime())
return false;

View File

@ -130,8 +130,9 @@ void H5KDataDriver
void H5KDataDriver::loadKData(const string& market, const string& code,
KQuery::KType kType, size_t start_ix, size_t end_ix,
KRecordListPtr out_buffer) {
if (KQuery::INVALID_KTYPE <= kType
|| start_ix >= end_ix) {
//if (KQuery::INVALID_KTYPE <= kType
// || start_ix >= end_ix) {
if (start_ix >= end_ix) {
return;
}

View File

@ -144,7 +144,8 @@ loadKData(const string& market, const string& code,
return;
}
if (kType >= KQuery::INVALID_KTYPE || start_ix >= end_ix) {
//if (kType >= KQuery::INVALID_KTYPE || start_ix >= end_ix) {
if (start_ix >= end_ix) {
HKU_WARN("ktype(" << kType << ") is invalid or start_ix("
<< start_ix << ") >= endix(" << end_ix << ")" << func_name);
return;
@ -207,10 +208,10 @@ getCount(const string& market,
return result;
}
if (kType >= KQuery::INVALID_KTYPE ) {
/*if (kType >= KQuery::INVALID_KTYPE ) {
HKU_WARN("ktype(" << kType << ") is invalid" << func_name);
return result;
}
}*/
MYSQL_RES *mysql_result;
MYSQL_ROW row;
@ -329,10 +330,10 @@ getKRecord(const string& market, const string& code,
return result;
}
if (kType >= KQuery::INVALID_KTYPE ) {
/*if (kType >= KQuery::INVALID_KTYPE ) {
HKU_WARN("ktype(" << kType << ") is invalid" << func_name);
return result;
}
}*/
MYSQL_RES *mysql_result;
MYSQL_ROW row;

View File

@ -99,6 +99,8 @@ loadKData(const string& market, const string& code,
_loadMinKData(market, code, ktype, start_ix, end_ix, out_buffer);
} else if (ktype == KQuery::DAY) {
_loadDayKData(market, code, ktype, start_ix, end_ix, out_buffer);
} else {
HKU_WARN("Don't support the ktype: " << ktype << " [TdxKDataDriver::loadKData]");
}
/*switch (ktype) {
case KQuery::MIN:
@ -205,6 +207,8 @@ getKRecord(const string& market, const string& code,
record = _getMinKRecord(market, code, pos, ktype);
} else if (ktype == KQuery::DAY) {
record = _getDayKRecord(market, code, pos, ktype);
} else {
HKU_WARN("Don't support the ktype: " << ktype << " [TdxKDataDriver::getKRecord]");
}
return record;
@ -533,6 +537,8 @@ _getFileName(const string& market, const string& code, KQuery::KType ktype) {
filename = m_dirname + "\\" + market + "\\fzline\\" + market + code + ".lc5";
} else if (ktype == KQuery::DAY || ktype == KQuery::WEEK || ktype == KQuery::MONTH || ktype == KQuery::QUARTER || ktype == KQuery::HALFYEAR || ktype == KQuery::YEAR) {
filename = m_dirname + "\\" + market + "\\lday\\" + market + code + ".day";
} else {
HKU_WARN("Don't support this ktype: " << ktype << " [TdxKDataDriver::_getFileName]");
}
return filename;