MagAO-X
Operations
Applications
Utilities
Source
indiMacros.hpp
Go to the documentation of this file.
1
/** \file indiMacros.hpp
2
* \brief Macros for INDI
3
* \author Jared R. Males (jaredmales@gmail.com)
4
*
5
* History:
6
* - 2018-05-27 created by JRM
7
*/
8
9
#ifndef app_indiMacros_hpp
10
#define app_indiMacros_hpp
11
12
/// Declare and define the static callback for a new property request.
13
/** You should not normally use this macro, it is called by INDI_NEWCALLBACK_DECL.
14
*
15
* \param class the class name (with no \")
16
* \param prop the property member name (with no \")
17
*
18
* \ingroup indi
19
*/
20
#define SET_INDI_NEWCALLBACK(class, prop) static int st_ ## newCallBack ## _ ## prop( void * app, const pcf::IndiProperty &ipRecv)\
21
{\
22
return static_cast<class *>(app)->newCallBack ## _ ## prop(ipRecv);\
23
}
24
25
/// Declare and define the static callback for a set property request.
26
/** You should not normally use this macro, it is called by INDI_SETCALLBACK_DECL.
27
*
28
* \param class the class name (with no \")
29
* \param prop the property member name (with no \")
30
*
31
* \ingroup indi
32
*/
33
#define SET_INDI_SETCALLBACK(class, prop) static int st_ ## setCallBack ## _ ## prop( void * app, const pcf::IndiProperty &ipRecv)\
34
{\
35
return static_cast<class *>(app)->setCallBack ## _ ## prop(ipRecv);\
36
}
37
38
/// Declare the callback for a new property request, and declare and define the static wrapper.
39
/** After including this, you still need to actually define the callback.
40
*
41
* \param class the class name (with no \")
42
* \param prop the property member name (with no \")
43
*
44
* \ingroup indi
45
*/
46
#define INDI_NEWCALLBACK_DECL(class, prop) int newCallBack_ ## prop(const pcf::IndiProperty &ipRecv); \
47
SET_INDI_NEWCALLBACK(class, prop)
48
49
/// Declare the callback for a set property request, and declare and define the static wrapper.
50
/** After including this, you still need to actually define the callback.
51
*
52
* \param class the class name (with no \")
53
* \param prop the property member name (with no \")
54
*
55
* \ingroup indi
56
*/
57
#define INDI_SETCALLBACK_DECL(class, prop) int setCallBack_ ## prop(const pcf::IndiProperty &ipRecv); \
58
SET_INDI_SETCALLBACK(class, prop)
59
60
/// Define the callback for a new property request.
61
/** Creates a class::method definition, which must be appended with a const reference of type pcf::IndiProperty.
62
* Example usage for a class named xapp and an INDI property x:
63
* \code
64
INDI_NEWCALLBACK_DEFN(xapp, x)(const pcf::IndiProperty &ipRecv)
65
{
66
//do stuff with ipRecv
67
68
return 0; //Must return int.
69
}
70
\endcode
71
* After pre-processing the above code becomes
72
* \code
73
int xapp::newCallback_x(const pcf::IndiProperty &ipRecv)
74
{
75
//do stuff with ipRecv
76
77
return 0; //Must return int.
78
}
79
\endcode
80
*
81
*
82
* \param class the class name (with no \")
83
* \param prop the property member name (with no \")
84
*
85
* \ingroup indi
86
*/
87
#define INDI_NEWCALLBACK_DEFN(class, prop) int class::newCallBack_ ## prop
88
89
/// Define the callback for a set property request.
90
/** Creates a class::method definition, which must be appended with a const reference of type pcf::IndiProperty.
91
* Example usage for a class named xapp and an INDI property x:
92
* \code
93
INDI_SETCALLBACK_DEFN(xapp, x)(const pcf::IndiProperty &ipRecv)
94
{
95
//do stuff with ipRecv
96
97
return 0; //Must return int.
98
}
99
\endcode
100
* After pre-processing the above code becomes
101
* \code
102
int xapp::setCallback_x(const pcf::IndiProperty &ipRecv)
103
{
104
//do stuff with ipRecv
105
106
return 0; //Must return int.
107
}
108
\endcode
109
*
110
*
111
* \param class the class name (with no \")
112
* \param prop the property member name (with no \")
113
*
114
* \ingroup indi
115
*/
116
#define INDI_SETCALLBACK_DEFN(class, prop) int class::setCallBack_ ## prop
117
118
/// Get the name of the static callback wrapper for a new property.
119
/** Useful for passing the pointer to the callback.
120
*
121
* \param prop the property member name (with no \")
122
*
123
* \ingroup indi
124
*/
125
#define INDI_NEWCALLBACK(prop) st_newCallBack_ ## prop
126
127
/// Get the name of the static callback wrapper for a set property.
128
/** Useful for passing the pointer to the callback.
129
*
130
* \param prop the property member name (with no \")
131
*
132
* \ingroup indi
133
*/
134
#define INDI_SETCALLBACK(prop) st_setCallBack_ ## prop
135
136
/// Register a NEW INDI property with the class, using the standard callback name.
137
/** Is a wrapper for MagAOXApp::registerIndiPropertyNew.
138
*
139
* \param prop the property member name, with no quotes
140
* \param propName the property name, in quotes
141
* \param type the property type, pcf::IndiProperty::Type
142
* \param perm the property permissions, pcf::IndiProperty::PropertyPermType
143
* \param state the property state, pcf::IndiProperty::PropertyStateType
144
*
145
* \ingroup indi
146
*/
147
#define REG_INDI_NEWPROP(prop, propName, type) registerIndiPropertyNew( prop, propName, type, pcf::IndiProperty::ReadWrite, pcf::IndiProperty::Idle, INDI_NEWCALLBACK(prop));
148
149
/// Register a NEW INDI property with the class, with no callback.
150
/** Is a wrapper for MagAOXApp::registerIndiPropertyNew with NULL callback.
151
*
152
* \param prop the property member name, with no quotes
153
* \param propName the property name, in quotes
154
* \param type the property type, pcf::IndiProperty::Type
155
* \param perm the property permissions, pcf::IndiProperty::PropertyPermType
156
* \param state the property state, pcf::IndiProperty::PropertyStateType
157
*
158
* \ingroup indi
159
*/
160
#define REG_INDI_NEWPROP_NOCB(prop, propName, type) registerIndiPropertyNew( prop, propName, type, pcf::IndiProperty::ReadOnly, pcf::IndiProperty::Idle, 0);
161
162
/// Register a SET INDI property with the class, using the standard callback name.
163
/** Is a wrapper for MagAOXApp::registerIndiPropertySet.
164
*
165
* \param prop the property member name, with no quotes
166
* \param propName the property name, in quotes
167
* \param type the property type, pcf::IndiProperty::Type
168
* \param perm the property permissions, pcf::IndiProperty::PropertyPermType
169
* \param state the property state, pcf::IndiProperty::PropertyStateType
170
*
171
* \ingroup indi
172
*/
173
#define REG_INDI_SETPROP(prop, devName, propName) registerIndiPropertySet( prop,devName, propName, INDI_SETCALLBACK(prop));
174
175
#endif //app_indiMacros_hpp
app
indiMacros.hpp
Generated by
1.8.13