-
Notifications
You must be signed in to change notification settings - Fork 156
/
AlternateInstrumentNames.h
66 lines (51 loc) · 2.35 KB
/
AlternateInstrumentNames.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
/************************************************************************
* Copyright(c) 2009, 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 <string>
#include <OUSQL/Functions.h>
#include "KeyTypes.h"
namespace ou { // One Unified
namespace tf { // TradeFrame
class AlternateInstrumentName {
public:
struct TableRowDef {
template<class A>
void Fields( A& a ) {
ou::db::Field( a, "providerid", idProvider ); // part of unique key
ou::db::Field( a, "alternateid", idAlternate ); // part of unique key
ou::db::Field( a, "instrumentid", idInstrument ); // can be used for secondary index
}
keytypes::eidProvider_t idProvider;
keytypes::idInstrument_t idAlternate;
keytypes::idInstrument_t idInstrument;
TableRowDef( const keytypes::eidProvider_t& idProvider_, const keytypes::idInstrument_t& idAlternate_, const keytypes::idInstrument_t& idInstrument_ ):
idProvider( idProvider_ ), idAlternate( idAlternate_ ), idInstrument( idInstrument_ ) {};
TableRowDef( void ) {};
};
struct TableCreateDef: TableRowDef {
template<class A>
void Fields( A& a ) {
TableRowDef::Fields( a );
ou::db::Key( a, "providerid" ); // unique key part 1
ou::db::Key( a, "alternateid" ); // unique key part 2
ou::db::Constraint( a, "instrumentid", tablenames::sInstrument, "instrumentid" );
// TODO: set idInstrument as secondary index?
}
};
const TableRowDef& GetRow( void ) const { return m_row; };
protected:
private:
TableRowDef m_row;
};
} // namespace tf
} // namespace ou