rasdaman complete source
rviewMDD.hh
Go to the documentation of this file.
1 /*
2 * This file is part of rasdaman community.
3 *
4 * Rasdaman community is free software: you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation, either version 3 of the License, or
7 * (at your option) any later version.
8 *
9 * Rasdaman community is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with rasdaman community. If not, see <http://www.gnu.org/licenses/>.
16 *
17 * Copyright 2003, 2004, 2005, 2006, 2007, 2008, 2009 Peter Baumann /
18 rasdaman GmbH.
19 *
20 * For more information please see <http://www.rasdaman.org>
21 * or contact Peter Baumann via <baumann@rasdaman.com>.
22 /
23 
62 #ifndef _RVIEW_MDD_H_
63 #define _RVIEW_MDD_H_
64 
65 
66 
67 #ifdef __GNUG__
68 #pragma interface
69 #endif
70 
71 
72 #include "rasodmg/ref.hh"
73 #include "rasodmg/marray.hh"
74 #include "rasodmg/gmarray.hh"
75 #include "rasodmg/database.hh"
76 #include "raslib/odmgtypes.hh"
77 
78 #include "raslib/primitivetype.hh"
79 #include "raslib/structuretype.hh"
80 
81 
82 
83 
84 
85 /*
86  * Generic functionality on MDD objects -- data types and support functions
87  */
88 
89 // 1) Data types
90 
91 // A descriptor of the mdd iteration
92 typedef struct mdd_function_desc
93 {
94  double step;
95  long lstep;
96  long srcoff;
97  long low; // Entire domain of source cube
98  long high;
99  long useLow; // Domain that should be used, must be wholly contained in source cube
100  long useHigh;
101  long newLow; // Domain of resulting cube
102  long newHigh;
104 
105 
106 
107 // The signature of a basic mdd function
108 // Important note: VISUAL C needs the variable pointers first, followed by the
109 // constant pointers, or the variable pointers will be interpreted as constant
110 // ones too. No joke.
111 #define MDD_FUNCTION_SIGNATURE(type) \
112  (type *dest, const type *src, const mdd_function_desc *mfd, int dim, int datastep, void *auxData)
113 
114 typedef int (*mdd_func_bool)MDD_FUNCTION_SIGNATURE(r_Boolean);
115 typedef int (*mdd_func_char)MDD_FUNCTION_SIGNATURE(r_Char);
116 typedef int (*mdd_func_octet)MDD_FUNCTION_SIGNATURE(r_Octet);
117 typedef int (*mdd_func_short)MDD_FUNCTION_SIGNATURE(r_Short);
118 typedef int (*mdd_func_ushort)MDD_FUNCTION_SIGNATURE(r_UShort);
119 typedef int (*mdd_func_long)MDD_FUNCTION_SIGNATURE(r_Long);
120 typedef int (*mdd_func_ulong)MDD_FUNCTION_SIGNATURE(r_ULong);
121 typedef int (*mdd_func_float)MDD_FUNCTION_SIGNATURE(r_Float);
122 typedef int (*mdd_func_double)MDD_FUNCTION_SIGNATURE(r_Double);
123 
124 // A structure of mdd functions for all atomic base types
125 typedef struct mdd_function_pointers
126 {
127  mdd_func_bool mddf_bool;
128  mdd_func_char mddf_char;
129  mdd_func_octet mddf_octet;
130  mdd_func_short mddf_short;
131  mdd_func_ushort mddf_ushort;
132  mdd_func_long mddf_long;
133  mdd_func_ulong mddf_ulong;
134  mdd_func_float mddf_float;
135  mdd_func_double mddf_double;
137 
138 // Init a mdd_function_pointers structure with a mdd function template (therefore the
139 // same function name for all members)
140 #define MDD_INIT_FUNCTIONS(mfp, tf) \
141  mfp.mddf_bool = (mdd_func_bool)tf; \
142  mfp.mddf_char = (mdd_func_char)tf; \
143  mfp.mddf_octet = (mdd_func_octet)tf; \
144  mfp.mddf_short = (mdd_func_short)tf; \
145  mfp.mddf_ushort = (mdd_func_ushort)tf; \
146  mfp.mddf_long = (mdd_func_long)tf; \
147  mfp.mddf_ulong = (mdd_func_ulong)tf; \
148  mfp.mddf_float = (mdd_func_float)tf; \
149  mfp.mddf_double = (mdd_func_double)tf;
150 
151 
152 
153 // 2) Support functions
154 extern char *objectCalcStart(const char *src, const mdd_function_desc *mfd, int dim);
155 
156 // execute mdd functions over arbitrary objects
157 extern int mdd_objectFunctionPrim(const mdd_function_pointers *mfp, r_Primitive_Type *primType, const char *src, char *dest, const mdd_function_desc *mfd, int dim, int tpsize, void *auxData);
158 extern int mdd_objectFunctionStruct(const mdd_function_pointers *mfp, r_Structure_Type *structType, const char *src, char *dest, const mdd_function_desc *mfd, int dim, int tpsize, void *auxData);
159 extern int mdd_objectFunctionType(const mdd_function_pointers *mfp, const r_Type *baseType, const char *src, char *dest, const mdd_function_desc *mfd, int dim, int tpsize, void *auxData);
160 
161 // Initialising mdd functions
162 #define MDD_OBJECT_INIT_NEWIV 1
163 #define MDD_OBJECT_INIT_FPSTEP (2 | MDD_OBJECT_INIT_NEWIV)
164 extern char *mdd_objectFunctionInitMdd(r_Ref<r_GMarray> mddPtr, r_Ref<r_GMarray> &newMddPtr, r_Minterval &newInterv, int tpsize, r_Dimension dim, r_Database *db=NULL);
165 extern mdd_function_desc *mdd_objectFunctionInitData(r_Minterval &interv, r_Minterval &useInterv, r_Minterval &newInterv, int tpsize, unsigned int flags=0);
166 
167 
168 
169 
170 
171 
172 /*
173  * Wrapper functions for mdd function templates
174  */
175 int mdd_objectRange(r_Ref<r_GMarray> mddObj, r_Minterval &useInterv, double &min, double &max);
176 
178 
179 int mdd_objectScaleInter(r_Ref<r_GMarray> srcMdd, r_Minterval &useInterv, r_Ref<r_GMarray> &newMdd, r_Minterval &newInterv);
180 
181 int mdd_objectScaleAverage(r_Ref<r_GMarray> srcMdd, r_Minterval &useInterv, r_Ref<r_GMarray> &newMdd, r_Minterval &newInterv);
182 
183 int mdd_objectScaleSimple(r_Ref<r_GMarray> srcMdd, r_Minterval &useInterv, r_Ref<r_GMarray> &newMdd, r_Minterval &newInterv);
184 
185 int mdd_objectChangeEndianness(r_Ref<r_GMarray> srcMdd, r_Minterval &useInterv, r_Ref<r_GMarray> *newMdd=NULL, r_Minterval *newInterv=NULL);
186 
187 #if (defined(EARLY_TEMPLATE) && defined(__EXECUTABLE__))
188 #include "rviewMDD.cpp"
189 #endif
190 
191 #endif
mdd_func_double mddf_double
Definition: rviewMDD.hh:135
mdd_func_bool mddf_bool
Definition: rviewMDD.hh:127
int mdd_objectFunctionType(const mdd_function_pointers *mfp, const r_Type *baseType, const char *src, char *dest, const mdd_function_desc *mfd, int dim, int tpsize, void *auxData)
unsigned short r_UShort
Definition: odmgtypes.hh:87
int mdd_createSubcube(r_Ref< r_GMarray > srcMdd, r_Ref< r_GMarray > &newMdd, r_Minterval *domain, r_Database *db)
long low
Definition: rviewMDD.hh:97
mdd_func_ulong mddf_ulong
Definition: rviewMDD.hh:133
double step
Definition: rviewMDD.hh:94
long newLow
Definition: rviewMDD.hh:101
long useLow
Definition: rviewMDD.hh:99
unsigned int r_ULong
Definition: odmgtypes.hh:114
int16Row max
Definition: int16.hh:200
int mdd_objectFunctionStruct(const mdd_function_pointers *mfp, r_Structure_Type *structType, const char *src, char *dest, const mdd_function_desc *mfd, int dim, int tpsize, void *auxData)
Definition: structuretype.hh:56
mdd_func_char mddf_char
Definition: rviewMDD.hh:128
Definition: raslib/type.hh:56
struct mdd_function_desc mdd_function_desc
char * objectCalcStart(const char *src, const mdd_function_desc *mfd, int dim)
unsigned int r_Dimension
Definition: mddtypes.hh:118
Definition: database.hh:60
long newHigh
Definition: rviewMDD.hh:102
int mdd_objectScaleSimple(r_Ref< r_GMarray > srcMdd, r_Minterval &useInterv, r_Ref< r_GMarray > &newMdd, r_Minterval &newInterv)
unsigned char r_Boolean
Definition: odmgtypes.hh:151
double r_Double
Definition: odmgtypes.hh:138
mdd_func_float mddf_float
Definition: rviewMDD.hh:134
char * mdd_objectFunctionInitMdd(r_Ref< r_GMarray > mddPtr, r_Ref< r_GMarray > &newMddPtr, r_Minterval &newInterv, int tpsize, r_Dimension dim, r_Database *db=NULL)
Definition: rviewMDD.hh:92
long useHigh
Definition: rviewMDD.hh:100
struct mdd_function_pointers mdd_function_pointers
Definition: rviewMDD.hh:125
float r_Float
Definition: odmgtypes.hh:125
int mdd_objectScaleInter(r_Ref< r_GMarray > srcMdd, r_Minterval &useInterv, r_Ref< r_GMarray > &newMdd, r_Minterval &newInterv)
signed char r_Octet
Definition: odmgtypes.hh:60
unsigned char r_Char
Definition: odmgtypes.hh:47
mdd_func_short mddf_short
Definition: rviewMDD.hh:130
int mdd_objectChangeEndianness(r_Ref< r_GMarray > srcMdd, r_Minterval &useInterv, r_Ref< r_GMarray > *newMdd=NULL, r_Minterval *newInterv=NULL)
long lstep
Definition: rviewMDD.hh:95
long high
Definition: rviewMDD.hh:98
int mdd_func_bool MDD_FUNCTION_SIGNATURE(r_Boolean)
Definition: rviewMDD.hh:114
int16Row min
Definition: int16.hh:200
int mdd_objectScaleAverage(r_Ref< r_GMarray > srcMdd, r_Minterval &useInterv, r_Ref< r_GMarray > &newMdd, r_Minterval &newInterv)
mdd_function_desc * mdd_objectFunctionInitData(r_Minterval &interv, r_Minterval &useInterv, r_Minterval &newInterv, int tpsize, unsigned int flags=0)
Definition: primitivetype.hh:49
int r_Long
Definition: odmgtypes.hh:100
short r_Short
Definition: odmgtypes.hh:74
long srcoff
Definition: rviewMDD.hh:96
mdd_func_octet mddf_octet
Definition: rviewMDD.hh:129
mdd_func_long mddf_long
Definition: rviewMDD.hh:132
int mdd_objectFunctionPrim(const mdd_function_pointers *mfp, r_Primitive_Type *primType, const char *src, char *dest, const mdd_function_desc *mfd, int dim, int tpsize, void *auxData)
Definition: minterval.hh:249
mdd_func_ushort mddf_ushort
Definition: rviewMDD.hh:131
int mdd_objectRange(r_Ref< r_GMarray > mddObj, r_Minterval &useInterv, double &min, double &max)