AbstractUnitCSVReader.cs 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using System.IO;
  4. using UnityEngine;
  5. namespace CSVReader
  6. {
  7. public abstract class AbstractUnitCSVReader
  8. {
  9. protected readonly object LockObject;
  10. //BIN-Inhalte: int ID - double timestamp - 3x float coodrinates - 3x float rotation - 2x uint colors - int EntityType - int SensorID
  11. /// <summary>
  12. /// The Length of one dataline.
  13. /// int ID - double timestamp - 3x float coodrinates - 3x float rotation - 3x float head rotation - 2x uint colors - int EntityType - int SensorID
  14. /// </summary>
  15. protected readonly int ROWLENGTHINBYTES = 3 * sizeof(int) + sizeof(double) + 9 * sizeof(float) + 2 * sizeof(uint);
  16. /// <summary>
  17. /// The Binary reader on the file.
  18. /// </summary>
  19. protected BinaryReader Reader;
  20. /// <summary>
  21. /// Whether the Binaryreader was initialized correctly
  22. /// </summary>
  23. protected bool Defined = false;
  24. protected double ChunkStartTimestamp = double.NaN;
  25. protected double ChunkEndTimestamp = double.NaN;
  26. protected AbstractUnitCSVReader()
  27. {
  28. LockObject = new object();
  29. }
  30. protected abstract InputObject ParseObject();
  31. protected abstract double GetTimeAtRelativeOffset(long shift);
  32. protected abstract double GetTimeAtAbsolutPosition(long offset);
  33. protected abstract bool TestNewPosition(long newPos);
  34. protected abstract bool TestBinaryReader();
  35. protected abstract bool IsStep(double newTime, double targetTime, int jumpdirection, bool forward);
  36. }
  37. }