Class cwipc_encoder
Defined in File api.h
Class Documentation
-
class cwipc_encoder
Pointcloud encoder, abstract C++ interface.
This interface is provided by pointcloud compressors. The caller feeds in pointclouds (as
cwipc_pointcloudobjects) and it returns memory blocks with compressed pointcloud data.Public Functions
-
inline virtual ~cwipc_encoder()
Destructor. Does not free underlying encoder.
You must call free() before calling the destructor (unless you have passed the cwipc_pointcloud object across an implementation language boundary and a reference may still be held there).
-
virtual void free() = 0
Deallocate the encoder.
Because the encoder may be used in a different implementation language or DLL than where it is implemented we do not count on refcounting and such. Call this method if you no longer need it.
Do not call on an encoder in an encodergroup, call the group free() in stead.
-
virtual void feed(cwipc_pointcloud *pc) = 0
Encode a pointcloud.
This call presents the encoder with a new pointcloud to encode. Do not call this method an on encoder that is part of an encoder group, call the group feed() method in stead.
-
virtual void close() = 0
Signal end of stream.
In multi-threaded applications call this to signal that no more data will be passed to feed().
-
virtual bool eof() = 0
Return true if no more encoded buffers are forthcoming.
-
virtual bool available(bool wait) = 0
Return true if a data buffer is currently available.
If this cwipc_encoder is not multi-threading capable the wait parameter is ignored. If it is multi-threaded aware and no data is currently available it may wait a reasonable amount of time (think: about a second) to see whether one becomes available.
- Parameters:
wait – Set to true if the caller is willing to wait until one is available.
-
virtual size_t get_encoded_size() = 0
Return size (in bytes) of compressed data available.
The caller should first call
available()to check that compressed data is available, thenget_encoded_size()to check how much data is available, then allocate a buffer of suitable size, then callcopy_data().
-
virtual bool copy_data(void *buffer, size_t bufferSize) = 0
Obtain compressed pointcloud data.
Copies the data of the most recently compressed pointcloud into a buffer supplied by the caller. The compressed data is returned at most once, so after this call
available()will return false again untilfeed()has been called.
-
virtual bool at_gop_boundary() = 0
Check whether we are at a Group-of-Pointclouds boundary.
- Returns:
true if the next compressed pointcloud should begin a new GOP.
-
inline virtual ~cwipc_encoder()