Showing the changes to Source/Libraries/TimeSeriesPlatformLibrary/Data/DataRow.cpp (1 of 4 files). Show all
Unified · Split
| @@ -23,27 +23,21 @@ · 22 unmodified lines | ||
| 23 | 23 | |
| 24 | 24 | #include "DataRow.h" |
| 25 | 25 | #include "DataTable.h" |
| 26 | +#include "DataSet.h" | |
| 26 | 27 | |
| 27 | 28 | using namespace std; |
| 28 | 29 | using namespace GSF::TimeSeries; |
| 29 | 30 | using namespace GSF::Data; |
| 30 | 31 | |
| 31 | −DataRowException::DataRowException(string message) noexcept : | |
| 32 | − m_message(move(message)) | |
| 33 | −{ | |
| 34 | −} | |
| 35 | − | |
| 36 | −const char* DataRowException::what() const noexcept | |
| 37 | −{ | |
| 38 | − return m_message.c_str(); | |
| 39 | −} | |
| 40 | − | |
| 41 | 32 | const DataRowPtr DataRow::NullPtr = nullptr; |
| 42 | 33 | |
| 43 | 34 | DataRow::DataRow(DataTablePtr parent) : |
| 44 | 35 | m_parent(std::move(parent)), |
| 45 | 36 | m_values(m_parent->ColumnCount()) |
| 46 | 37 | { |
| 38 | + if (m_parent == nullptr) | |
| 39 | + throw DataSetException("DataTable parent is null"); | |
| 40 | + | |
| 47 | 41 | for (uint32_t i = 0; i < m_values.size(); i++) |
| 48 | 42 | m_values[i] = nullptr; |
| 49 | 43 | } |
| @@ -57,24 +51,39 @@ DataRow::~DataRow() · 7 unmodified lines | ||
| 57 | 51 | } |
| 58 | 52 | } |
| 59 | 53 | |
| 60 | −void DataRow::ValidateColumnType(int32_t index, DataType targetType, bool read) const | |
| 54 | +int32_t DataRow::GetColumnIndex(const string& columnName) const | |
| 61 | 55 | { |
| 62 | − const DataType columnType = m_parent->Column(index)->Type(); | |
| 56 | + const DataColumnPtr column = m_parent->Column(columnName); | |
| 57 | + | |
| 58 | + if (column == nullptr) | |
| 59 | + throw DataSetException("Column name \"" + columnName + "\" was not found in table \"" + m_parent->Name() + "\""); | |
| 60 | + | |
| 61 | + return column->Index(); | |
| 62 | +} | |
| 63 | + | |
| 64 | +void DataRow::ValidateColumnType(int32_t columnIndex, DataType targetType, bool read) const | |
| 65 | +{ | |
| 66 | + const DataColumnPtr column = m_parent->Column(columnIndex); | |
| 67 | + | |
| 68 | + if (column == nullptr) | |
| 69 | + throw DataSetException("Column index " + ToString(columnIndex) + " is out of range for table \"" + m_parent->Name() + "\""); | |
| 70 | + | |
| 71 | + const DataType columnType = column->Type(); | |
| 63 | 72 | |
| 64 | 73 | if (columnType != targetType) |
| 65 | 74 | { |
| 66 | 75 | stringstream errorMessageStream; |
| 67 | − errorMessageStream << "Cannot" << (read ? " read " : " assign ") << EnumName(targetType) << " value" << (read ? " from " : " to ") << "DataColumn " << index << ", column data type is " << EnumName(columnType); | |
| 68 | − throw DataRowException(errorMessageStream.str()); | |
| 76 | + errorMessageStream << "Cannot" << (read ? " read " : " assign ") << "\"" << EnumName(targetType) << "\" value" << (read ? " from " : " to ") << "DataColumn " << columnIndex << ", column data type is \"" << EnumName(columnType) << "\""; | |
| 77 | + throw DataSetException(errorMessageStream.str()); | |
| 69 | 78 | } |
| 70 | 79 | } |
| 71 | 80 | |
| 72 | 81 | template<typename T> |
| 73 | −Nullable<T> DataRow::GetValue(int32_t index, DataType targetType) const | |
| 82 | +Nullable<T> DataRow::GetValue(int32_t columnIndex, DataType targetType) const | |
| 74 | 83 | { |
| 75 | − ValidateColumnType(index, targetType, true); | |
| 84 | + ValidateColumnType(columnIndex, targetType, true); | |
| 76 | 85 | |
| 77 | − T* value = static_cast<T*>(m_values[index]); | |
| 86 | + T* value = static_cast<T*>(m_values[columnIndex]); | |
| 78 | 87 | |
| 79 | 88 | if (value) |
| 80 | 89 | return *value; |
| @@ -83,19 +92,19 @@ Nullable<T> DataRow::GetValue(int32_t index, DataType targetType) const · 2 unmodified lines | ||
| 83 | 92 | } |
| 84 | 93 | |
| 85 | 94 | template<typename T> |
| 86 | −void DataRow::SetValue(int32_t index, const Nullable<T>& value, DataType targetType) | |
| 95 | +void DataRow::SetValue(int32_t columnIndex, const Nullable<T>& value, DataType targetType) | |
| 87 | 96 | { |
| 88 | − ValidateColumnType(index, targetType); | |
| 97 | + ValidateColumnType(columnIndex, targetType); | |
| 89 | 98 | |
| 90 | 99 | if (value.HasValue()) |
| 91 | 100 | { |
| 92 | 101 | uint8_t* copy = static_cast<uint8_t*>(malloc(sizeof(T))); |
| 93 | 102 | memcpy(copy, &value.Value, sizeof(T)); |
| 94 | − m_values[index] = copy; | |
| 103 | + m_values[columnIndex] = copy; | |
| 95 | 104 | } |
| 96 | 105 | else |
| 97 | 106 | { |
| 98 | − m_values[index] = nullptr; | |
| 107 | + m_values[columnIndex] = nullptr; | |
| 99 | 108 | } |
| 100 | 109 | } |
| 101 | 110 | |
| @@ -104,11 +113,75 @@ const DataTablePtr& DataRow::Parent() const · 2 unmodified lines | ||
| 104 | 113 | return m_parent; |
| 105 | 114 | } |
| 106 | 115 | |
| 107 | −Nullable<string> DataRow::ValueAsString(int32_t index) const | |
| 116 | +void DataRow::SetNullValue(int32_t columnIndex) | |
| 108 | 117 | { |
| 109 | − ValidateColumnType(index, DataType::String, true); | |
| 118 | + const DataColumnPtr column = m_parent->Column(columnIndex); | |
| 110 | 119 | |
| 111 | − const char* value = static_cast<const char*>(m_values[index]); | |
| 120 | + if (column == nullptr) | |
| 121 | + throw DataSetException("Column index " + ToString(columnIndex) + " is out of range for table \"" + m_parent->Name() + "\""); | |
| 122 | + | |
| 123 | + switch (column->Type()) | |
| 124 | + { | |
| 125 | + case DataType::String: | |
| 126 | + SetStringValue(columnIndex, nullptr); | |
| 127 | + break; | |
| 128 | + case DataType::Boolean: | |
| 129 | + SetBooleanValue(columnIndex, nullptr); | |
| 130 | + break; | |
| 131 | + case DataType::DateTime: | |
| 132 | + SetDateTimeValue(columnIndex, nullptr); | |
| 133 | + break; | |
| 134 | + case DataType::Single: | |
| 135 | + SetSingleValue(columnIndex, nullptr); | |
| 136 | + break; | |
| 137 | + case DataType::Double: | |
| 138 | + SetDoubleValue(columnIndex, nullptr); | |
| 139 | + break; | |
| 140 | + case DataType::Decimal: | |
| 141 | + SetDecimalValue(columnIndex, nullptr); | |
| 142 | + break; | |
| 143 | + case DataType::Guid: | |
| 144 | + SetGuidValue(columnIndex, nullptr); | |
| 145 | + break; | |
| 146 | + case DataType::Int8: | |
| 147 | + SetInt8Value(columnIndex, nullptr); | |
| 148 | + break; | |
| 149 | + case DataType::Int16: | |
| 150 | + SetInt16Value(columnIndex, nullptr); | |
| 151 | + break; | |
| 152 | + case DataType::Int32: | |
| 153 | + SetInt32Value(columnIndex, nullptr); | |
| 154 | + break; | |
| 155 | + case DataType::Int64: | |
| 156 | + SetInt64Value(columnIndex, nullptr); | |
| 157 | + break; | |
| 158 | + case DataType::UInt8: | |
| 159 | + SetUInt8Value(columnIndex, nullptr); | |
| 160 | + break; | |
| 161 | + case DataType::UInt16: | |
| 162 | + SetUInt16Value(columnIndex, nullptr); | |
| 163 | + break; | |
| 164 | + case DataType::UInt32: | |
| 165 | + SetUInt32Value(columnIndex, nullptr); | |
| 166 | + break; | |
| 167 | + case DataType::UInt64: | |
| 168 | + SetUInt64Value(columnIndex, nullptr); | |
| 169 | + break; | |
| 170 | + default: | |
| 171 | + throw DataSetException("Unexpected column data type encountered"); | |
| 172 | + } | |
| 173 | +} | |
| 174 | + | |
| 175 | +void DataRow::SetNullValue(const string& columnName) | |
| 176 | +{ | |
| 177 | + SetNullValue(GetColumnIndex(columnName)); | |
| 178 | +} | |
| 179 | + | |
| 180 | +Nullable<string> DataRow::ValueAsString(int32_t columnIndex) const | |
| 181 | +{ | |
| 182 | + ValidateColumnType(columnIndex, DataType::String, true); | |
| 183 | + | |
| 184 | + const char* value = static_cast<const char*>(m_values[columnIndex]); | |
| 112 | 185 | |
| 113 | 186 | if (value) |
| 114 | 187 | return string(value); |
| @@ -116,9 +189,14 @@ Nullable<string> DataRow::ValueAsString(int32_t index) const · 1 unmodified line | ||
| 116 | 189 | return nullptr; |
| 117 | 190 | } |
| 118 | 191 | |
| 119 | −void DataRow::SetStringValue(int32_t index, const Nullable<string>& value) | |
| 192 | +Nullable<string> DataRow::ValueAsString(const string& columnName) const | |
| 120 | 193 | { |
| 121 | − ValidateColumnType(index, DataType::String); | |
| 194 | + return ValueAsString(GetColumnIndex(columnName)); | |
| 195 | +} | |
| 196 | + | |
| 197 | +void DataRow::SetStringValue(int32_t columnIndex, const Nullable<string>& value) | |
| 198 | +{ | |
| 199 | + ValidateColumnType(columnIndex, DataType::String); | |
| 122 | 200 | |
| 123 | 201 | if (value.HasValue()) |
| 124 | 202 | { |
| @@ -126,19 +204,24 @@ void DataRow::SetStringValue(int32_t index, const Nullable<string>& value) · 1 unmodified line | ||
| 126 | 204 | const int32_t length = strval.size() + 1; |
| 127 | 205 | char* copy = static_cast<char*>(malloc(length * sizeof(char))); |
| 128 | 206 | strcpy_s(copy, length, strval.c_str()); |
| 129 | − m_values[index] = copy; | |
| 207 | + m_values[columnIndex] = copy; | |
| 130 | 208 | } |
| 131 | 209 | else |
| 132 | 210 | { |
| 133 | − m_values[index] = nullptr; | |
| 211 | + m_values[columnIndex] = nullptr; | |
| 134 | 212 | } |
| 135 | 213 | } |
| 136 | 214 | |
| 137 | −Nullable<bool> DataRow::ValueAsBoolean(int32_t index) const | |
| 215 | +void DataRow::SetStringValue(const string& columnName, const Nullable<string>& value) | |
| 138 | 216 | { |
| 139 | − ValidateColumnType(index, DataType::Boolean, true); | |
| 217 | + SetStringValue(GetColumnIndex(columnName), value); | |
| 218 | +} | |
| 140 | 219 | |
| 141 | − uint8_t* value = static_cast<uint8_t*>(m_values[index]); | |
| 220 | +Nullable<bool> DataRow::ValueAsBoolean(int32_t columnIndex) const | |
| 221 | +{ | |
| 222 | + ValidateColumnType(columnIndex, DataType::Boolean, true); | |
| 223 | + | |
| 224 | + uint8_t* value = static_cast<uint8_t*>(m_values[columnIndex]); | |
| 142 | 225 | |
| 143 | 226 | if (value) |
| 144 | 227 | return *value != 0; |
| @@ -146,57 +229,97 @@ Nullable<bool> DataRow::ValueAsBoolean(int32_t index) const · 1 unmodified line | ||
| 146 | 229 | return nullptr; |
| 147 | 230 | } |
| 148 | 231 | |
| 149 | −void DataRow::SetBooleanValue(int32_t index, const Nullable<bool>& value) | |
| 232 | +Nullable<bool> DataRow::ValueAsBoolean(const string& columnName) const | |
| 233 | +{ | |
| 234 | + return ValueAsBoolean(GetColumnIndex(columnName)); | |
| 235 | +} | |
| 236 | + | |
| 237 | +void DataRow::SetBooleanValue(int32_t columnIndex, const Nullable<bool>& value) | |
| 150 | 238 | { |
| 151 | − ValidateColumnType(index, DataType::Boolean); | |
| 239 | + ValidateColumnType(columnIndex, DataType::Boolean); | |
| 152 | 240 | |
| 153 | 241 | if (value.HasValue()) |
| 154 | 242 | { |
| 155 | 243 | uint8_t* copy = static_cast<uint8_t*>(malloc(1)); |
| 156 | 244 | *copy = value.GetValueOrDefault() ? 1 : 0; |
| 157 | − m_values[index] = copy; | |
| 245 | + m_values[columnIndex] = copy; | |
| 158 | 246 | } |
| 159 | 247 | else |
| 160 | 248 | { |
| 161 | − m_values[index] = nullptr; | |
| 249 | + m_values[columnIndex] = nullptr; | |
| 162 | 250 | } |
| 163 | 251 | } |
| 164 | 252 | |
| 165 | −Nullable<time_t> DataRow::ValueAsDateTime(int32_t index) const | |
| 253 | +void DataRow::SetBooleanValue(const string& columnName, const Nullable<bool>& value) | |
| 254 | +{ | |
| 255 | + SetBooleanValue(GetColumnIndex(columnName), value); | |
| 256 | +} | |
| 257 | + | |
| 258 | +Nullable<time_t> DataRow::ValueAsDateTime(int32_t columnIndex) const | |
| 259 | +{ | |
| 260 | + return GetValue<time_t>(columnIndex, DataType::DateTime); | |
| 261 | +} | |
| 262 | + | |
| 263 | +Nullable<time_t> DataRow::ValueAsDateTime(const string& columnName) const | |
| 264 | +{ | |
| 265 | + return ValueAsDateTime(GetColumnIndex(columnName)); | |
| 266 | +} | |
| 267 | + | |
| 268 | +void DataRow::SetDateTimeValue(int32_t columnIndex, const Nullable<time_t>& value) | |
| 269 | +{ | |
| 270 | + SetValue<time_t>(columnIndex, value, DataType::DateTime); | |
| 271 | +} | |
| 272 | + | |
| 273 | +void DataRow::SetDateTimeValue(const string& columnName, const Nullable<time_t>& value) | |
| 274 | +{ | |
| 275 | + SetDateTimeValue(GetColumnIndex(columnName), value); | |
| 276 | +} | |
| 277 | + | |
| 278 | +Nullable<float32_t> DataRow::ValueAsSingle(int32_t columnIndex) const | |
| 279 | +{ | |
| 280 | + return GetValue<float32_t>(columnIndex, DataType::Single); | |
| 281 | +} | |
| 282 | + | |
| 283 | +Nullable<float32_t> DataRow::ValueAsSingle(const string& columnName) const | |
| 284 | +{ | |
| 285 | + return ValueAsSingle(GetColumnIndex(columnName)); | |
| 286 | +} | |
| 287 | + | |
| 288 | +void DataRow::SetSingleValue(int32_t columnIndex, const Nullable<float32_t>& value) | |
| 166 | 289 | { |
| 167 | − return GetValue<time_t>(index, DataType::DateTime); | |
| 290 | + SetValue<float32_t>(columnIndex, value, DataType::Single); | |
| 168 | 291 | } |
| 169 | 292 | |
| 170 | −void DataRow::SetDateTimeValue(int32_t index, const Nullable<time_t>& value) | |
| 293 | +void DataRow::SetSingleValue(const string& columnName, const Nullable<float32_t>& value) | |
| 171 | 294 | { |
| 172 | − SetValue<time_t>(index, value, DataType::DateTime); | |
| 295 | + SetSingleValue(GetColumnIndex(columnName), value); | |
| 173 | 296 | } |
| 174 | 297 | |
| 175 | −Nullable<float32_t> DataRow::ValueAsSingle(int32_t index) const | |
| 298 | +Nullable<float64_t> DataRow::ValueAsDouble(int32_t columnIndex) const | |
| 176 | 299 | { |
| 177 | − return GetValue<float32_t>(index, DataType::Single); | |
| 300 | + return GetValue<float64_t>(columnIndex, DataType::Double); | |
| 178 | 301 | } |
| 179 | 302 | |
| 180 | −void DataRow::SetSingleValue(int32_t index, const Nullable<float32_t>& value) | |
| 303 | +Nullable<float64_t> DataRow::ValueAsDouble(const string& columnName) const | |
| 181 | 304 | { |
| 182 | − SetValue<float32_t>(index, value, DataType::Single); | |
| 305 | + return ValueAsDouble(GetColumnIndex(columnName)); | |
| 183 | 306 | } |
| 184 | 307 | |
| 185 | −Nullable<float64_t> DataRow::ValueAsDouble(int32_t index) const | |
| 308 | +void DataRow::SetDoubleValue(int32_t columnIndex, const Nullable<float64_t>& value) | |
| 186 | 309 | { |
| 187 | − return GetValue<float64_t>(index, DataType::Double); | |
| 310 | + SetValue<float64_t>(columnIndex, value, DataType::Double); | |
| 188 | 311 | } |
| 189 | 312 | |
| 190 | −void DataRow::SetDoubleValue(int32_t index, const Nullable<float64_t>& value) | |
| 313 | +void DataRow::SetDoubleValue(const string& columnName, const Nullable<float64_t>& value) | |
| 191 | 314 | { |
| 192 | − SetValue<float64_t>(index, value, DataType::Double); | |
| 315 | + SetDoubleValue(GetColumnIndex(columnName), value); | |
| 193 | 316 | } |
| 194 | 317 | |
| 195 | −Nullable<decimal_t> DataRow::ValueAsDecimal(int32_t index) const | |
| 318 | +Nullable<decimal_t> DataRow::ValueAsDecimal(int32_t columnIndex) const | |
| 196 | 319 | { |
| 197 | − ValidateColumnType(index, DataType::Decimal, true); | |
| 320 | + ValidateColumnType(columnIndex, DataType::Decimal, true); | |
| 198 | 321 | |
| 199 | − const char* value = static_cast<const char*>(m_values[index]); | |
| 322 | + const char* value = static_cast<const char*>(m_values[columnIndex]); | |
| 200 | 323 | |
| 201 | 324 | if (value) |
| 202 | 325 | return decimal_t(value); |
| @@ -204,9 +327,14 @@ Nullable<decimal_t> DataRow::ValueAsDecimal(int32_t index) const · 1 unmodified line | ||
| 204 | 327 | return nullptr; |
| 205 | 328 | } |
| 206 | 329 | |
| 207 | −void DataRow::SetDecimalValue(int32_t index, const Nullable<decimal_t>& value) | |
| 330 | +Nullable<decimal_t> DataRow::ValueAsDecimal(const string& columnName) const | |
| 331 | +{ | |
| 332 | + return ValueAsDecimal(GetColumnIndex(columnName)); | |
| 333 | +} | |
| 334 | + | |
| 335 | +void DataRow::SetDecimalValue(int32_t columnIndex, const Nullable<decimal_t>& value) | |
| 208 | 336 | { |
| 209 | − ValidateColumnType(index, DataType::Decimal); | |
| 337 | + ValidateColumnType(columnIndex, DataType::Decimal); | |
| 210 | 338 | |
| 211 | 339 | if (value.HasValue()) |
| 212 | 340 | { |
| @@ -216,19 +344,24 @@ void DataRow::SetDecimalValue(int32_t index, const Nullable<decimal_t>& value) · 3 unmodified lines | ||
| 216 | 344 | const int32_t length = strval.size() + 1; |
| 217 | 345 | char* copy = static_cast<char*>(malloc(length * sizeof(char))); |
| 218 | 346 | strcpy_s(copy, length, strval.c_str()); |
| 219 | − m_values[index] = copy; | |
| 347 | + m_values[columnIndex] = copy; | |
| 220 | 348 | } |
| 221 | 349 | else |
| 222 | 350 | { |
| 223 | − m_values[index] = nullptr; | |
| 351 | + m_values[columnIndex] = nullptr; | |
| 224 | 352 | } |
| 225 | 353 | } |
| 226 | 354 | |
| 227 | −Nullable<Guid> DataRow::ValueAsGuid(int32_t index) const | |
| 355 | +void DataRow::SetDecimalValue(const string& columnName, const Nullable<decimal_t>& value) | |
| 228 | 356 | { |
| 229 | − ValidateColumnType(index, DataType::Guid, true); | |
| 357 | + SetDecimalValue(GetColumnIndex(columnName), value); | |
| 358 | +} | |
| 359 | + | |
| 360 | +Nullable<Guid> DataRow::ValueAsGuid(int32_t columnIndex) const | |
| 361 | +{ | |
| 362 | + ValidateColumnType(columnIndex, DataType::Guid, true); | |
| 230 | 363 | |
| 231 | − int8_t* data = static_cast<int8_t*>(m_values[index]); | |
| 364 | + int8_t* data = static_cast<int8_t*>(m_values[columnIndex]); | |
| 232 | 365 | |
| 233 | 366 | if (data) |
| 234 | 367 | { |
| @@ -240,98 +373,188 @@ Nullable<Guid> DataRow::ValueAsGuid(int32_t index) const · 5 unmodified lines | ||
| 240 | 373 | return nullptr; |
| 241 | 374 | } |
| 242 | 375 | |
| 243 | −void DataRow::SetGuidValue(int32_t index, const Nullable<Guid>& value) | |
| 376 | +Nullable<Guid> DataRow::ValueAsGuid(const string& columnName) const | |
| 377 | +{ | |
| 378 | + return ValueAsGuid(GetColumnIndex(columnName)); | |
| 379 | +} | |
| 380 | + | |
| 381 | +void DataRow::SetGuidValue(int32_t columnIndex, const Nullable<Guid>& value) | |
| 244 | 382 | { |
| 245 | − ValidateColumnType(index, DataType::Guid); | |
| 383 | + ValidateColumnType(columnIndex, DataType::Guid); | |
| 246 | 384 | |
| 247 | 385 | if (value.HasValue()) |
| 248 | 386 | { |
| 249 | 387 | int8_t* copy = static_cast<int8_t*>(malloc(16)); |
| 250 | 388 | memcpy(copy, value.GetValueOrDefault().data, 16); |
| 251 | − m_values[index] = copy; | |
| 389 | + m_values[columnIndex] = copy; | |
| 252 | 390 | } |
| 253 | 391 | else |
| 254 | 392 | { |
| 255 | − m_values[index] = nullptr; | |
| 393 | + m_values[columnIndex] = nullptr; | |
| 256 | 394 | } |
| 257 | 395 | } |
| 258 | 396 | |
| 259 | −Nullable<int8_t> DataRow::ValueAsInt8(int32_t index) const | |
| 397 | +void DataRow::SetGuidValue(const string& columnName, const Nullable<Guid>& value) | |
| 398 | +{ | |
| 399 | + SetGuidValue(GetColumnIndex(columnName), value); | |
| 400 | +} | |
| 401 | + | |
| 402 | +Nullable<int8_t> DataRow::ValueAsInt8(int32_t columnIndex) const | |
| 403 | +{ | |
| 404 | + return GetValue<int8_t>(columnIndex, DataType::Int8); | |
| 405 | +} | |
| 406 | + | |
| 407 | +Nullable<int8_t> DataRow::ValueAsInt8(const string& columnName) const | |
| 408 | +{ | |
| 409 | + return ValueAsInt8(GetColumnIndex(columnName)); | |
| 410 | +} | |
| 411 | + | |
| 412 | +void DataRow::SetInt8Value(int32_t columnIndex, const Nullable<int8_t>& value) | |
| 413 | +{ | |
| 414 | + SetValue<int8_t>(columnIndex, value, DataType::Int8); | |
| 415 | +} | |
| 416 | + | |
| 417 | +void DataRow::SetInt8Value(const string& columnName, const Nullable<int8_t>& value) | |
| 418 | +{ | |
| 419 | + SetInt8Value(GetColumnIndex(columnName), value); | |
| 420 | +} | |
| 421 | + | |
| 422 | +Nullable<int16_t> DataRow::ValueAsInt16(int32_t columnIndex) const | |
| 423 | +{ | |
| 424 | + return GetValue<int16_t>(columnIndex, DataType::Int16); | |
| 425 | +} | |
| 426 | + | |
| 427 | +Nullable<int16_t> DataRow::ValueAsInt16(const string& columnName) const | |
| 428 | +{ | |
| 429 | + return ValueAsInt16(GetColumnIndex(columnName)); | |
| 430 | +} | |
| 431 | + | |
| 432 | +void DataRow::SetInt16Value(int32_t columnIndex, const Nullable<int16_t>& value) | |
| 433 | +{ | |
| 434 | + SetValue<int16_t>(columnIndex, value, DataType::Int16); | |
| 435 | +} | |
| 436 | + | |
| 437 | +void DataRow::SetInt16Value(const string& columnName, const Nullable<int16_t>& value) | |
| 438 | +{ | |
| 439 | + SetInt16Value(GetColumnIndex(columnName), value); | |
| 440 | +} | |
| 441 | + | |
| 442 | +Nullable<int32_t> DataRow::ValueAsInt32(int32_t columnIndex) const | |
| 443 | +{ | |
| 444 | + return GetValue<int32_t>(columnIndex, DataType::Int32); | |
| 445 | +} | |
| 446 | + | |
| 447 | +Nullable<int32_t> DataRow::ValueAsInt32(const string& columnName) const | |
| 448 | +{ | |
| 449 | + return ValueAsInt32(GetColumnIndex(columnName)); | |
| 450 | +} | |
| 451 | + | |
| 452 | +void DataRow::SetInt32Value(int32_t columnIndex, const Nullable<int32_t>& value) | |
| 453 | +{ | |
| 454 | + SetValue<int32_t>(columnIndex, value, DataType::Int32); | |
| 455 | +} | |
| 456 | + | |
| 457 | +void DataRow::SetInt32Value(const string& columnName, const Nullable<int32_t>& value) | |
| 458 | +{ | |
| 459 | + SetInt32Value(GetColumnIndex(columnName), value); | |
| 460 | +} | |
| 461 | + | |
| 462 | +Nullable<int64_t> DataRow::ValueAsInt64(int32_t columnIndex) const | |
| 463 | +{ | |
| 464 | + return GetValue<int64_t>(columnIndex, DataType::Int64); | |
| 465 | +} | |
| 466 | + | |
| 467 | +Nullable<int64_t> DataRow::ValueAsInt64(const string& columnName) const | |
| 468 | +{ | |
| 469 | + return ValueAsInt64(GetColumnIndex(columnName)); | |
| 470 | +} | |
| 471 | + | |
| 472 | +void DataRow::SetInt64Value(int32_t columnIndex, const Nullable<int64_t>& value) | |
| 473 | +{ | |
| 474 | + SetValue<int64_t>(columnIndex, value, DataType::Int64); | |
| 475 | +} | |
| 476 | + | |
| 477 | +void DataRow::SetInt64Value(const string& columnName, const Nullable<int64_t>& value) | |
| 478 | +{ | |
| 479 | + SetInt64Value(GetColumnIndex(columnName), value); | |
| 480 | +} | |
| 481 | + | |
| 482 | +Nullable<uint8_t> DataRow::ValueAsUInt8(int32_t columnIndex) const | |
| 260 | 483 | { |
| 261 | − return GetValue<int8_t>(index, DataType::Int8); | |
| 484 | + return GetValue<uint8_t>(columnIndex, DataType::UInt8); | |
| 262 | 485 | } |
| 263 | 486 | |
| 264 | −void DataRow::SetInt8Value(int32_t index, const Nullable<int8_t>& value) | |
| 487 | +Nullable<uint8_t> DataRow::ValueAsUInt8(const string& columnName) const | |
| 265 | 488 | { |
| 266 | − SetValue<int8_t>(index, value, DataType::Int8); | |
| 489 | + return ValueAsUInt8(GetColumnIndex(columnName)); | |
| 267 | 490 | } |
| 268 | 491 | |
| 269 | −Nullable<int16_t> DataRow::ValueAsInt16(int32_t index) const | |
| 492 | +void DataRow::SetUInt8Value(int32_t columnIndex, const Nullable<uint8_t>& value) | |
| 270 | 493 | { |
| 271 | − return GetValue<int16_t>(index, DataType::Int16); | |
| 494 | + SetValue<uint8_t>(columnIndex, value, DataType::UInt8); | |
| 272 | 495 | } |
| 273 | 496 | |
| 274 | −void DataRow::SetInt16Value(int32_t index, const Nullable<int16_t>& value) | |
| 497 | +void DataRow::SetUInt8Value(const string& columnName, const Nullable<uint8_t>& value) | |
| 275 | 498 | { |
| 276 | − SetValue<int16_t>(index, value, DataType::Int16); | |
| 499 | + SetUInt8Value(GetColumnIndex(columnName), value); | |
| 277 | 500 | } |
| 278 | 501 | |
| 279 | −Nullable<int32_t> DataRow::ValueAsInt32(int32_t index) const | |
| 502 | +Nullable<uint16_t> DataRow::ValueAsUInt16(int32_t columnIndex) const | |
| 280 | 503 | { |
| 281 | − return GetValue<int32_t>(index, DataType::Int32); | |
| 504 | + return GetValue<uint16_t>(columnIndex, DataType::UInt16); | |
| 282 | 505 | } |
| 283 | 506 | |
| 284 | −void DataRow::SetInt32Value(int32_t index, const Nullable<int32_t>& value) | |
| 507 | +Nullable<uint16_t> DataRow::ValueAsUInt16(const string& columnName) const | |
| 285 | 508 | { |
| 286 | − SetValue<int32_t>(index, value, DataType::Int32); | |
| 509 | + return ValueAsUInt16(GetColumnIndex(columnName)); | |
| 287 | 510 | } |
| 288 | 511 | |
| 289 | −Nullable<int64_t> DataRow::ValueAsInt64(int32_t index) const | |
| 512 | +void DataRow::SetUInt16Value(int32_t columnIndex, const Nullable<uint16_t>& value) | |
| 290 | 513 | { |
| 291 | − return GetValue<int64_t>(index, DataType::Int64); | |
| 514 | + SetValue<uint16_t>(columnIndex, value, DataType::UInt16); | |
| 292 | 515 | } |
| 293 | 516 | |
| 294 | −void DataRow::SetInt64Value(int32_t index, const Nullable<int64_t>& value) | |
| 517 | +void DataRow::SetUInt16Value(const string& columnName, const Nullable<uint16_t>& value) | |
| 295 | 518 | { |
| 296 | − SetValue<int64_t>(index, value, DataType::Int64); | |
| 519 | + SetUInt16Value(GetColumnIndex(columnName), value); | |
| 297 | 520 | } |
| 298 | 521 | |
| 299 | −Nullable<uint8_t> DataRow::ValueAsUInt8(int32_t index) const | |
| 522 | +Nullable<uint32_t> DataRow::ValueAsUInt32(int32_t columnIndex) const | |
| 300 | 523 | { |
| 301 | − return GetValue<uint8_t>(index, DataType::UInt8); | |
| 524 | + return GetValue<uint32_t>(columnIndex, DataType::UInt32); | |
| 302 | 525 | } |
| 303 | 526 | |
| 304 | −void DataRow::SetUInt8Value(int32_t index, const Nullable<uint8_t>& value) | |
| 527 | +Nullable<uint32_t> DataRow::ValueAsUInt32(const string& columnName) const | |
| 305 | 528 | { |
| 306 | − SetValue<uint8_t>(index, value, DataType::UInt8); | |
| 529 | + return ValueAsUInt32(GetColumnIndex(columnName)); | |
| 307 | 530 | } |
| 308 | 531 | |
| 309 | −Nullable<uint16_t> DataRow::ValueAsUInt16(int32_t index) const | |
| 532 | +void DataRow::SetUInt32Value(int32_t columnIndex, const Nullable<uint32_t>& value) | |
| 310 | 533 | { |
| 311 | − return GetValue<uint16_t>(index, DataType::UInt16); | |
| 534 | + SetValue<uint32_t>(columnIndex, value, DataType::UInt32); | |
| 312 | 535 | } |
| 313 | 536 | |
| 314 | −void DataRow::SetUInt16Value(int32_t index, const Nullable<uint16_t>& value) | |
| 537 | +void DataRow::SetUInt32Value(const string& columnName, const Nullable<uint32_t>& value) | |
| 315 | 538 | { |
| 316 | − SetValue<uint16_t>(index, value, DataType::UInt16); | |
| 539 | + SetUInt32Value(GetColumnIndex(columnName), value); | |
| 317 | 540 | } |
| 318 | 541 | |
| 319 | −Nullable<uint32_t> DataRow::ValueAsUInt32(int32_t index) const | |
| 542 | +Nullable<uint64_t> DataRow::ValueAsUInt64(int32_t columnIndex) const | |
| 320 | 543 | { |
| 321 | − return GetValue<uint32_t>(index, DataType::UInt32); | |
| 544 | + return GetValue<uint64_t>(columnIndex, DataType::UInt64); | |
| 322 | 545 | } |
| 323 | 546 | |
| 324 | −void DataRow::SetUInt32Value(int32_t index, const Nullable<uint32_t>& value) | |
| 547 | +Nullable<uint64_t> DataRow::ValueAsUInt64(const string& columnName) const | |
| 325 | 548 | { |
| 326 | − SetValue<uint32_t>(index, value, DataType::UInt32); | |
| 549 | + return ValueAsUInt64(GetColumnIndex(columnName)); | |
| 327 | 550 | } |
| 328 | 551 | |
| 329 | −Nullable<uint64_t> DataRow::ValueAsUInt64(int32_t index) const | |
| 552 | +void DataRow::SetUInt64Value(int32_t columnIndex, const Nullable<uint64_t>& value) | |
| 330 | 553 | { |
| 331 | − return GetValue<uint64_t>(index, DataType::UInt64); | |
| 554 | + SetValue<uint64_t>(columnIndex, value, DataType::UInt64); | |
| 332 | 555 | } |
| 333 | 556 | |
| 334 | −void DataRow::SetUInt64Value(int32_t index, const Nullable<uint64_t>& value) | |
| 557 | +void DataRow::SetUInt64Value(const string& columnName, const Nullable<uint64_t>& value) | |
| 335 | 558 | { |
| 336 | − SetValue<uint64_t>(index, value, DataType::UInt64); | |
| 559 | + SetUInt64Value(GetColumnIndex(columnName), value); | |
| 337 | 560 | } |