hikyuu2/hikyuu_cpp/hikyuu/data_driver/BaseInfoDriver.h

97 lines
1.9 KiB
C++
Raw Normal View History

2015-01-07 01:26:14 +08:00
/*
* BaseInfoDriver.h
*
* Created on: 2012-8-14
* Author: fasiondog
*/
#pragma once
2015-01-07 01:26:14 +08:00
#ifndef BASEINFODRIVER_H_
#define BASEINFODRIVER_H_
#include "../utilities/Parameter.h"
2015-01-07 01:26:14 +08:00
#include "../MarketInfo.h"
#include "../StockTypeInfo.h"
#include "../Stock.h"
namespace hku {
/**
*
*/
class HKU_API BaseInfoDriver {
PARAMETER_SUPPORT
2015-01-07 01:26:14 +08:00
public:
2016-04-03 00:08:31 +08:00
typedef unordered_map<string, MarketInfo> MarketInfoMap;
typedef unordered_map<hku_uint32, StockTypeInfo> StockTypeInfoMap;
BaseInfoDriver(const string& name);
2015-01-07 01:26:14 +08:00
virtual ~BaseInfoDriver() { }
const string& name() const;
/**
*
* @param params
* @return
*/
bool init(const Parameter& params);
/**
*
* @return
*/
bool loadBaseInfo();
/**
*
* @param market
* @param code
*/
virtual Parameter getFinanceInfo(const string& market, const string& code);
/**
*
* @return
*/
virtual bool _init() = 0;
2015-01-07 01:26:14 +08:00
/**
*
* @return true | false
*/
virtual bool _loadMarketInfo() = 0;
2015-01-07 01:26:14 +08:00
/**
*
* @return true | false
*/
virtual bool _loadStockTypeInfo() = 0;
2015-01-07 01:26:14 +08:00
/**
*
* @return true | false
*/
virtual bool _loadStock() = 0;
private:
bool checkType();
2015-01-07 01:26:14 +08:00
protected:
string m_name;
2015-01-07 01:26:14 +08:00
};
typedef shared_ptr<BaseInfoDriver> BaseInfoDriverPtr;
2017-10-20 02:11:57 +08:00
HKU_API std::ostream & operator<<(std::ostream&, const BaseInfoDriver&);
HKU_API std::ostream & operator<<(std::ostream&, const BaseInfoDriverPtr&);
inline const string& BaseInfoDriver::name() const {
return m_name;
}
2015-01-07 01:26:14 +08:00
} /* namespace hku */
#endif /* BASEINFODRIVER_H_ */