Class cwipc_sink

Class Documentation

class cwipc_sink

A consumer of pointclouds, abstract C++ interface.

This interface is provided by renderers and such. It allows the user of this interface to send cwipc pointcloud data somewhere.

Public Functions

inline virtual ~cwipc_sink()

Destructor. Does not free underlying sink.

You must call free() before calling the destructor (unless you have passed the cwipc object across an implementation language boundary and a reference may still be held there).

virtual void free() = 0

Deallocate the pointcloud sink.

Because the pointcloud sink 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 the source.

virtual bool feed(cwipc_pointcloud *pc, bool clear) = 0

Feed a pointcloud to the sink.

A display sink will likely show the pointcloud in a window and give the user some interaction commands to inspect it.

Note that if the sink needs to keep the pointcloud data it will make a copy (or shallow copy), so after feed() returns the caller still owns the original point cloud and can reuse it or call free().

Parameters:
  • pc – The pointcloud

  • clear – If true a display window will clear any previous pointclouds

Returns:

True if the operation was successful.

virtual bool caption(const char *caption) = 0

Set a caption or title on the window.

If the sink is a display window this will set some sort of caption on the window.

Parameters:

caption – The UTF8 caption string.

Returns:

True if this sink could present the caption to the user.

virtual char interact(const char *prompt, const char *responses, int32_t millis) = 0

User interaction.

Parameters:
  • prompt – A prompt message to show to the user, explaining what the program wants.

  • responses – A string with all characters that can be typed by the user.

  • millis – The number of milliseconds to wait for interaction, 0 for no wait or -1 for forever.

Returns:

The character typed by the user, or ‘\0’ if this sink does not support user interaction.