fldefs_attrcb.h 4.1 KB
Newer Older
thomas's avatar
thomas committed
1
2
3
4
/* 

flext - C++ layer for Max/MSP and pd (pure data) externals

thomas's avatar
thomas committed
5
Copyright (c) 2001-2005 Thomas Grill (gr@grrrr.org)
thomas's avatar
thomas committed
6
7
8
For information on usage and redistribution, and for a DISCLAIMER OF ALL
WARRANTIES, see the file, "license.txt," in this distribution.  

thomas's avatar
thomas committed
9
10
11
$LastChangedRevision$
$LastChangedDate$
$LastChangedBy$
thomas's avatar
thomas committed
12
13
14
15
16
17
18
19
20
21
22
23
24
*/

/*! \file fldefs_attrcb.h
    \brief This file contains all #defines for actual usage
    
*/

#ifndef __FLEXT_DEFS_ATTRCB_H
#define __FLEXT_DEFS_ATTRCB_H



/*! \brief Declare a attribute set function
thomas's avatar
thomas committed
25
    \internal
thomas's avatar
thomas committed
26
27
28
29
30
31
*/
#define FLEXT_CALLSET_(FUN,TP) \
static bool FLEXT_SET_PRE(FUN)(flext_base *c,TP &arg) \
{ FLEXT_CAST<thisType *>(c)->FUN(arg); return true; }

/*! \brief Declare a attribute get function
thomas's avatar
thomas committed
32
    \internal
thomas's avatar
thomas committed
33
34
35
36
37
38
39
*/
#define FLEXT_CALLGET_(FUN,TP) \
static bool FLEXT_GET_PRE(FUN)(flext_base *c,TP &arg) \
{ FLEXT_CAST<thisType *>(c)->FUN(arg); return true; }



thomas's avatar
thomas committed
40
/*! \defgroup FLEXT_DA_CALLSET Definition of attribute set handlers
thomas's avatar
thomas committed
41
    \ingroup FLEXT_D_ATTRIB
thomas's avatar
thomas committed
42
    @{ 
thomas's avatar
thomas committed
43
44
45
46
47
48
49
50
51
52
53
54
55
*/

//! Declare a set function for a float attribute
#define FLEXT_CALLSET_F(SFUN) \
\
FLEXT_CALLSET_(SFUN,float)

//! Declare a set function for an integer attribute
#define FLEXT_CALLSET_I(SFUN) \
\
FLEXT_CALLSET_(SFUN,int)

//! Declare a set function for a boolean attribute
thomas's avatar
thomas committed
56
57
58
59
#define FLEXT_CALLSET_B(SFUN) \
\
FLEXT_CALLSET_(SFUN,bool)
/*
thomas's avatar
thomas committed
60
61
static bool FLEXT_SET_PRE(FUN)(flext_base *c,int &arg) \
{ bool b = arg != 0; FLEXT_CAST<thisType *>(c)->FUN(b); return true; }
thomas's avatar
thomas committed
62
*/
thomas's avatar
thomas committed
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80

//! Declare a set function for an enum attribute
#define FLEXT_CALLSET_E(SFUN,TP) \
\
FLEXT_CALLSET_(SFUN,TP)

//! Declare a set function for a symbol attribute
#define FLEXT_CALLSET_S(FUN) \
static bool FLEXT_SET_PRE(FUN)(flext_base *c,const t_symbol *&arg) \
{ FLEXT_CAST<thisType *>(c)->FUN(arg); return true; }

//! Declare a set function for a variable list attribute
#define FLEXT_CALLSET_V(FUN) \
static bool FLEXT_SET_PRE(FUN)(flext_base *c,AtomList *&arg) \
{ FLEXT_CAST<thisType *>(c)->FUN(*arg); return true; }

//! @} FLEXT_DA_CALLSET

thomas's avatar
thomas committed
81
/*! \defgroup FLEXT_DA_CALLGET Definition of attribute get handlers
thomas's avatar
thomas committed
82
    \ingroup FLEXT_D_ATTRIB
thomas's avatar
thomas committed
83
    @{ 
thomas's avatar
thomas committed
84
85
86
87
88
89
90
91
92
93
94
95
96
*/

//! Declare a get function for a float attribute
#define FLEXT_CALLGET_F(GFUN) \
\
FLEXT_CALLGET_(GFUN,float)

//! Declare a get function for an integer attribute
#define FLEXT_CALLGET_I(GFUN) \
\
FLEXT_CALLGET_(GFUN,int)

//! Declare a get function for a boolean attribute
thomas's avatar
thomas committed
97
98
99
100
#define FLEXT_CALLGET_B(GFUN) \
\
FLEXT_CALLGET_(GFUN,bool)
/*
thomas's avatar
thomas committed
101
102
static bool FLEXT_GET_PRE(FUN)(flext_base *c,int &arg) \
{ bool b; FLEXT_CAST<thisType *>(c)->FUN(b); arg = b?1:0; return true; }
thomas's avatar
thomas committed
103
*/
thomas's avatar
thomas committed
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122

//! Declare a get function for an enum attribute
#define FLEXT_CALLGET_E(GFUN,TP) \
\
FLEXT_CALLGET_(GFUN,TP)

//! Declare a get function for a symbol attribute
#define FLEXT_CALLGET_S(FUN) \
static bool FLEXT_GET_PRE(FUN)(flext_base *c,const t_symbol *&arg) \
{ FLEXT_CAST<thisType *>(c)->FUN(arg); return true; }

//! Declare a get function for a variable list attribute
#define FLEXT_CALLGET_V(FUN) \
static bool FLEXT_GET_PRE(FUN)(flext_base *c,AtomList *&arg) \
{ FLEXT_CAST<thisType *>(c)->FUN(*arg); return true; }

//! @} FLEXT_DA_CALLGET


thomas's avatar
thomas committed
123
/*! \defgroup FLEXT_DA_CALLVAR Definition of attribute transfer handlers (both get and set)
thomas's avatar
thomas committed
124
    \ingroup FLEXT_D_ATTRIB
thomas's avatar
thomas committed
125
    @{ 
thomas's avatar
thomas committed
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
*/

//! Declare both get and set functions for a float attribute
#define FLEXT_CALLVAR_F(GFUN,SFUN) \
\
FLEXT_CALLGET_F(GFUN) FLEXT_CALLSET_F(SFUN) 

//! Declare both get and set functions for an integer attribute
#define FLEXT_CALLVAR_I(GFUN,SFUN) \
\
FLEXT_CALLGET_I(GFUN) FLEXT_CALLSET_I(SFUN) 

//! Declare both get and set functions for a symbol attribute
#define FLEXT_CALLVAR_S(GFUN,SFUN) \
\
FLEXT_CALLGET_S(GFUN) FLEXT_CALLSET_S(SFUN) 

//! Declare both get and set functions for a boolean attribute
#define FLEXT_CALLVAR_B(GFUN,SFUN) \
\
FLEXT_CALLGET_B(GFUN) FLEXT_CALLSET_B(SFUN) 

//! Declare both get and set functions for an enum attribute
#define FLEXT_CALLVAR_E(GFUN,SFUN,TP) \
\
FLEXT_CALLGET_E(GFUN,TP) FLEXT_CALLSET_E(SFUN,TP) 

//! Declare both get and set functions for a variable list attribute
#define FLEXT_CALLVAR_V(GFUN,SFUN) \
\
FLEXT_CALLGET_V(GFUN) FLEXT_CALLSET_V(SFUN) 

//! @} FLEXT_DA_CALLVAR


#endif