ICSVReader.cs 2.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. using System;
  2. namespace CSVReader
  3. {
  4. public interface ICSVReader
  5. {
  6. /// <summary>
  7. /// Reads either the current or last entry based on <see cref="forward"/> and moves the pointer in that direction.
  8. /// </summary>
  9. /// <returns>
  10. /// The next <see cref="InputObject"/> in correct direction.
  11. /// </returns>
  12. /// <param name="forward">Direction of read command.</param>
  13. InputObject ReadNextEntry(bool forward);
  14. /// <summary>
  15. /// Moves the pointer to the entry that has the closest timestamp to <see cref="time"/>.
  16. /// </summary>
  17. /// <returns>
  18. /// The timestamp that is assumed to be the closest to the input time.
  19. /// </returns>
  20. /// <param name="time">Time to move the pointer to.</param>
  21. double JumpToEntry(double time, bool forward);
  22. /// <summary>
  23. /// Tests whether a timestamp is in bounds of the current file.
  24. /// </summary>
  25. /// <returns>
  26. /// A bool inidcationg if <see cref="time"/> is in bounds of the file.
  27. /// </returns>
  28. /// <param name="time">Time to check.</param>
  29. bool IsInBounds(double time);
  30. /// <summary>
  31. /// Finds the timestamp of the next file entry in <see cref="forward"/> direction. Does NOT move the pointer.
  32. /// </summary>
  33. /// <returns>
  34. /// The timestamp of the next entry.
  35. /// </returns>
  36. /// <param name="forward">Direction to read.</param>
  37. double Peek(bool forward);
  38. /// <summary>
  39. /// Finds the Timestamp of the last Element in the underlying file.
  40. /// </summary>
  41. /// <returns>
  42. /// The timestamp of the last entry.
  43. /// </returns>
  44. double GetLastTimestamp();
  45. /// <summary>
  46. /// Finds the Timestamp of the first Element in the underlying file.
  47. /// </summary>
  48. /// <returns>
  49. /// The timestamp of the first entry.
  50. /// </returns>
  51. double GetFirstTimestamp();
  52. ///<summary>
  53. ///Get the first timestamp in the timechunk
  54. ///</summary>
  55. ///<returns>
  56. ///Returns the first Timestamp in the timechunk.
  57. ///NaN if starttimestamp is not set.
  58. ///</returns>
  59. double GetChunkStarttimestamp();
  60. ///<summary>
  61. ///Get the last timestamp in the timechunk
  62. ///</summary>
  63. ///<returns>
  64. ///Returns the last timestamp in the timechunk.
  65. ///NaN if endtimestamp is not set.
  66. ///</returns>
  67. double GetChunkEndtimestamp();
  68. ///<summary>
  69. ///Set the first timestamp in the timechunk
  70. ///</summary>
  71. void SetChunkStarttimestamp(double time);
  72. ///<summary>
  73. ///Set the last timestamp in the timechunk
  74. ///</summary>
  75. void SetChunkEndtimestamp(double time);
  76. /// <summary>
  77. /// Closes the stream on the File.
  78. /// </summary>
  79. void TearDown();
  80. }
  81. }