hikyuu2/hikyuu_cpp/hikyuu/KDataImp.h

69 lines
1.1 KiB
C++
Raw Normal View History

2015-01-07 01:26:14 +08:00
/*
* KDataImp.h
*
* Created on: 2013-2-4
* Author: fasiondog
*/
#pragma once
2015-01-07 01:26:14 +08:00
#ifndef KDATAIMP_H_
#define KDATAIMP_H_
#include "Stock.h"
namespace hku {
class KDataImp {
public:
KDataImp();
KDataImp(const Stock& stock, const KQuery& query);
virtual ~KDataImp();
2019-11-10 19:45:57 +08:00
KQuery getQuery() const {
return m_query;
}
Stock getStock() const {
return m_stock;
}
2020-10-05 00:07:29 +08:00
KRecord getKRecord(size_t pos) const {
return m_buffer[pos];
}
bool empty() const {
return m_buffer.empty();
}
size_t size() {
return m_buffer.size();
}
2020-10-02 23:29:06 +08:00
size_t startPos();
size_t endPos();
size_t lastPos();
2015-01-07 01:26:14 +08:00
2020-10-05 00:07:29 +08:00
size_t getPos(const Datetime& datetime);
2015-01-07 01:26:14 +08:00
2020-10-05 00:07:29 +08:00
private:
2020-10-02 23:29:06 +08:00
void _getPosInStock();
2020-10-05 00:07:29 +08:00
void _recoverForward();
void _recoverBackward();
void _recoverEqualForward();
void _recoverEqualBackward();
void _recoverForUpDay();
2015-01-07 01:26:14 +08:00
2020-10-05 00:07:29 +08:00
private:
KRecordList m_buffer;
2015-01-07 01:26:14 +08:00
KQuery m_query;
2019-11-10 19:45:57 +08:00
Stock m_stock;
2015-01-07 01:26:14 +08:00
size_t m_start;
size_t m_end;
2020-10-02 23:29:06 +08:00
bool m_have_pos_in_stock;
2015-01-07 01:26:14 +08:00
};
typedef shared_ptr<KDataImp> KDataImpPtr;
} /* namespace hku */
#endif /* KDATAIMP_H_ */