Loading [MathJax]/extensions/TeX/AMSsymbols.js
amino
1.0-beta2
Lightweight Robot Utility Library
Main Page
Download
Tutorial
Linear Algebra
Rotation
Transformation
Scene Graphs
Kinematics
Collision
Motion Planning
Documentation
Installation
Viewer GUI
Scene Compiler
Scene Files
FAQ
API
File List
File Members
All
a
o
Functions
a
o
Variables
Typedefs
a
Enumerations
Enumerator
a
Macros
a
Class List
Class Members
All
_
a
b
c
d
e
f
g
h
i
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
~
Functions
_
a
b
c
d
e
f
g
i
l
m
n
o
p
q
r
s
t
u
v
x
y
z
~
Variables
a
b
c
d
e
f
h
i
l
m
n
o
p
q
r
s
t
v
w
x
y
z
Typedefs
Lisp API
Amino Core
Amino RX
Amino CLPython
About
License
Acknowledgments
•
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Macros
Pages
getset.h
1
/* -*- mode: C; c-basic-offset: 4 -*- */
2
/* ex: set shiftwidth=4 tabstop=4 expandtab: */
3
/*
4
* Copyright (c) 2015, Rice University
5
* All rights reserved.
6
*
7
* Author(s): Neil T. Dantam <ntd@gatech.edu>
8
* Georgia Tech Humanoid Robotics Lab
9
* Under Direction of Prof. Mike Stilman <mstilman@cc.gatech.edu>
10
*
11
*
12
* This file is provided under the following "BSD-style" License:
13
*
14
*
15
* Redistribution and use in source and binary forms, with or
16
* without modification, are permitted provided that the following
17
* conditions are met:
18
*
19
* * Redistributions of source code must retain the above copyright
20
* notice, this list of conditions and the following disclaimer.
21
*
22
* * Redistributions in binary form must reproduce the above
23
* copyright notice, this list of conditions and the following
24
* disclaimer in the documentation and/or other materials provided
25
* with the distribution.
26
*
27
* * Neither the name of the Rice University nor the names of its
28
* contributors may be used to endorse or promote products derived
29
* from this software without specific prior written permission.
30
*
31
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
32
* CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
33
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
34
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
35
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
36
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
37
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
38
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
39
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
40
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
41
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
42
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
43
* POSSIBILITY OF SUCH DAMAGE.
44
*
45
*/
46
47
#ifndef AMINO_GETSET_H
48
#define AMINO_GETSET_H
49
50
#define AA_DEC_SETTER( struct_type, type, field_name ) \
51
AA_API void \
52
struct_type ## _set_ ## field_name( struct struct_type *obj, \
53
type field_name )
54
55
56
#define AA_DEC_VEC_SETTER( struct_type, field_name ) \
57
AA_API void \
58
struct_type ## _set_ ## field_name( struct struct_type *obj, \
59
const double field_name[3] )
60
61
#define AA_DEC_VEC3_SETTER( struct_type, field_name, x, y, z) \
62
AA_API void \
63
struct_type ## _set_ ## field_name ## 3( struct struct_type *obj, \
64
double x, \
65
double y, \
66
double z )
67
68
#define AA_DEF_SETTER( struct_type, field_type, field_name ) \
69
AA_DEC_SETTER( struct_type, field_type, field_name ) \
70
{ \
71
obj->field_name = field_name; \
72
}
73
74
#define AA_DEF_SETTER_SUB( struct_type, field_type, field_name, field_sub ) \
75
AA_DEC_SETTER( struct_type, field_type, field_name ) \
76
{ \
77
obj->field_sub = field_name; \
78
}
79
80
#define AA_DEF_BOOL_SETTER( struct_type, field_name ) \
81
AA_DEC_SETTER( struct_type, int, field_name ) \
82
{ \
83
obj->field_name = field_name ? 1 : 0; \
84
}
85
86
#define AA_DEF_FLOAT_SETTER( struct_type, field_name ) \
87
AA_DEC_SETTER( struct_type, double, field_name ) \
88
{ \
89
obj->field_name = (float)field_name; \
90
}
91
92
#define AA_DEF_FLOAT3_SETTER( struct_type, field_name ) \
93
AA_DEC_VEC3_SETTER( struct_type, field_name, x, y, z ) \
94
{ \
95
obj->field_name[0] = (float)x; \
96
obj->field_name[1] = (float)y; \
97
obj->field_name[2] = (float)z; \
98
} \
99
\
100
AA_DEC_VEC_SETTER( struct_type, field_name) \
101
{ \
102
struct_type ## _set_ ## field_name ## 3( obj, \
103
field_name[0], \
104
field_name[1], \
105
field_name[2] ); \
106
}
107
108
#define AA_DEF_VEC3_SETTER( struct_type, field_name ) \
109
AA_DEC_VEC3_SETTER( struct_type, field_name, x, y, z ) \
110
{ \
111
obj->field_name[0] = x; \
112
obj->field_name[1] = y; \
113
obj->field_name[2] = z; \
114
} \
115
\
116
AA_DEC_VEC_SETTER( struct_type, field_name) \
117
{ \
118
struct_type ## _set_ ## field_name ## 3( obj, \
119
field_name[0], \
120
field_name[1], \
121
field_name[2] ); \
122
}
123
124
#define AA_DEF_GETTER( struct_type, field_type, field_name ) \
125
AA_API field_type \
126
struct_type ## _get_ ## field_name(const struct struct_type *obj) \
127
{ \
128
return obj->field_name; \
129
}
130
131
#endif
/*AMINO_GETSET_H*/