简化析构函数
简化析构函数
This commit is contained in:
parent
ced504defd
commit
5f00bbf08c
@ -1,21 +1,21 @@
|
||||
//说明部分
|
||||
//说明部分
|
||||
|
||||
//系统
|
||||
//系统
|
||||
#include "StdAfx.h"
|
||||
#include <string>
|
||||
|
||||
//Boost
|
||||
#define BOOST_PYTHON_STATIC_LIB
|
||||
#include <boost/python/module.hpp> //python封装
|
||||
#include <boost/python/def.hpp> //python封装
|
||||
#include <boost/python/object.hpp> //python封装
|
||||
#include <boost/python/module.hpp> //python封装
|
||||
#include <boost/python/def.hpp> //python封装
|
||||
#include <boost/python/object.hpp> //python封装
|
||||
|
||||
#include <boost/python/register_ptr_to_python.hpp> //Python封装
|
||||
#include <boost/python/suite/indexing/vector_indexing_suite.hpp> //Python封装
|
||||
#include <boost/python/register_ptr_to_python.hpp> //Python封装
|
||||
#include <boost/python/suite/indexing/vector_indexing_suite.hpp> //Python封装
|
||||
|
||||
#include <boost/python.hpp> //python封装
|
||||
#include <boost/thread.hpp> //任务队列的线程功能
|
||||
#include <boost/bind.hpp> //任务队列的线程功能
|
||||
#include <boost/python.hpp> //python封装
|
||||
#include <boost/thread.hpp> //任务队列的线程功能
|
||||
#include <boost/bind.hpp> //任务队列的线程功能
|
||||
|
||||
#include <boost/shared_ptr.hpp>
|
||||
|
||||
@ -25,31 +25,31 @@
|
||||
#include "EClientSocket.h"
|
||||
#include "EReader.h"
|
||||
|
||||
//命名空间
|
||||
//命名空间
|
||||
using namespace std;
|
||||
using namespace boost::python;
|
||||
using namespace boost;
|
||||
|
||||
|
||||
///-------------------------------------------------------------------------------------
|
||||
///API中的部分组件
|
||||
///API中的部分组件
|
||||
///-------------------------------------------------------------------------------------
|
||||
|
||||
//GIL全局锁简化获取用,
|
||||
//用于帮助C++线程获得GIL锁,从而防止python崩溃
|
||||
//GIL全局锁简化获取用,
|
||||
//用于帮助C++线程获得GIL锁,从而防止python崩溃
|
||||
class PyLock
|
||||
{
|
||||
private:
|
||||
PyGILState_STATE gil_state;
|
||||
|
||||
public:
|
||||
//在某个函数方法中创建该对象时,获得GIL锁
|
||||
//在某个函数方法中创建该对象时,获得GIL锁
|
||||
PyLock()
|
||||
{
|
||||
gil_state = PyGILState_Ensure();
|
||||
};
|
||||
|
||||
//在某个函数完成后销毁该对象时,解放GIL锁
|
||||
//在某个函数完成后销毁该对象时,解放GIL锁
|
||||
~PyLock()
|
||||
{
|
||||
PyGILState_Release(gil_state);
|
||||
@ -58,7 +58,7 @@ public:
|
||||
|
||||
|
||||
///-------------------------------------------------------------------------------------
|
||||
///强制转化相关
|
||||
///强制转化相关
|
||||
///-------------------------------------------------------------------------------------
|
||||
|
||||
boost::python::list tagvaluelist_to_pylist();
|
||||
@ -66,7 +66,7 @@ boost::python::list tagvaluelist_to_pylist();
|
||||
TagValueListSPtr pylist_to_tagvaluelist();
|
||||
|
||||
///-------------------------------------------------------------------------------------
|
||||
///声明类
|
||||
///声明类
|
||||
///-------------------------------------------------------------------------------------
|
||||
|
||||
class VnIbApi;
|
||||
@ -74,7 +74,7 @@ class VnIbApi;
|
||||
class IbWrapper;
|
||||
|
||||
///-------------------------------------------------------------------------------------
|
||||
///C++ SPI的回调函数方法实现
|
||||
///C++ SPI的回调函数方法实现
|
||||
///-------------------------------------------------------------------------------------
|
||||
|
||||
class IbWrapper : public EWrapper
|
||||
@ -223,7 +223,7 @@ public:
|
||||
|
||||
|
||||
///-------------------------------------------------------------------------------------
|
||||
///封装后的API类
|
||||
///封装后的API类
|
||||
///-------------------------------------------------------------------------------------
|
||||
|
||||
class VnIbApi
|
||||
@ -247,25 +247,18 @@ public:
|
||||
};
|
||||
|
||||
~VnIbApi()
|
||||
{
|
||||
if (this->client)
|
||||
{
|
||||
delete this->client;
|
||||
}
|
||||
|
||||
if (this->wrapper)
|
||||
{
|
||||
delete this->wrapper;
|
||||
}
|
||||
};
|
||||
|
||||
//-------------------------------------------------------------------------------------
|
||||
//负责调用checkMessages的线程工作函数
|
||||
//负责调用checkMessages的线程工作函数
|
||||
//-------------------------------------------------------------------------------------
|
||||
void run();
|
||||
|
||||
//-------------------------------------------------------------------------------------
|
||||
//回调函数
|
||||
//回调函数
|
||||
//-------------------------------------------------------------------------------------
|
||||
|
||||
virtual void nextValidId(OrderId orderId){};
|
||||
@ -408,7 +401,7 @@ public:
|
||||
*/
|
||||
|
||||
//-------------------------------------------------------------------------------------
|
||||
//主动函数
|
||||
//主动函数
|
||||
//-------------------------------------------------------------------------------------
|
||||
|
||||
bool eConnect(string host, int port, int clientId, bool extraAuth);
|
||||
|
Loading…
Reference in New Issue
Block a user