Time-of-Flight Library(ToF)  3.2.2
csf_reader.h
1 #ifndef _CHRONOPTICS_TOF_CSF_READER_H_
2 #define _CHRONOPTICS_TOF_CSF_READER_H_
3 
4 #include <chronoptics/tof/data.h>
5 #include <chronoptics/tof/stream.h>
6 #include <chronoptics/tof/calibration.h>
7 #include <chronoptics/tof/camera_config.h>
8 
9 #ifdef __cplusplus
10 extern "C" {
11 #endif
12 
13 /** This class reads csf files
14  */
15 typedef struct tof_csf_reader* tof_csf_reader_t;
16 
17 /** Destruct tof_csf_reader */
18 TOF_EXPORT void tof_csf_reader_delete(tof_csf_reader_t ptr);
19 
20 /** Open a csf file for reading
21  * @param ptr Pointer to class
22  * @param file_location File location of the csf file
23  * @param error Pointer to error
24  * @return New object
25  */
26 TOF_EXPORT tof_csf_reader_t tof_csf_reader_new(const char* file_location, tof_error_t *error);
27 
28 /** Read the next data frame from disk
29  * @param ptr Pointer to class
30  * @param error Pointer to error
31  * @return A data frame
32  */
33 TOF_EXPORT tof_data_t tof_csf_reader_read_frame(tof_csf_reader_t ptr, tof_error_t *error);
34 
35 /** Read the next data frame from disk into the supplied pointer
36  * @param ptr Pointer to class
37  * @param pointer The pointer to the data to write into
38  * @param capacity The amount of data the pointer can hold
39  * @param callback Callback that will be called when pointer is no longer in
40  * use
41  * @param callback_user_data User data that will be passed back when the function pointer is called
42  * @param error Pointer to error
43  * @return A data frame
44  */
45 TOF_EXPORT tof_data_t tof_csf_reader_read_frame_into_pointer(tof_csf_reader_t ptr, uint8_t* pointer, size_t capacity, tof_user_pointer_destructed_t callback, void* callback_user_data, tof_error_t *error);
46 
47 /** Get the total number of frames in the csf file
48  * @param ptr Pointer to class
49  * @param error Pointer to error
50  * @return Total number of frames in the csf file
51  */
52 TOF_EXPORT size_t tof_csf_reader_number_of_frames(const tof_csf_reader_t ptr, tof_error_t *error);
53 
54 /** Returns an empty Data class containing the header information for the
55  * specified frame
56  * @param ptr Pointer to class
57  * @param index Which frame to get the header from
58  * @param error Pointer to error
59  * @return Empty Data instance containing header information
60  */
61 TOF_EXPORT tof_data_t tof_csf_reader_get_header(const tof_csf_reader_t ptr, size_t index, tof_error_t *error);
62 
63 /** Get the stream information of the next frame
64  * @param ptr Pointer to class
65  * @param error Pointer to error
66  * @return Information on the next frame
67  */
68 TOF_EXPORT tof_stream_t tof_csf_reader_next_stream(const tof_csf_reader_t ptr, tof_error_t *error);
69 
70 /** Get the size of the next frame
71  * @param ptr Pointer to class
72  * @param error Pointer to error
73  * @return Size of the next frame
74  */
75 TOF_EXPORT size_t tof_csf_reader_next_frame_size(const tof_csf_reader_t ptr, tof_error_t *error);
76 
77 /** Get the current frame position
78  * @param ptr Pointer to class
79  * @param error Pointer to error
80  * @return Frame index
81  */
82 TOF_EXPORT size_t tof_csf_reader_frame_index(const tof_csf_reader_t ptr, tof_error_t *error);
83 
84 /** Go to specified frame
85  * @param ptr Pointer to class
86  * @param index The index of the frame to jump to
87  * @param error Pointer to error
88  */
89 TOF_EXPORT void tof_csf_reader_go_to_frame(tof_csf_reader_t ptr, size_t index, tof_error_t *error);
90 
91 /** Get the streams that are in the csf file
92  * @param ptr Pointer to class
93  * @param streams Streams in the csf file
94  * @param capacity The amount of data the above pointer can hold
95  * @param error Pointer to error
96  * @return Number of pointers filled or complete array size
97  */
98 TOF_EXPORT size_t tof_csf_reader_streams(const tof_csf_reader_t ptr, tof_stream_t* streams, size_t capacity, tof_error_t *error);
99 
100 /** Get the number of frames contained in the file of the given stream
101  * @param ptr Pointer to class
102  * @param stream The stream
103  * @param error Pointer to error
104  * @return Number of frames for given stream
105  */
106 TOF_EXPORT size_t tof_csf_reader_stream_count(const tof_csf_reader_t ptr, tof_stream_t stream, tof_error_t *error);
107 
108 /** Go to the specified stream, the next read frame call will start from here
109  * @param ptr Pointer to class
110  * @param stream The stream
111  * @param index The frame index
112  * @param error Pointer to error
113  */
114 TOF_EXPORT void tof_csf_reader_go_to_stream(tof_csf_reader_t ptr, tof_stream_t stream, size_t index, tof_error_t *error);
115 
116 /** Get calibration from the csf file
117  * @param ptr Pointer to class
118  * @param error Pointer to error
119  * @return Calibration
120  */
121 TOF_EXPORT tof_calibration_t tof_csf_reader_get_calibration(const tof_csf_reader_t ptr, tof_error_t *error);
122 
123 /** Get camera config from the csf file
124  * @param ptr Pointer to class
125  * @param error Pointer to error
126  * @return Camera config
127  */
128 TOF_EXPORT tof_camera_config_t tof_csf_reader_get_camera_config(const tof_csf_reader_t ptr, tof_error_t *error);
129 
130 #ifdef __cplusplus
131 }
132 #endif
133 
134 #endif