Skip to content

Commit 76367d9

Browse files
committed
Merge pull request #380 from alberth/add_doxydocs
Add: Doxygen documentation comment for many of the classes.
2 parents d855d25 + d636620 commit 76367d9

40 files changed

+2795
-66
lines changed

Doxyfile

Lines changed: 2305 additions & 0 deletions
Large diffs are not rendered by default.

examples/protonect/Protonect.cpp

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
* either License.
2525
*/
2626

27+
/** @file Protonect.cpp Main application file. */
2728

2829
#include <iostream>
2930
#include <signal.h>
@@ -39,7 +40,7 @@
3940
#endif
4041

4142

42-
bool protonect_shutdown = false;
43+
bool protonect_shutdown = false; ///< Whether the running application should shut down.
4344

4445
void sigint_handler(int s)
4546
{
@@ -69,6 +70,16 @@ class MyFileLogger: public libfreenect2::Logger
6970
}
7071
};
7172

73+
/**
74+
* Main application entry point.
75+
*
76+
* Accepted argumemnts:
77+
* - cpu Perform depth processing with the CPU.
78+
* - gl Perform depth processing with OpenGL.
79+
* - cl Perform depth processing with OpenCL.
80+
* - <number> Serial number of the device to open.
81+
* - -noviewer Disable viewer window.
82+
*/
7283
int main(int argc, char *argv[])
7384
{
7485
std::string program_path(argv[0]);

examples/protonect/include/libfreenect2/async_packet_processor.h

Lines changed: 23 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@
2424
* either License.
2525
*/
2626

27+
/** @file async_packet_processor.h Asynchronous processing of packets. */
28+
2729
#ifndef ASYNC_PACKET_PROCESSOR_H_
2830
#define ASYNC_PACKET_PROCESSOR_H_
2931

@@ -33,19 +35,28 @@
3335
namespace libfreenect2
3436
{
3537

38+
/**
39+
* Packet processor that runs asynchronously.
40+
* @tparam PacketT Type of the packet being processed.
41+
*/
3642
template<typename PacketT>
3743
class AsyncPacketProcessor : public PacketProcessor<PacketT>
3844
{
3945
public:
4046
typedef PacketProcessor<PacketT>* PacketProcessorPtr;
4147

48+
/**
49+
* Constructor.
50+
* @param processor Object performing the processing.
51+
*/
4252
AsyncPacketProcessor(PacketProcessorPtr processor) :
4353
processor_(processor),
4454
current_packet_available_(false),
4555
shutdown_(false),
4656
thread_(&AsyncPacketProcessor<PacketT>::static_execute, this)
4757
{
4858
}
59+
4960
virtual ~AsyncPacketProcessor()
5061
{
5162
shutdown_ = true;
@@ -77,20 +88,25 @@ class AsyncPacketProcessor : public PacketProcessor<PacketT>
7788
packet_condition_.notify_one();
7889
}
7990
private:
80-
PacketProcessorPtr processor_;
81-
bool current_packet_available_;
82-
PacketT current_packet_;
91+
PacketProcessorPtr processor_; ///< The processing routine, executed in the asynchronous thread.
92+
bool current_packet_available_; ///< Whether #current_packet_ still needs processing.
93+
PacketT current_packet_; ///< Packet being processed.
8394

8495
bool shutdown_;
85-
libfreenect2::mutex packet_mutex_;
86-
libfreenect2::condition_variable packet_condition_;
87-
libfreenect2::thread thread_;
88-
96+
libfreenect2::mutex packet_mutex_; ///< Mutex indicating a new packet can be stored in #current_packet_.
97+
libfreenect2::condition_variable packet_condition_; ///< Mutex indicating processing is blocked on lack of packets.
98+
libfreenect2::thread thread_; ///< Asynchronous thread.
99+
100+
/**
101+
* Wrapper function to start the thread.
102+
* @param data The #AsyncPacketProcessor object to use.
103+
*/
89104
static void static_execute(void *data)
90105
{
91106
static_cast<AsyncPacketProcessor<PacketT> *>(data)->execute();
92107
}
93108

109+
/** Asynchronously process a provided packet. */
94110
void execute()
95111
{
96112
libfreenect2::unique_lock l(packet_mutex_);

examples/protonect/include/libfreenect2/data_callback.h

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,9 @@
2323
* Binary distributions must follow the binary distribution requirements of
2424
* either License.
2525
*/
26-
27-
26+
27+
/** @file data_callback.h Callback interface on arrival of new data. */
28+
2829
#ifndef DATA_CALLBACK_H_
2930
#define DATA_CALLBACK_H_
3031

@@ -37,6 +38,11 @@ namespace libfreenect2
3738
class LIBFREENECT2_API DataCallback
3839
{
3940
public:
41+
/**
42+
* Callback that new data has arrived.
43+
* @param buffer Buffer with new data.
44+
* @param n Size of the new data.
45+
*/
4046
virtual void onDataReceived(unsigned char *buffer, size_t n) = 0;
4147
};
4248

examples/protonect/include/libfreenect2/depth_packet_processor.h

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@
2424
* either License.
2525
*/
2626

27+
/** @file depth_packet_processor.h Depth processor definitions. */
28+
2729
#ifndef DEPTH_PACKET_PROCESSOR_H_
2830
#define DEPTH_PACKET_PROCESSOR_H_
2931

@@ -37,30 +39,34 @@
3739
namespace libfreenect2
3840
{
3941

42+
/** Data packet with depth information. */
4043
struct LIBFREENECT2_API DepthPacket
4144
{
4245
uint32_t sequence;
4346
uint32_t timestamp;
44-
unsigned char *buffer;
45-
size_t buffer_length;
47+
unsigned char *buffer; ///< Depth data.
48+
size_t buffer_length; ///< Size of depth data.
4649
};
4750

51+
/** Class for processing depth information. */
4852
typedef PacketProcessor<DepthPacket> BaseDepthPacketProcessor;
4953

5054
class LIBFREENECT2_API DepthPacketProcessor : public BaseDepthPacketProcessor
5155
{
5256
public:
57+
/** Configuration of depth processing. */
5358
struct LIBFREENECT2_API Config
5459
{
5560
float MinDepth;
5661
float MaxDepth;
57-
58-
bool EnableBilateralFilter;
59-
bool EnableEdgeAwareFilter;
60-
62+
63+
bool EnableBilateralFilter; ///< Whether to run the bilateral filter.
64+
bool EnableEdgeAwareFilter; ///< Whether to run the edge aware filter.
65+
6166
Config();
6267
};
6368

69+
/** Parameters of depth processing. */
6470
struct LIBFREENECT2_API Parameters
6571
{
6672
float ab_multiplier;
@@ -112,6 +118,7 @@ class LIBFREENECT2_API DepthPacketProcessor : public BaseDepthPacketProcessor
112118
#ifdef LIBFREENECT2_WITH_OPENGL_SUPPORT
113119
class OpenGLDepthPacketProcessorImpl;
114120

121+
/** Depth packet processor using OpenGL. */
115122
class LIBFREENECT2_API OpenGLDepthPacketProcessor : public DepthPacketProcessor
116123
{
117124
public:
@@ -142,6 +149,7 @@ class LIBFREENECT2_API OpenGLDepthPacketProcessor : public DepthPacketProcessor
142149
// TODO: push this to some internal namespace
143150
class CpuDepthPacketProcessorImpl;
144151

152+
/** Depth packet processor using the CPU. */
145153
class LIBFREENECT2_API CpuDepthPacketProcessor : public DepthPacketProcessor
146154
{
147155
public:
@@ -171,6 +179,7 @@ class LIBFREENECT2_API CpuDepthPacketProcessor : public DepthPacketProcessor
171179
#ifdef LIBFREENECT2_WITH_OPENCL_SUPPORT
172180
class OpenCLDepthPacketProcessorImpl;
173181

182+
/** Depth packet processor using OpenCL. */
174183
class LIBFREENECT2_API OpenCLDepthPacketProcessor : public DepthPacketProcessor
175184
{
176185
public:

examples/protonect/include/libfreenect2/depth_packet_stream_parser.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@
2424
* either License.
2525
*/
2626

27+
/** @file depth_packet_stream_parser.h Parser processor definitions of depth packets. */
28+
2729
#ifndef DEPTH_PACKET_STREAM_PARSER_H_
2830
#define DEPTH_PACKET_STREAM_PARSER_H_
2931

@@ -40,6 +42,7 @@
4042
namespace libfreenect2
4143
{
4244

45+
/** Footer of a depth packet. */
4346
LIBFREENECT2_PACK(struct LIBFREENECT2_API DepthSubPacketFooter
4447
{
4548
uint32_t magic0;
@@ -51,6 +54,10 @@ LIBFREENECT2_PACK(struct LIBFREENECT2_API DepthSubPacketFooter
5154
uint32_t fields[32];
5255
});
5356

57+
/**
58+
* Parser of th depth stream, recognizes valid depth packets in the stream, and
59+
* passes them on for further processing.
60+
*/
5461
class LIBFREENECT2_API DepthPacketStreamParser : public DataCallback
5562
{
5663
public:

examples/protonect/include/libfreenect2/double_buffer.h

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@
2424
* either License.
2525
*/
2626

27+
/** @file double_buffer.h Double buffer implementation. */
28+
2729
#ifndef DOUBLE_BUFFER_H_
2830
#define DOUBLE_BUFFER_H_
2931

@@ -33,14 +35,16 @@
3335
namespace libfreenect2
3436
{
3537

38+
/** Data of a single buffer. */
3639
struct LIBFREENECT2_API Buffer
3740
{
3841
public:
39-
size_t capacity;
40-
size_t length;
41-
unsigned char* data;
42+
size_t capacity; ///< Capacity of the buffer.
43+
size_t length; ///< Used length of the buffer.
44+
unsigned char* data; ///< Start address of the buffer.
4245
};
4346

47+
/** Double bufffer class. */
4448
class LIBFREENECT2_API DoubleBuffer
4549
{
4650
public:
@@ -55,10 +59,10 @@ class LIBFREENECT2_API DoubleBuffer
5559

5660
Buffer& back();
5761
private:
58-
Buffer buffer_[2];
59-
unsigned char front_buffer_index_;
62+
Buffer buffer_[2]; // Both data buffers.
63+
unsigned char front_buffer_index_; ///< Index of the front buffer.
6064

61-
unsigned char* buffer_data_;
65+
unsigned char* buffer_data_; ///< Memory holding both buffers.
6266
};
6367

6468
} /* namespace libfreenect2 */

examples/protonect/include/libfreenect2/frame_listener.hpp

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@
2424
* either License.
2525
*/
2626

27+
/** @file frame_listener.hpp Classes for frame listeners. */
28+
2729
#ifndef FRAME_LISTENER_HPP_
2830
#define FRAME_LISTENER_HPP_
2931

@@ -34,20 +36,24 @@
3436
namespace libfreenect2
3537
{
3638

39+
/** A frame from the stream. */
3740
class LIBFREENECT2_API Frame
3841
{
3942
public:
43+
/** Available types of frames. */
4044
enum Type
4145
{
42-
Color = 1,
43-
Ir = 2,
44-
Depth = 4
46+
Color = 1, ///< RGB frame.
47+
Ir = 2, ///< IR frame.
48+
Depth = 4 ///< Depth frame.
4549
};
4650

4751
uint32_t timestamp;
4852
uint32_t sequence;
49-
size_t width, height, bytes_per_pixel;
50-
unsigned char* data;
53+
size_t width; ///< Length of a line (in pixels).
54+
size_t height; ///< Number of lines in the frame.
55+
size_t bytes_per_pixel; ///< Number of bytes in a pixel.
56+
unsigned char* data; ///< Data of the frame (aligned).
5157

5258
Frame(size_t width, size_t height, size_t bytes_per_pixel) :
5359
width(width),
@@ -68,14 +74,20 @@ class LIBFREENECT2_API Frame
6874
}
6975

7076
protected:
71-
unsigned char* rawdata;
77+
unsigned char* rawdata; ///< Unaligned start of #data.
7278
};
7379

80+
/** Callback class for waiting on a new frame. */
7481
class LIBFREENECT2_API FrameListener
7582
{
7683
public:
7784
virtual ~FrameListener();
7885

86+
/**
87+
* A new frame has arrived, process it.
88+
* @param type Type of the new frame.
89+
* @param frame Data of the frame.
90+
*/
7991
virtual bool onNewFrame(Frame::Type type, Frame *frame) = 0;
8092
};
8193

examples/protonect/include/libfreenect2/frame_listener_impl.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@
2424
* either License.
2525
*/
2626

27+
/** @file frame_listener_impl.h Implementation of the frame listener classes. */
28+
2729
#ifndef FRAME_LISTENER_IMPL_H_
2830
#define FRAME_LISTENER_IMPL_H_
2931

@@ -35,10 +37,12 @@
3537
namespace libfreenect2
3638
{
3739

40+
/** Storage of frames by type. */
3841
typedef std::map<Frame::Type, Frame*> FrameMap;
3942

4043
class SyncMultiFrameListenerImpl;
4144

45+
/** Class for collecting and combining frames from different sources. */
4246
class LIBFREENECT2_API SyncMultiFrameListener : public FrameListener
4347
{
4448
public:

0 commit comments

Comments
 (0)