-
Notifications
You must be signed in to change notification settings - Fork 156
/
DBOps.h
68 lines (51 loc) · 2.64 KB
/
DBOps.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
/************************************************************************
* Copyright(c) 2011, One Unified. All rights reserved. *
* *
* This file is provided as is WITHOUT ANY WARRANTY *
* without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. *
* *
* This software may not be used nor distributed without proper license *
* agreement. *
* *
* See the file LICENSE.txt for redistribution information. *
************************************************************************/
#pragma once
#include <OUCommon/FastDelegate.h>
using namespace fastdelegate;
#include "Database.h"
#include <TFTrading/KeyTypes.h>
#include <TFTrading/InstrumentManager.h>
namespace ou { // One Unified
namespace tf { // TradeFrame
class DBOps: public ou::db::Session {
public:
DBOps();
virtual ~DBOps();
typedef Instrument::idInstrument_cref idInstrument_cref;
//typedef Instrument::idInstrument_t idInstrument_t;
//void LoadUnderlying( const ou::tf::keytypes::idInstrument_t& id, ou::tf::InstrumentManager::pInstrument_t& pInstrument );
//bool LoadOptions( ou::tf::InstrumentManager::pInstrument_t& pUnderlying, boost::uint16_t nYear, boost::uint16_t nMonth, boost::uint16_t nDay ); // uses OnNewInstrument
bool LoadOptions( idInstrument_cref sInstrumentName, boost::uint16_t nYear, boost::uint16_t nMonth, boost::uint16_t nDay ); // uses OnNewInstrument
typedef FastDelegate0<> OnPopulateDatabaseHandler_t;
void SetOnPopulateDatabaseHandler( OnPopulateDatabaseHandler_t function ) {
OnPopulateDatabaseHandler = function;
}
typedef FastDelegate0<> OnLoadDatabaseHandler_t;
void SetOnLoadDatabaseHandler( OnLoadDatabaseHandler_t function ) {
OnLoadDatabaseHandler = function;
}
typedef FastDelegate1<ou::tf::InstrumentManager::pInstrument_t> OnNewInstrumentHandler_t;
void SetOnNewInstrumentHandler( OnNewInstrumentHandler_t function ) {
OnNewInstrument = function;
}
protected:
private:
OnPopulateDatabaseHandler_t OnPopulateDatabaseHandler;
OnLoadDatabaseHandler_t OnLoadDatabaseHandler;
OnNewInstrumentHandler_t OnNewInstrument;
void HandlePopulateTables( ou::db::Session& session );
void HandleLoadTables( ou::db::Session& session );
};
} // namespace tf
} // namespace ou