FieldData.h 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131
  1. #pragma once
  2. #include "ThirdPartyHeadersBegin.h"
  3. #include <boost/shared_ptr.hpp>
  4. #include "ThirdPartyHeadersEnd.h"
  5. #include "AltTecUtil.h"
  6. namespace tecplot
  7. {
  8. namespace ___3933
  9. {
  10. typedef boost::shared_ptr<class ___1352> FieldDataPtr;
  11. class ___1352
  12. {
  13. public:
  14. ___1352(___37 *tecUtil, ___1172 zone, ___1172 ___4336, bool writable = false, bool ___964 = false);
  15. ___1352() : m_tecUtil(0), m_fieldData(0), m_rawDataPtr(0), m_getFieldValue(0), m_setFieldValue(0), ___2459(___1369), ___2669(___4329), ___2668(0), m_allocated(false) {}
  16. ~___1352()
  17. {
  18. if (m_allocated)
  19. free(m_rawDataPtr);
  20. }
  21. void allocate(FieldDataType_e ___1363, ValueLocation_e ___4326, ___2227 ___4325);
  22. bool ___2067() const { return (VALID_REF(m_tecUtil) && ___2668 > 0 && (m_fieldData != NULL || m_rawDataPtr != NULL) && VALID_ENUM(___2459, FieldDataType_e)); }
  23. double ___1780(___2227 index) const;
  24. ValueLocation_e ___1786() const { return ___2669; }
  25. FieldDataType_e getValueType() const { return ___2459; }
  26. ___2227 ___1783() const { return ___2668; }
  27. void ___3504(___2227 index, double ___4314);
  28. void ___1759(double *minVal, double *maxVal) const;
  29. void *getRawPointer() const
  30. {
  31. ENSURE(VALID_REF_OR_NULL(m_rawDataPtr));
  32. return m_rawDataPtr;
  33. }
  34. private:
  35. ___1352 RawValuePtrGetReadableOrWritablePtr(___1172 zone, ___1172 ___4336, ___372 getWritable, ___372 getDerived);
  36. ___37 *m_tecUtil;
  37. ___1361 m_fieldData;
  38. void *m_rawDataPtr;
  39. ___1383 m_getFieldValue;
  40. ___1384 m_setFieldValue;
  41. FieldDataType_e ___2459;
  42. ValueLocation_e ___2669;
  43. ___2227 ___2668;
  44. bool m_allocated;
  45. };
  46. inline double ___1352::___1780(___2227 index) const
  47. {
  48. REQUIRE(0 < index && index <= ___2668);
  49. double ___4314;
  50. ___478(VALID_REF_OR_NULL(m_rawDataPtr));
  51. if (m_rawDataPtr != NULL)
  52. {
  53. switch (___2459)
  54. {
  55. case FieldDataType_Float:
  56. ___4314 = (double)(((float *)m_rawDataPtr)[index - 1]);
  57. break;
  58. case FieldDataType_Double:
  59. ___4314 = ((double *)m_rawDataPtr)[index - 1];
  60. break;
  61. case FieldDataType_Int32:
  62. ___4314 = (double)(((int32_t *)m_rawDataPtr)[index - 1]);
  63. break;
  64. case FieldDataType_Int16:
  65. ___4314 = (double)(((int16_t *)m_rawDataPtr)[index - 1]);
  66. break;
  67. case FieldDataType_Byte:
  68. ___4314 = (double)(((uint8_t *)m_rawDataPtr)[index - 1]);
  69. break;
  70. case ___1365:
  71. ___4314 = (double)((((uint8_t *)m_rawDataPtr)[(index - 1) / 8] >> ((index - 1) % 8)) & (uint8_t)0x1);
  72. break;
  73. default:
  74. ___478(___1305);
  75. ___4314 = 0.0;
  76. break;
  77. }
  78. }
  79. else
  80. {
  81. ___478(VALID_FN_REF(m_getFieldValue));
  82. ___4314 = m_getFieldValue(m_fieldData, index - 1);
  83. }
  84. return ___4314;
  85. }
  86. inline void ___1352::___3504(___2227 index, double ___4314)
  87. {
  88. REQUIRE(0 < index && index <= ___2668);
  89. ___478(VALID_REF_OR_NULL(m_rawDataPtr));
  90. if (m_rawDataPtr != NULL)
  91. {
  92. switch (___2459)
  93. {
  94. case FieldDataType_Float:
  95. ((float *)(m_rawDataPtr))[index - 1] = ___650(___4314);
  96. break;
  97. case FieldDataType_Double:
  98. ((double *)(m_rawDataPtr))[index - 1] = ___489(___4314);
  99. break;
  100. case FieldDataType_Int32:
  101. ((___2227 *)(m_rawDataPtr))[index - 1] = ___652(___4314);
  102. break;
  103. case FieldDataType_Int16:
  104. ((short *)(m_rawDataPtr))[index - 1] = ___651(___4314);
  105. break;
  106. case FieldDataType_Byte:
  107. ((uint8_t *)(m_rawDataPtr))[index - 1] = CONVERT_DOUBLE_TO_UINT8(___4314);
  108. break;
  109. case ___1365:
  110. {
  111. ___2227 byteOffset = (index - 1) / 8;
  112. uint8_t bitMask = (uint8_t)(01 << ((index - 1) % 8));
  113. if (___4314 < 1.0)
  114. ((uint8_t *)(m_rawDataPtr))[byteOffset] &= ~bitMask;
  115. else
  116. ((uint8_t *)(m_rawDataPtr))[byteOffset] |= bitMask;
  117. }
  118. break;
  119. default:
  120. ___478(___1305);
  121. }
  122. }
  123. else
  124. {
  125. ___478(VALID_FN_REF(m_setFieldValue));
  126. m_setFieldValue(m_fieldData, index - 1, (double)(___4314));
  127. }
  128. }
  129. }
  130. }