[308] | 1 | #ifndef __XIOS_TYPE_SPECIALISATION_HPP__ |
---|
| 2 | #define __XIOS_TYPE_SPECIALISATION_HPP__ |
---|
| 3 | |
---|
[591] | 4 | #include "xios_spl.hpp" |
---|
[308] | 5 | #include "exception.hpp" |
---|
| 6 | #include "buffer_in.hpp" |
---|
| 7 | #include "buffer_out.hpp" |
---|
[369] | 8 | #include "type.hpp" |
---|
| 9 | #include <string> |
---|
| 10 | #include <boost/algorithm/string.hpp> |
---|
[532] | 11 | #include "date.hpp" |
---|
[369] | 12 | |
---|
[335] | 13 | namespace xios |
---|
[308] | 14 | { |
---|
| 15 | |
---|
[369] | 16 | // template specialization for bool |
---|
[308] | 17 | |
---|
[369] | 18 | template <> void CType<bool>::_fromString(const string& str) |
---|
| 19 | { |
---|
| 20 | string tmpStr=boost::to_lower_copy(boost::trim_copy(str)) ; |
---|
| 21 | if (tmpStr=="true" || tmpStr==".true." || tmpStr=="yes" || tmpStr=="y") set(true) ; |
---|
| 22 | else if (tmpStr=="false" || tmpStr==".false." || tmpStr=="no" || tmpStr=="n") set(false) ; |
---|
| 23 | else ERROR("template <> CType<bool>::fromString(const string& str)",<< tmpStr << " cannot be converted in a boolean value") ; |
---|
| 24 | } |
---|
| 25 | |
---|
| 26 | template <> string CType<bool>::_toString(void) const |
---|
| 27 | { |
---|
| 28 | if (get()) return string("true") ; |
---|
| 29 | else return string("false") ; |
---|
| 30 | } |
---|
| 31 | |
---|
| 32 | template <> void CType_ref<bool>::_fromString(const string& str) const |
---|
| 33 | { |
---|
| 34 | string tmpStr=boost::to_lower_copy(boost::trim_copy(str)) ; |
---|
| 35 | if (tmpStr=="true" || tmpStr==".true." || tmpStr=="yes" || tmpStr=="y") set(true) ; |
---|
| 36 | else if (tmpStr=="false" || tmpStr==".false." || tmpStr=="no" || tmpStr=="n") set(false) ; |
---|
| 37 | else ERROR("template <> CType<bool>::fromString(const string& str)",<< tmpStr << " cannot be converted in a boolean value") ; |
---|
| 38 | } |
---|
| 39 | |
---|
| 40 | template <> void CType_ref<bool>::_fromString(const string& str) |
---|
| 41 | { |
---|
| 42 | string tmpStr=boost::to_lower_copy(boost::trim_copy(str)) ; |
---|
| 43 | if (tmpStr=="true" || tmpStr==".true." || tmpStr=="yes" || tmpStr=="y") set(true) ; |
---|
| 44 | else if (tmpStr=="false" || tmpStr==".false." || tmpStr=="no" || tmpStr=="n") set(false) ; |
---|
| 45 | else ERROR("template <> CType<bool>::fromString(const string& str)",<< tmpStr << " cannot be converted in a boolean value") ; |
---|
| 46 | } |
---|
| 47 | |
---|
| 48 | template <> string CType_ref<bool>::_toString(void) const |
---|
| 49 | { |
---|
| 50 | if (get()) return string("true") ; |
---|
| 51 | else return string("false") ; |
---|
| 52 | } |
---|
[308] | 53 | |
---|
[369] | 54 | // template specialization for string |
---|
| 55 | |
---|
[308] | 56 | template <> |
---|
[369] | 57 | size_t CType<string>::_size() const |
---|
[308] | 58 | { |
---|
| 59 | size_t typeSize=0 ; |
---|
| 60 | typeSize+=sizeof(size_t) ; |
---|
| 61 | typeSize+=ptrValue->size() ; |
---|
| 62 | return typeSize ; |
---|
| 63 | } |
---|
[369] | 64 | |
---|
| 65 | template <> |
---|
| 66 | size_t CType_ref<string>::_size() const |
---|
| 67 | { |
---|
| 68 | size_t typeSize=0 ; |
---|
| 69 | typeSize+=sizeof(size_t) ; |
---|
| 70 | typeSize+=ptrValue->size() ; |
---|
| 71 | return typeSize ; |
---|
| 72 | } |
---|
[308] | 73 | |
---|
| 74 | template <> |
---|
[369] | 75 | void CType<string>::_fromString(const string& str) |
---|
[308] | 76 | { |
---|
[369] | 77 | allocate() ; |
---|
| 78 | *ptrValue=str ; |
---|
| 79 | } |
---|
| 80 | |
---|
| 81 | template <> |
---|
| 82 | void CType_ref<string>::_fromString(const string& str) |
---|
| 83 | { |
---|
| 84 | checkEmpty() ; |
---|
| 85 | *ptrValue=str ; |
---|
| 86 | } |
---|
| 87 | |
---|
| 88 | template <> |
---|
| 89 | void CType_ref<string>::_fromString(const string& str) const |
---|
| 90 | { |
---|
| 91 | checkEmpty() ; |
---|
| 92 | *ptrValue=str ; |
---|
| 93 | } |
---|
| 94 | |
---|
| 95 | template <> |
---|
| 96 | bool CType<string>::_toBuffer(CBufferOut& buffer) const |
---|
| 97 | { |
---|
[308] | 98 | if (buffer.remain()<size()) return false ; |
---|
| 99 | else |
---|
| 100 | { |
---|
| 101 | bool ret=true ; |
---|
| 102 | if (ret) ret&=buffer.put(ptrValue->size()) ; |
---|
| 103 | if (ret) ret&=buffer.put(ptrValue->data(),ptrValue->size()) ; |
---|
| 104 | return ret ; |
---|
| 105 | } |
---|
| 106 | } |
---|
[369] | 107 | |
---|
| 108 | template <> |
---|
| 109 | bool CType_ref<string>::_toBuffer(CBufferOut& buffer) const |
---|
| 110 | { |
---|
| 111 | if (buffer.remain()<size()) return false ; |
---|
| 112 | else |
---|
| 113 | { |
---|
| 114 | bool ret=true ; |
---|
| 115 | if (ret) ret&=buffer.put(ptrValue->size()) ; |
---|
| 116 | if (ret) ret&=buffer.put(ptrValue->data(),ptrValue->size()) ; |
---|
| 117 | return ret ; |
---|
| 118 | } |
---|
| 119 | } |
---|
| 120 | |
---|
| 121 | |
---|
| 122 | |
---|
| 123 | template <> |
---|
| 124 | bool CType<string>::_fromBuffer(CBufferIn& buffer) |
---|
| 125 | { |
---|
| 126 | allocate() ; |
---|
| 127 | bool ret=true ; |
---|
| 128 | size_t typeSize ; |
---|
| 129 | if (ret) ret&=buffer.get(typeSize) ; |
---|
| 130 | |
---|
| 131 | char* str; |
---|
| 132 | str= (char*) buffer.ptr() ; |
---|
| 133 | if (ret) buffer.advance(typeSize) ; |
---|
| 134 | if (ret) *ptrValue=string(str,typeSize) ; |
---|
| 135 | |
---|
| 136 | return ret ; |
---|
| 137 | } |
---|
[308] | 138 | |
---|
| 139 | template <> |
---|
[369] | 140 | bool CType_ref<string>::_fromBuffer(CBufferIn& buffer) const |
---|
[308] | 141 | { |
---|
| 142 | bool ret=true ; |
---|
| 143 | size_t typeSize ; |
---|
| 144 | if (ret) ret&=buffer.get(typeSize) ; |
---|
| 145 | |
---|
| 146 | char* str; |
---|
| 147 | str= (char*) buffer.ptr() ; |
---|
| 148 | if (ret) buffer.advance(typeSize) ; |
---|
| 149 | if (ret) *ptrValue=string(str,typeSize) ; |
---|
| 150 | |
---|
| 151 | return ret ; |
---|
[369] | 152 | } |
---|
| 153 | |
---|
| 154 | template <> |
---|
| 155 | bool CType_ref<string>::_fromBuffer(CBufferIn& buffer) |
---|
| 156 | { |
---|
| 157 | bool ret=true ; |
---|
| 158 | size_t typeSize ; |
---|
| 159 | if (ret) ret&=buffer.get(typeSize) ; |
---|
| 160 | |
---|
| 161 | char* str; |
---|
| 162 | str= (char*) buffer.ptr() ; |
---|
| 163 | if (ret) buffer.advance(typeSize) ; |
---|
| 164 | if (ret) *ptrValue=string(str,typeSize) ; |
---|
| 165 | |
---|
| 166 | return ret ; |
---|
| 167 | } |
---|
[532] | 168 | |
---|
| 169 | // template specializations for CDate |
---|
| 170 | |
---|
| 171 | template <> |
---|
| 172 | size_t CType<CDate>::_size() const |
---|
| 173 | { |
---|
| 174 | return 6 * sizeof(int); |
---|
| 175 | } |
---|
| 176 | |
---|
| 177 | template <> |
---|
| 178 | size_t CType_ref<CDate>::_size() const |
---|
| 179 | { |
---|
| 180 | return 6 * sizeof(int); |
---|
| 181 | } |
---|
| 182 | |
---|
| 183 | template <> |
---|
| 184 | bool CType<CDate>::_toBuffer(CBufferOut& buffer) const |
---|
| 185 | { |
---|
| 186 | if (buffer.remain() < size()) return false; |
---|
| 187 | else |
---|
| 188 | { |
---|
| 189 | bool ret = true; |
---|
| 190 | if (ret) ret &= buffer.put(ptrValue->getYear()); |
---|
| 191 | if (ret) ret &= buffer.put(ptrValue->getMonth()); |
---|
| 192 | if (ret) ret &= buffer.put(ptrValue->getDay()); |
---|
| 193 | if (ret) ret &= buffer.put(ptrValue->getHour()); |
---|
| 194 | if (ret) ret &= buffer.put(ptrValue->getMinute()); |
---|
| 195 | if (ret) ret &= buffer.put(ptrValue->getSecond()); |
---|
| 196 | return ret; |
---|
| 197 | } |
---|
| 198 | } |
---|
| 199 | |
---|
| 200 | template <> |
---|
| 201 | bool CType_ref<CDate>::_toBuffer(CBufferOut& buffer) const |
---|
| 202 | { |
---|
| 203 | if (buffer.remain() < size()) return false; |
---|
| 204 | else |
---|
| 205 | { |
---|
| 206 | bool ret = true; |
---|
| 207 | if (ret) ret &= buffer.put(ptrValue->getYear()); |
---|
| 208 | if (ret) ret &= buffer.put(ptrValue->getMonth()); |
---|
| 209 | if (ret) ret &= buffer.put(ptrValue->getDay()); |
---|
| 210 | if (ret) ret &= buffer.put(ptrValue->getHour()); |
---|
| 211 | if (ret) ret &= buffer.put(ptrValue->getMinute()); |
---|
| 212 | if (ret) ret &= buffer.put(ptrValue->getSecond()); |
---|
| 213 | return ret; |
---|
| 214 | } |
---|
| 215 | } |
---|
| 216 | |
---|
| 217 | template <> |
---|
| 218 | bool CType<CDate>::_fromBuffer(CBufferIn& buffer) |
---|
| 219 | { |
---|
| 220 | allocate(); |
---|
| 221 | bool ret = true; |
---|
| 222 | |
---|
| 223 | int year, month, day, hour, min, sec; |
---|
| 224 | if (ret) ret &= buffer.get(year); |
---|
| 225 | if (ret) ret &= buffer.get(month); |
---|
| 226 | if (ret) ret &= buffer.get(day); |
---|
| 227 | if (ret) ret &= buffer.get(hour); |
---|
| 228 | if (ret) ret &= buffer.get(min); |
---|
| 229 | if (ret) ret &= buffer.get(sec); |
---|
| 230 | if (ret) |
---|
| 231 | { |
---|
| 232 | ptrValue->setYear(year); |
---|
| 233 | ptrValue->setMonth(month); |
---|
| 234 | ptrValue->setDay(day); |
---|
| 235 | ptrValue->setHour(hour); |
---|
| 236 | ptrValue->setMinute(min); |
---|
| 237 | ptrValue->setSecond(sec); |
---|
| 238 | } |
---|
| 239 | |
---|
| 240 | return ret; |
---|
| 241 | } |
---|
| 242 | |
---|
| 243 | template <> |
---|
| 244 | bool CType_ref<CDate>::_fromBuffer(CBufferIn& buffer) const |
---|
| 245 | { |
---|
| 246 | bool ret = true; |
---|
| 247 | |
---|
| 248 | int year, month, day, hour, min, sec; |
---|
| 249 | if (ret) ret &= buffer.get(year); |
---|
| 250 | if (ret) ret &= buffer.get(month); |
---|
| 251 | if (ret) ret &= buffer.get(day); |
---|
| 252 | if (ret) ret &= buffer.get(hour); |
---|
| 253 | if (ret) ret &= buffer.get(min); |
---|
| 254 | if (ret) ret &= buffer.get(sec); |
---|
| 255 | if (ret) |
---|
| 256 | { |
---|
| 257 | ptrValue->setYear(year); |
---|
| 258 | ptrValue->setMonth(month); |
---|
| 259 | ptrValue->setDay(day); |
---|
| 260 | ptrValue->setHour(hour); |
---|
| 261 | ptrValue->setMinute(min); |
---|
| 262 | ptrValue->setSecond(sec); |
---|
| 263 | } |
---|
| 264 | |
---|
| 265 | return ret; |
---|
| 266 | } |
---|
| 267 | |
---|
| 268 | template <> |
---|
| 269 | bool CType_ref<CDate>::_fromBuffer(CBufferIn& buffer) |
---|
| 270 | { |
---|
| 271 | bool ret = true; |
---|
| 272 | |
---|
| 273 | int year, month, day, hour, min, sec; |
---|
| 274 | if (ret) ret &= buffer.get(year); |
---|
| 275 | if (ret) ret &= buffer.get(month); |
---|
| 276 | if (ret) ret &= buffer.get(day); |
---|
| 277 | if (ret) ret &= buffer.get(hour); |
---|
| 278 | if (ret) ret &= buffer.get(min); |
---|
| 279 | if (ret) ret &= buffer.get(sec); |
---|
| 280 | if (ret) |
---|
| 281 | { |
---|
| 282 | ptrValue->setYear(year); |
---|
| 283 | ptrValue->setMonth(month); |
---|
| 284 | ptrValue->setDay(day); |
---|
| 285 | ptrValue->setHour(hour); |
---|
| 286 | ptrValue->setMinute(min); |
---|
| 287 | ptrValue->setSecond(sec); |
---|
| 288 | } |
---|
| 289 | |
---|
| 290 | return ret; |
---|
| 291 | } |
---|
| 292 | |
---|
[537] | 293 | // template specializations for CDuration |
---|
| 294 | |
---|
| 295 | template <> |
---|
| 296 | size_t CType<CDuration>::_size() const |
---|
| 297 | { |
---|
| 298 | return 7 * sizeof(double); |
---|
| 299 | } |
---|
| 300 | |
---|
| 301 | template <> |
---|
| 302 | size_t CType_ref<CDuration>::_size() const |
---|
| 303 | { |
---|
| 304 | return 7 * sizeof(double); |
---|
| 305 | } |
---|
| 306 | |
---|
| 307 | template <> |
---|
| 308 | bool CType<CDuration>::_toBuffer(CBufferOut& buffer) const |
---|
| 309 | { |
---|
| 310 | if (buffer.remain() < size()) return false; |
---|
| 311 | else |
---|
| 312 | { |
---|
| 313 | bool ret = true; |
---|
| 314 | if (ret) ret &= buffer.put(ptrValue->year); |
---|
| 315 | if (ret) ret &= buffer.put(ptrValue->month); |
---|
| 316 | if (ret) ret &= buffer.put(ptrValue->day); |
---|
| 317 | if (ret) ret &= buffer.put(ptrValue->hour); |
---|
| 318 | if (ret) ret &= buffer.put(ptrValue->minute); |
---|
| 319 | if (ret) ret &= buffer.put(ptrValue->second); |
---|
| 320 | if (ret) ret &= buffer.put(ptrValue->timestep); |
---|
| 321 | return ret; |
---|
| 322 | } |
---|
| 323 | } |
---|
| 324 | |
---|
| 325 | template <> |
---|
| 326 | bool CType_ref<CDuration>::_toBuffer(CBufferOut& buffer) const |
---|
| 327 | { |
---|
| 328 | if (buffer.remain() < size()) return false; |
---|
| 329 | else |
---|
| 330 | { |
---|
| 331 | bool ret = true; |
---|
| 332 | if (ret) ret &= buffer.put(ptrValue->year); |
---|
| 333 | if (ret) ret &= buffer.put(ptrValue->month); |
---|
| 334 | if (ret) ret &= buffer.put(ptrValue->day); |
---|
| 335 | if (ret) ret &= buffer.put(ptrValue->hour); |
---|
| 336 | if (ret) ret &= buffer.put(ptrValue->minute); |
---|
| 337 | if (ret) ret &= buffer.put(ptrValue->second); |
---|
| 338 | if (ret) ret &= buffer.put(ptrValue->timestep); |
---|
| 339 | return ret; |
---|
| 340 | } |
---|
| 341 | } |
---|
| 342 | |
---|
| 343 | template <> |
---|
| 344 | bool CType<CDuration>::_fromBuffer(CBufferIn& buffer) |
---|
| 345 | { |
---|
| 346 | allocate(); |
---|
| 347 | bool ret = true; |
---|
| 348 | |
---|
| 349 | if (ret) ret &= buffer.get(ptrValue->year); |
---|
| 350 | if (ret) ret &= buffer.get(ptrValue->month); |
---|
| 351 | if (ret) ret &= buffer.get(ptrValue->day); |
---|
| 352 | if (ret) ret &= buffer.get(ptrValue->hour); |
---|
| 353 | if (ret) ret &= buffer.get(ptrValue->minute); |
---|
| 354 | if (ret) ret &= buffer.get(ptrValue->second); |
---|
| 355 | if (ret) ret &= buffer.get(ptrValue->timestep); |
---|
| 356 | |
---|
| 357 | return ret; |
---|
| 358 | } |
---|
| 359 | |
---|
| 360 | template <> |
---|
| 361 | bool CType_ref<CDuration>::_fromBuffer(CBufferIn& buffer) const |
---|
| 362 | { |
---|
| 363 | bool ret = true; |
---|
| 364 | |
---|
| 365 | if (ret) ret &= buffer.get(ptrValue->year); |
---|
| 366 | if (ret) ret &= buffer.get(ptrValue->month); |
---|
| 367 | if (ret) ret &= buffer.get(ptrValue->day); |
---|
| 368 | if (ret) ret &= buffer.get(ptrValue->hour); |
---|
| 369 | if (ret) ret &= buffer.get(ptrValue->minute); |
---|
| 370 | if (ret) ret &= buffer.get(ptrValue->second); |
---|
| 371 | if (ret) ret &= buffer.get(ptrValue->timestep); |
---|
| 372 | |
---|
| 373 | return ret; |
---|
| 374 | } |
---|
| 375 | |
---|
| 376 | template <> |
---|
| 377 | bool CType_ref<CDuration>::_fromBuffer(CBufferIn& buffer) |
---|
| 378 | { |
---|
| 379 | bool ret = true; |
---|
| 380 | |
---|
| 381 | if (ret) ret &= buffer.get(ptrValue->year); |
---|
| 382 | if (ret) ret &= buffer.get(ptrValue->month); |
---|
| 383 | if (ret) ret &= buffer.get(ptrValue->day); |
---|
| 384 | if (ret) ret &= buffer.get(ptrValue->hour); |
---|
| 385 | if (ret) ret &= buffer.get(ptrValue->minute); |
---|
| 386 | if (ret) ret &= buffer.get(ptrValue->second); |
---|
| 387 | if (ret) ret &= buffer.get(ptrValue->timestep); |
---|
| 388 | |
---|
| 389 | return ret; |
---|
| 390 | } |
---|
| 391 | |
---|
[308] | 392 | // template specialisation for CArray |
---|
| 393 | /* |
---|
| 394 | template<> |
---|
| 395 | size_t CType< ARRAY(int, 1)>::size() const |
---|
| 396 | { |
---|
| 397 | return (*(this->ptrValue))->getSize() ; |
---|
| 398 | } |
---|
| 399 | |
---|
| 400 | template <> |
---|
| 401 | bool CType<ARRAY(int, 1)>::toBuffer(CBufferOut& buffer) const |
---|
| 402 | { |
---|
| 403 | return (*(this->ptrValue))->toBuffer(buffer) ; |
---|
| 404 | } |
---|
| 405 | |
---|
| 406 | template <> |
---|
| 407 | bool CType<ARRAY(int, 1)>::fromBuffer(CBufferIn& buffer) const |
---|
| 408 | { |
---|
| 409 | return (*(this->ptrValue))->fromBuffer(buffer) ; |
---|
| 410 | } |
---|
| 411 | |
---|
| 412 | template <> |
---|
| 413 | void CType<ARRAY(int, 1)>::fromString(const string& str) const |
---|
| 414 | { |
---|
| 415 | // to implement |
---|
| 416 | } |
---|
| 417 | |
---|
| 418 | template <> |
---|
| 419 | string CType<ARRAY(int, 1)>::toString(void) const |
---|
| 420 | { |
---|
| 421 | // to implement |
---|
| 422 | return string("") ; |
---|
| 423 | |
---|
| 424 | } |
---|
| 425 | */ |
---|
| 426 | |
---|
| 427 | |
---|
| 428 | /* |
---|
| 429 | template<size_t numDim> |
---|
| 430 | boost::detail::multi_array::extent_gen<numDim> getExtentNull(void) { return getExtentNull<numDim-1>()[0];} |
---|
| 431 | |
---|
| 432 | template<> |
---|
| 433 | boost::detail::multi_array::extent_gen<1> getExtentNull<1>(void) { return extents[0]; } |
---|
| 434 | */ |
---|
[369] | 435 | /* |
---|
[354] | 436 | #define CTYPE_ARRAY(ValueType,NumsDims) \ |
---|
[369] | 437 | \ |
---|
| 438 | template <> \ |
---|
| 439 | void CType<ARRAY(ValueType,NumsDims)>::allocate(void) \ |
---|
| 440 | { \ |
---|
| 441 | if (empty) ptrValue=new shared_ptr<CArray<ValueType, NumsDims> >(new CArray<ValueType, NumsDims>()) ;\ |
---|
| 442 | empty=false ; \ |
---|
| 443 | } \ |
---|
| 444 | \ |
---|
[308] | 445 | template<> \ |
---|
[369] | 446 | size_t CType< ARRAY(ValueType,NumsDims)>::_size() const \ |
---|
[308] | 447 | { \ |
---|
| 448 | return (*(this->ptrValue))->getSize() ; \ |
---|
| 449 | } \ |
---|
| 450 | \ |
---|
[369] | 451 | template<> \ |
---|
| 452 | size_t CType_ref< ARRAY(ValueType,NumsDims)>::_size() const \ |
---|
| 453 | { \ |
---|
| 454 | return (*(this->ptrValue))->getSize() ; \ |
---|
| 455 | } \ |
---|
| 456 | \ |
---|
[308] | 457 | template <> \ |
---|
[369] | 458 | bool CType<ARRAY(ValueType,NumsDims)>::_toBuffer(CBufferOut& buffer) const \ |
---|
[308] | 459 | { \ |
---|
| 460 | return (*(this->ptrValue))->toBuffer(buffer) ; \ |
---|
| 461 | } \ |
---|
| 462 | \ |
---|
| 463 | template <> \ |
---|
[369] | 464 | bool CType_ref<ARRAY(ValueType,NumsDims)>::_toBuffer(CBufferOut& buffer) const \ |
---|
[308] | 465 | { \ |
---|
[369] | 466 | return (*(this->ptrValue))->toBuffer(buffer) ; \ |
---|
| 467 | } \ |
---|
| 468 | \ |
---|
| 469 | template <> \ |
---|
| 470 | bool CType<ARRAY(ValueType,NumsDims)>::_fromBuffer(CBufferIn& buffer) \ |
---|
| 471 | { \ |
---|
| 472 | allocate(); \ |
---|
| 473 | return (*(ptrValue))->fromBuffer(buffer) ; \ |
---|
| 474 | } \ |
---|
| 475 | \ |
---|
| 476 | template <> \ |
---|
| 477 | bool CType_ref<ARRAY(ValueType,NumsDims)>::_fromBuffer(CBufferIn& buffer) const \ |
---|
| 478 | { \ |
---|
| 479 | checkEmpty() ; \ |
---|
| 480 | return (*(this->ptrValue))->fromBuffer(buffer) ; \ |
---|
| 481 | } \ |
---|
| 482 | \ |
---|
| 483 | template <> \ |
---|
| 484 | bool CType_ref<ARRAY(ValueType,NumsDims)>::_fromBuffer(CBufferIn& buffer) \ |
---|
| 485 | { \ |
---|
[308] | 486 | shared_ptr<CArray<ValueType, NumsDims> > tmp(new CArray<ValueType, NumsDims>() ) ; \ |
---|
| 487 | *(this->ptrValue)=tmp ;\ |
---|
| 488 | return (*(this->ptrValue))->fromBuffer(buffer) ; \ |
---|
| 489 | } \ |
---|
| 490 | \ |
---|
[369] | 491 | \ |
---|
[308] | 492 | template <> \ |
---|
[369] | 493 | void CType<ARRAY(ValueType,NumsDims)>::_fromString(const string& str) \ |
---|
[308] | 494 | { \ |
---|
[369] | 495 | \ |
---|
[308] | 496 | } \ |
---|
| 497 | \ |
---|
| 498 | template <> \ |
---|
[369] | 499 | void CType_ref<ARRAY(ValueType,NumsDims)>::_fromString(const string& str) const \ |
---|
[308] | 500 | { \ |
---|
[369] | 501 | \ |
---|
| 502 | } \ |
---|
| 503 | template <> \ |
---|
| 504 | void CType_ref<ARRAY(ValueType,NumsDims)>::_fromString(const string& str) \ |
---|
| 505 | { \ |
---|
| 506 | \ |
---|
| 507 | } \ |
---|
| 508 | \ |
---|
| 509 | template <> \ |
---|
| 510 | string CType<ARRAY(ValueType,NumsDims)>::_toString(void) const \ |
---|
| 511 | { \ |
---|
| 512 | \ |
---|
[308] | 513 | return string("") ; \ |
---|
[369] | 514 | } \ |
---|
| 515 | \ |
---|
| 516 | template <> \ |
---|
| 517 | string CType_ref<ARRAY(ValueType,NumsDims)>::_toString(void) const \ |
---|
| 518 | { \ |
---|
| 519 | \ |
---|
| 520 | return string("") ; \ |
---|
[308] | 521 | } |
---|
| 522 | //CTYPE_ARRAY(double,1) |
---|
| 523 | |
---|
| 524 | //CTYPE_ARRAY(double,2) |
---|
| 525 | |
---|
| 526 | |
---|
| 527 | CTYPE_ARRAY(int,1) |
---|
| 528 | CTYPE_ARRAY(int,2) |
---|
| 529 | CTYPE_ARRAY(int,3) |
---|
| 530 | CTYPE_ARRAY(bool,1) |
---|
| 531 | CTYPE_ARRAY(bool,2) |
---|
| 532 | CTYPE_ARRAY(bool,3) |
---|
| 533 | CTYPE_ARRAY(double,1) |
---|
| 534 | CTYPE_ARRAY(double,2) |
---|
| 535 | CTYPE_ARRAY(double,3) |
---|
| 536 | CTYPE_ARRAY(float,1) |
---|
| 537 | CTYPE_ARRAY(float,2) |
---|
| 538 | CTYPE_ARRAY(float,3) |
---|
[369] | 539 | */ |
---|
[308] | 540 | } |
---|
| 541 | |
---|
| 542 | #endif |
---|