ArrayBase_t.cs 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6. namespace IACommService4CSharp
  7. {
  8. public class ArrayBase_t<T> : DataValue_t where T : ComplexBase_t, new()
  9. {
  10. public ArrayBase_t(uint[] dimensions = null) : base(DType.Complex, dimensions)
  11. {
  12. }
  13. //Internal use
  14. public ArrayBase_t(IDataValue4CSharp value) : base(value)
  15. {
  16. }
  17. ~ArrayBase_t()
  18. {
  19. }
  20. public T GetElement(uint index)
  21. {
  22. T value = new T();
  23. var status = Internal.GetElement(index, value.Internal);
  24. if (status != ErrorCode.Good)
  25. return null;
  26. return value;
  27. }
  28. public T GetElement(uint[] indexes)
  29. {
  30. T value = new T();
  31. var status = Internal.GetElement(indexes, value.Internal);
  32. if (status != ErrorCode.Good)
  33. return null;
  34. return value;
  35. }
  36. }
  37. }