00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024 #include "fennel/common/CommonPreamble.h"
00025 #include "fennel/calculator/ExtDynamicVariable.h"
00026 #include "fennel/calculator/ExtendedInstructionTable.h"
00027 #include "fennel/exec/DynamicParam.h"
00028 #include "fennel/tuple/StandardTypeDescriptor.h"
00029
00030 FENNEL_BEGIN_NAMESPACE
00031
00032 PConstBuffer getData(RegisterRef<int>* id) {
00033 assert(!id->isNull());
00034 return id->getDynamicParamManager()->getParam(
00035 DynamicParamId(id->value())).getDatum().pData;
00036 }
00037
00038 void
00039 dynamicVariable(
00040 RegisterRef<int8_t>* result,
00041 RegisterRef<int32_t>* id)
00042 {
00043 result->value(*reinterpret_cast<int8_t const *>(getData(id)));
00044 }
00045
00046 void
00047 dynamicVariable(
00048 RegisterRef<uint8_t>* result,
00049 RegisterRef<int32_t>* id)
00050 {
00051 result->value(*reinterpret_cast<uint8_t const *>(getData(id)));
00052 }
00053
00054 void
00055 dynamicVariable(
00056 RegisterRef<int16_t>* result,
00057 RegisterRef<int32_t>* id)
00058 {
00059 result->value(*reinterpret_cast<int16_t const *>(getData(id)));
00060 }
00061
00062 void
00063 dynamicVariable(
00064 RegisterRef<uint16_t>* result,
00065 RegisterRef<int32_t>* id)
00066 {
00067 result->value(*reinterpret_cast<uint16_t const *>(getData(id)));
00068 }
00069
00070 void
00071 dynamicVariable(
00072 RegisterRef<int32_t>* result,
00073 RegisterRef<int32_t>* id)
00074 {
00075 result->value(*reinterpret_cast<int32_t const *>(getData(id)));
00076 }
00077
00078 void
00079 dynamicVariable(
00080 RegisterRef<uint32_t>* result,
00081 RegisterRef<int32_t>* id)
00082 {
00083 result->value(*reinterpret_cast<uint32_t const *>(getData(id)));
00084 }
00085
00086 void
00087 dynamicVariable(
00088 RegisterRef<int64_t>* result,
00089 RegisterRef<int32_t>* id)
00090 {
00091 result->value(*reinterpret_cast<int64_t const *>(getData(id)));
00092 }
00093
00094 void
00095 dynamicVariable(
00096 RegisterRef<uint64_t>* result,
00097 RegisterRef<int32_t>* id)
00098 {
00099 result->value(*reinterpret_cast<uint64_t const *>(getData(id)));
00100 }
00101
00102 void
00103 dynamicVariable(
00104 RegisterRef<float>* result,
00105 RegisterRef<int32_t>* id)
00106 {
00107 result->value(*reinterpret_cast<float const *>(getData(id)));
00108 }
00109
00110 void
00111 dynamicVariable(
00112 RegisterRef<double>* result,
00113 RegisterRef<int32_t>* id)
00114 {
00115 result->value(*reinterpret_cast<double const *>(getData(id)));
00116 }
00117
00118 void
00119 dynamicVariable(
00120 RegisterRef<bool>* result,
00121 RegisterRef<int32_t>* id)
00122 {
00123 result->value(*reinterpret_cast<bool const *>(getData(id)));
00124 }
00125
00126 void
00127 dynamicVariable(
00128 RegisterRef<char*>* result,
00129 RegisterRef<int32_t>* id)
00130 {
00131 result->value(*reinterpret_cast<char* const *>(getData(id)));
00132 }
00133
00134 void
00135 ExtDynamicVariableRegister(ExtendedInstructionTable* eit)
00136 {
00137 assert(eit != NULL);
00138
00139 vector<StandardTypeDescriptorOrdinal> params_s1;
00140 params_s1.push_back(STANDARD_TYPE_INT_8);
00141 params_s1.push_back(STANDARD_TYPE_INT_32);
00142 eit->add(
00143 "dynamicVariable", params_s1,
00144 (ExtendedInstruction2<int8_t, int32_t>*) NULL,
00145 &dynamicVariable);
00146
00147 vector<StandardTypeDescriptorOrdinal> params_u1;
00148 params_u1.push_back(STANDARD_TYPE_UINT_8);
00149 params_u1.push_back(STANDARD_TYPE_INT_32);
00150 eit->add(
00151 "dynamicVariable", params_u1,
00152 (ExtendedInstruction2<uint8_t, int>*) NULL,
00153 &dynamicVariable);
00154
00155 vector<StandardTypeDescriptorOrdinal> params_s2;
00156 params_s2.push_back(STANDARD_TYPE_INT_16);
00157 params_s2.push_back(STANDARD_TYPE_INT_32);
00158 eit->add(
00159 "dynamicVariable", params_s2,
00160 (ExtendedInstruction2<int16_t, int32_t>*) NULL,
00161 &dynamicVariable);
00162
00163 vector<StandardTypeDescriptorOrdinal> params_u2;
00164 params_u2.push_back(STANDARD_TYPE_UINT_16);
00165 params_u2.push_back(STANDARD_TYPE_INT_32);
00166 eit->add(
00167 "dynamicVariable", params_u2,
00168 (ExtendedInstruction2<uint16_t, int32_t>*) NULL,
00169 &dynamicVariable);
00170
00171 vector<StandardTypeDescriptorOrdinal> params_s4;
00172 params_s4.push_back(STANDARD_TYPE_INT_32);
00173 params_s4.push_back(STANDARD_TYPE_INT_32);
00174 eit->add(
00175 "dynamicVariable", params_s4,
00176 (ExtendedInstruction2<int32_t, int32_t>*) NULL,
00177 &dynamicVariable);
00178
00179 vector<StandardTypeDescriptorOrdinal> params_u4;
00180 params_u4.push_back(STANDARD_TYPE_UINT_32);
00181 params_u4.push_back(STANDARD_TYPE_INT_32);
00182 eit->add(
00183 "dynamicVariable", params_u4,
00184 (ExtendedInstruction2<uint32_t, int32_t>*) NULL,
00185 &dynamicVariable);
00186
00187 vector<StandardTypeDescriptorOrdinal> params_s8;
00188 params_s8.push_back(STANDARD_TYPE_INT_64);
00189 params_s8.push_back(STANDARD_TYPE_INT_32);
00190 eit->add(
00191 "dynamicVariable", params_s8,
00192 (ExtendedInstruction2<int64_t, int32_t>*) NULL,
00193 &dynamicVariable);
00194
00195 vector<StandardTypeDescriptorOrdinal> params_u8;
00196 params_u8.push_back(STANDARD_TYPE_UINT_64);
00197 params_u8.push_back(STANDARD_TYPE_INT_32);
00198 eit->add(
00199 "dynamicVariable", params_u8,
00200 (ExtendedInstruction2<uint64_t, int32_t>*) NULL,
00201 &dynamicVariable);
00202
00203 vector<StandardTypeDescriptorOrdinal> params_float;
00204 params_float.push_back(STANDARD_TYPE_REAL);
00205 params_float.push_back(STANDARD_TYPE_INT_32);
00206 eit->add(
00207 "dynamicVariable", params_float,
00208 (ExtendedInstruction2<float, int32_t>*) NULL,
00209 &dynamicVariable);
00210
00211 vector<StandardTypeDescriptorOrdinal> params_double;
00212 params_double.push_back(STANDARD_TYPE_DOUBLE);
00213 params_double.push_back(STANDARD_TYPE_INT_32);
00214 eit->add(
00215 "dynamicVariable", params_double,
00216 (ExtendedInstruction2<double, int32_t>*) NULL,
00217 &dynamicVariable);
00218
00219 vector<StandardTypeDescriptorOrdinal> params_bool;
00220 params_bool.push_back(STANDARD_TYPE_BOOL);
00221 params_bool.push_back(STANDARD_TYPE_INT_32);
00222 eit->add(
00223 "dynamicVariable", params_bool,
00224 (ExtendedInstruction2<bool, int32_t>*) NULL,
00225 &dynamicVariable);
00226
00227 vector<StandardTypeDescriptorOrdinal> params_char;
00228 params_char.push_back(STANDARD_TYPE_CHAR);
00229 params_char.push_back(STANDARD_TYPE_INT_32);
00230 eit->add(
00231 "dynamicVariable", params_char,
00232 (ExtendedInstruction2<char*, int32_t>*) NULL,
00233 &dynamicVariable);
00234
00235 vector<StandardTypeDescriptorOrdinal> params_varchar;
00236 params_varchar.push_back(STANDARD_TYPE_VARCHAR);
00237 params_varchar.push_back(STANDARD_TYPE_INT_32);
00238 eit->add(
00239 "dynamicVariable", params_varchar,
00240 (ExtendedInstruction2<char*, int32_t>*) NULL,
00241 &dynamicVariable);
00242
00243 vector<StandardTypeDescriptorOrdinal> params_binary;
00244 params_binary.push_back(STANDARD_TYPE_BINARY);
00245 params_binary.push_back(STANDARD_TYPE_INT_32);
00246 eit->add(
00247 "dynamicVariable", params_binary,
00248 (ExtendedInstruction2<char*, int32_t>*) NULL,
00249 &dynamicVariable);
00250
00251 vector<StandardTypeDescriptorOrdinal> params_varbinary;
00252 params_varbinary.push_back(STANDARD_TYPE_VARBINARY);
00253 params_varbinary.push_back(STANDARD_TYPE_INT_32);
00254 eit->add(
00255 "dynamicVariable", params_varbinary,
00256 (ExtendedInstruction2<char*, int32_t>*) NULL,
00257 &dynamicVariable);
00258
00259 }
00260
00261
00262 FENNEL_END_NAMESPACE
00263
00264