API  Version 2.0.1
Low-Latency HFT API
 All Classes Functions Variables
cmdDefines.h
1 #ifndef API2_CMD_DEFINES_H
2 #define API2_CMD_DEFINES_H
3 
4 
5 #define CREATE_FIELD_DECLARATION( TYPE, NAME ) \
6  public : TYPE get##NAME() const ; \
7  public : TYPE &getRef##NAME() ; \
8  public : void set##NAME(const TYPE &value ) ; \
9  private : TYPE _##NAME
10 
11 #define CREATE_FIELD_DEFINATION( TYPE, NAME ,CLASS) \
12  TYPE ##CLASS::get##NAME() const ; \
13  TYPE & ##CLASS::getRef##NAME() ; \
14  void ##CLASS::set##NAME(const TYPE &value )
15 
16 #define CREATE_FIELD( TYPE, NAME ) \
17  public : TYPE get##NAME() const { return _##NAME ; } \
18  public : TYPE &getRef##NAME() { return _##NAME ; } \
19  public : void set##NAME(const TYPE &value ) { _##NAME = value ; } \
20  private : TYPE _##NAME
21 
22 
23 
24 #define CONVERT_TO_STRING(x) #x
25 
26 #define CREATE_FIELD_DERIVED( TYPE, NAME ) \
27  public : TYPE get##NAME() const { return _##NAME.getValue() ; } \
28  public : TYPE &getRef##NAME() { return _##NAME.getRefValue() ; } \
29  public : void set##NAME(const TYPE &value ) { _##NAME.setValue(value); } \
30  private : DerivedType<TYPE> _##NAME
31 
32 #define CREATE_FIELD_DERIVED( TYPE, NAME ) \
33  public : TYPE get##NAME() const { return _##NAME.getValue() ; } \
34  public : TYPE &getRef##NAME() { return _##NAME.getRefValue() ; } \
35  public : void set##NAME(const TYPE &value ) { _##NAME.setValue(value); } \
36  private : DerivedType<TYPE> _##NAME
37 
38 #define CREATE_FIELD_PTR( TYPE, NAME ) \
39  public : TYPE* get##NAME() { return _##NAME ; } \
40  public : TYPE* &getRef##NAME() { return _##NAME ; } \
41  public : void set##NAME(TYPE *value ) { _##NAME = value ; } \
42  private : TYPE *_##NAME
43 
44 #define CREATE_CONSTRUCTORS( Cls, Command, Response, VERSION) \
45  public: static const UNSIGNED_LONG STRATEGY_VERSION = VERSION; \
46  public: Cls(const char *buf) { deSerialize(buf);} \
47  public: Cls(){initialize();} \
48  public: int serialize(char* buf, bool isResponse = false){ \
49  return AbstractUserParams::serialize(buf, \
50  isResponse, (UNSIGNED_CHARACTER)Response, \
51  (UNSIGNED_CHARACTER)Command);}
52 
53 #define DECLARE_CONSTRUCTORS( Cls, VERSION) \
54  public: static const UNSIGNED_LONG BACK_END_STRATEGY_VERSION = VERSION; \
55  public: Cls(const char *buf); \
56  public: Cls();\
57  public: int serialize(char* buf, bool isResponse = false); \
58  public: void initialize();\
59  public: bool isVersionValid(){return BACK_END_STRATEGY_VERSION == getStrategyVersion(); } \
60  public: UNSIGNED_LONG getBackendStrategyVersion() const { return BACK_END_STRATEGY_VERSION;}
61 
62 #define DEFINE_CONSTRUCTORS( Cls, Cmd, Response) \
63  Cls::Cls(const char *buf){ deSerialize(buf); }\
64  Cls::Cls(){initialize();} \
65  int Cls::serialize(char* buf, bool isResponse){ \
66  return AbstractUserParams::serialize(buf, \
67  isResponse, (UNSIGNED_CHARACTER)Response, \
68  (UNSIGNED_CHARACTER)Cmd);}
69 
70 
71 
72 
73 #define INIT_DERIVED_TYPE( NAME, VALUE ) \
74  _##NAME(CONVERT_TO_STRING(NAME))
75 
76 #define SET_DERIVED_TYPE( NAME, VALUE) \
77  _##NAME.setString(CONVERT_TO_STRING(NAME)); \
78  set##NAME(VALUE); \
79  addType(&_##NAME)
80 
81 #define DEBUG_METHOD(DEBUG_OBJECT) { DEBUG_OBJECT->message(__FUNCTION__); }
82 #define DEBUG_MESSAGE(DEBUG_OBJECT,debug_message) { DEBUG_OBJECT->message(debug_message); }
83 #define DEBUG_VALUE_OF(DEBUG_OBJECT,variable) { DEBUG_OBJECT->value_of(#variable, variable); }
84 #define DEBUG_VARSHOW(DEBUG_OBJECT,debug_message,var) { DEBUG_OBJECT->printToLog(debug_message,var); }
85 #define DEBUG_VARSHOW2(DEBUG_OBJECT,debug_message,var1, var2) { DEBUG_OBJECT->printToLog2(debug_message,var1, var2); }
86 #define DEBUG_ARRAYSHOW(DEBUG_OBJECT,debug_message,var,var2) { DEBUG_OBJECT->printToLogArr(debug_message,var,var2); }
87 #define DEBUG_FLUSH(DEBUG_OBJECT) { DEBUG_OBJECT->flushLog(); }
88 
89 
90 #endif // API2_CMD_DEFINES_H