Skip to content

Commit d630d0f

Browse files
committed
docs: Add all API documentation
Also fix a few inconsistencies in the code.
1 parent 305ae62 commit d630d0f

File tree

12 files changed

+552
-75
lines changed

12 files changed

+552
-75
lines changed

Doxyextra.css

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
@import url(https://fonts.googleapis.com/css?family=Lato:400,700|Roboto+Mono:400);
2+
3+
body, table, div, p, dl, table.directory, div.toc li, div.toc h3, div.summary, div.ingroups, .tabsearch, .directory .levels, span.mlabel {
4+
font: 400 18px/24px Lato,sans-serif;
5+
}
6+
.title, .icon, .navpath li.navelem a, #projectname, #projectbrief, #projectnumber, #powerTip div, .tabs, .tabs2, .tabs3 {
7+
font-family: Lato,sans-serif;
8+
}
9+
10+
#projectname {
11+
font-weight: bold;
12+
}
13+
14+
.icon {
15+
height: 100%;
16+
}
17+
.title {
18+
font-size: 200%;
19+
}
20+
21+
code {
22+
font: 400 16px/20px Roboto Mono,monospace;
23+
}
24+
pre.fragment, div.line, .params .paramdir {
25+
font-family: Roboto Mono,monospace;
26+
}
27+
28+
p, li {
29+
max-width: 50em;
30+
}
31+
32+
div.contents, #titlearea, div.header, div.navpath ul, .tabs, .tabs2, .tabs3 {
33+
padding-left: 5em;
34+
padding-right: 5em;
35+
}
36+

Doxyfile.in

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ PROJECT_NAME = @PROJECT_NAME@
3838
# could be handy for archiving the generated documentation or if some version
3939
# control system is used.
4040

41-
PROJECT_NUMBER =
41+
PROJECT_NUMBER = @PROJECT_VERSION@
4242

4343
# Using the PROJECT_BRIEF tag one can provide an optional one line description
4444
# for a project that appears at the top of each page and should give viewer a
@@ -144,7 +144,7 @@ FULL_PATH_NAMES = YES
144144
# will be relative from the directory where doxygen is started.
145145
# This tag requires that the tag FULL_PATH_NAMES is set to YES.
146146

147-
STRIP_FROM_PATH = .
147+
STRIP_FROM_PATH = @CMAKE_SOURCE_DIR@
148148

149149
# The STRIP_FROM_INC_PATH tag can be used to strip a user-defined part of the
150150
# path mentioned in the documentation of a class, which tells the reader which
@@ -153,7 +153,7 @@ STRIP_FROM_PATH = .
153153
# specify the list of include paths that are normally passed to the compiler
154154
# using the -I flag.
155155

156-
STRIP_FROM_INC_PATH = .
156+
STRIP_FROM_INC_PATH = @CMAKE_SOURCE_DIR@/include
157157

158158
# If the SHORT_NAMES tag is set to YES, doxygen will generate much shorter (but
159159
# less readable) file names. This can be useful is your file systems doesn't
@@ -169,7 +169,7 @@ SHORT_NAMES = NO
169169
# description.)
170170
# The default value is: NO.
171171

172-
JAVADOC_AUTOBRIEF = NO
172+
JAVADOC_AUTOBRIEF = YES
173173

174174
# If the QT_AUTOBRIEF tag is set to YES then doxygen will interpret the first
175175
# line (until the first dot) of a Qt-style comment as the brief description. If
@@ -404,13 +404,13 @@ EXTRACT_ALL = YES
404404
# be included in the documentation.
405405
# The default value is: NO.
406406

407-
EXTRACT_PRIVATE = YES
407+
EXTRACT_PRIVATE = NO
408408

409409
# If the EXTRACT_PACKAGE tag is set to YES all members with package or internal
410410
# scope will be included in the documentation.
411411
# The default value is: NO.
412412

413-
EXTRACT_PACKAGE = YES
413+
EXTRACT_PACKAGE = NO
414414

415415
# If the EXTRACT_STATIC tag is set to YES all static members of a file will be
416416
# included in the documentation.
@@ -494,7 +494,7 @@ CASE_SENSE_NAMES = YES
494494
# scope will be hidden.
495495
# The default value is: NO.
496496

497-
HIDE_SCOPE_NAMES = NO
497+
HIDE_SCOPE_NAMES = YES
498498

499499
# If the SHOW_INCLUDE_FILES tag is set to YES then doxygen will put a list of
500500
# the files that are included by a file in the documentation of that file.
@@ -526,7 +526,7 @@ INLINE_INFO = YES
526526
# name. If set to NO the members will appear in declaration order.
527527
# The default value is: YES.
528528

529-
SORT_MEMBER_DOCS = YES
529+
SORT_MEMBER_DOCS = NO
530530

531531
# If the SORT_BRIEF_DOCS tag is set to YES then doxygen will sort the brief
532532
# descriptions of file, namespace and class members alphabetically by member
@@ -546,14 +546,14 @@ SORT_BRIEF_DOCS = NO
546546
# detailed member documentation.
547547
# The default value is: NO.
548548

549-
SORT_MEMBERS_CTORS_1ST = NO
549+
SORT_MEMBERS_CTORS_1ST = YES
550550

551551
# If the SORT_GROUP_NAMES tag is set to YES then doxygen will sort the hierarchy
552552
# of group names into alphabetical order. If set to NO the group names will
553553
# appear in their defined order.
554554
# The default value is: NO.
555555

556-
SORT_GROUP_NAMES = NO
556+
SORT_GROUP_NAMES = YES
557557

558558
# If the SORT_BY_SCOPE_NAME tag is set to YES, the class list will be sorted by
559559
# fully-qualified names, including namespaces. If set to NO, the class list will
@@ -624,7 +624,7 @@ MAX_INITIALIZER_LINES = 30
624624
# will mention the files that were used to generate the documentation.
625625
# The default value is: YES.
626626

627-
SHOW_USED_FILES = YES
627+
SHOW_USED_FILES = NO
628628

629629
# Set the SHOW_FILES tag to NO to disable the generation of the Files page. This
630630
# will remove the Files entry from the Quick Index and from the Folder Tree View
@@ -638,7 +638,7 @@ SHOW_FILES = YES
638638
# Folder Tree View (if specified).
639639
# The default value is: YES.
640640

641-
SHOW_NAMESPACES = YES
641+
SHOW_NAMESPACES = NO
642642

643643
# The FILE_VERSION_FILTER tag can be used to specify a program or script that
644644
# doxygen should invoke to get the current version for each file (typically from
@@ -811,7 +811,7 @@ EXCLUDE_SYMBOLS =
811811
# that contain example code fragments that are included (see the \include
812812
# command).
813813

814-
EXAMPLE_PATH =
814+
EXAMPLE_PATH = @CMAKE_SOURCE_DIR@/examples
815815

816816
# If the value of the EXAMPLE_PATH tag contains directories, you can use the
817817
# EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp and
@@ -892,7 +892,7 @@ USE_MDFILE_AS_MAINPAGE =
892892
# also VERBATIM_HEADERS is set to NO.
893893
# The default value is: NO.
894894

895-
SOURCE_BROWSER = YES
895+
SOURCE_BROWSER = NO
896896

897897
# Setting the INLINE_SOURCES tag to YES will include the body of functions,
898898
# classes and enums directly into the documentation.
@@ -965,7 +965,7 @@ USE_HTAGS = NO
965965
# See also: Section \class.
966966
# The default value is: YES.
967967

968-
VERBATIM_HEADERS = YES
968+
VERBATIM_HEADERS = NO
969969

970970
#---------------------------------------------------------------------------
971971
# Configuration options related to the alphabetical class index
@@ -976,7 +976,7 @@ VERBATIM_HEADERS = YES
976976
# classes, structs, unions or interfaces.
977977
# The default value is: YES.
978978

979-
ALPHABETICAL_INDEX = YES
979+
ALPHABETICAL_INDEX = NO
980980

981981
# The COLS_IN_ALPHA_INDEX tag can be used to specify the number of columns in
982982
# which the alphabetical index list will be split.
@@ -1068,7 +1068,7 @@ HTML_STYLESHEET =
10681068
# see the documentation.
10691069
# This tag requires that the tag GENERATE_HTML is set to YES.
10701070

1071-
HTML_EXTRA_STYLESHEET =
1071+
HTML_EXTRA_STYLESHEET = @CMAKE_SOURCE_DIR@/Doxyextra.css
10721072

10731073
# The HTML_EXTRA_FILES tag can be used to specify one or more extra images or
10741074
# other source files which should be copied to the HTML output directory. Note
@@ -1466,7 +1466,7 @@ MATHJAX_CODEFILE =
14661466
# The default value is: YES.
14671467
# This tag requires that the tag GENERATE_HTML is set to YES.
14681468

1469-
SEARCHENGINE = YES
1469+
SEARCHENGINE = NO
14701470

14711471
# When the SERVER_BASED_SEARCH tag is enabled the search engine will be
14721472
# implemented using a web server instead of a web client using Javascript. There
@@ -1883,15 +1883,15 @@ ENABLE_PREPROCESSING = YES
18831883
# The default value is: NO.
18841884
# This tag requires that the tag ENABLE_PREPROCESSING is set to YES.
18851885

1886-
MACRO_EXPANSION = NO
1886+
MACRO_EXPANSION = YES
18871887

18881888
# If the EXPAND_ONLY_PREDEF and MACRO_EXPANSION tags are both set to YES then
18891889
# the macro expansion is limited to the macros specified with the PREDEFINED and
18901890
# EXPAND_AS_DEFINED tags.
18911891
# The default value is: NO.
18921892
# This tag requires that the tag ENABLE_PREPROCESSING is set to YES.
18931893

1894-
EXPAND_ONLY_PREDEF = NO
1894+
EXPAND_ONLY_PREDEF = YES
18951895

18961896
# If the SEARCH_INCLUDES tag is set to YES the includes files in the
18971897
# INCLUDE_PATH will be searched if a #include is found.
@@ -1923,7 +1923,7 @@ INCLUDE_FILE_PATTERNS =
19231923
# recursively expanded use the := operator instead of the = operator.
19241924
# This tag requires that the tag ENABLE_PREPROCESSING is set to YES.
19251925

1926-
PREDEFINED =
1926+
PREDEFINED = LIBFREENECT2_API
19271927

19281928
# If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then this
19291929
# tag can be used to specify a list of macro names that should be expanded. The

examples/Protonect.cpp

Lines changed: 36 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,13 @@
2929
#include <iostream>
3030
#include <signal.h>
3131

32+
/// [headers]
3233
#include <libfreenect2/libfreenect2.hpp>
3334
#include <libfreenect2/frame_listener_impl.h>
3435
#include <libfreenect2/registration.h>
3536
#include <libfreenect2/packet_pipeline.h>
3637
#include <libfreenect2/logger.h>
38+
/// [headers]
3739
#ifdef EXAMPLES_WITH_OPENGL_SUPPORT
3840
#include "viewer.h"
3941
#endif
@@ -47,6 +49,7 @@ void sigint_handler(int s)
4749
}
4850

4951
//The following demostrates how to create a custom logger
52+
/// [logger]
5053
#include <fstream>
5154
#include <cstdlib>
5255
class MyFileLogger: public libfreenect2::Logger
@@ -69,7 +72,9 @@ class MyFileLogger: public libfreenect2::Logger
6972
logfile_ << "[" << libfreenect2::Logger::level2str(level) << "] " << message << std::endl;
7073
}
7174
};
75+
/// [logger]
7276

77+
/// [main]
7378
/**
7479
* Main application entry point.
7580
*
@@ -81,6 +86,7 @@ class MyFileLogger: public libfreenect2::Logger
8186
* - -noviewer Disable viewer window.
8287
*/
8388
int main(int argc, char *argv[])
89+
/// [main]
8490
{
8591
std::string program_path(argv[0]);
8692
std::cerr << "Environment variables: LOGFILE=<protonect.log>" << std::endl;
@@ -94,28 +100,36 @@ int main(int argc, char *argv[])
94100
binpath = program_path.substr(0, executable_name_idx);
95101
}
96102

97-
libfreenect2::Freenect2 freenect2;
98103
#if defined(WIN32) || defined(_WIN32) || defined(__WIN32__)
99104
// avoid flooing the very slow Windows console with debug messages
100105
libfreenect2::setGlobalLogger(libfreenect2::createConsoleLogger(libfreenect2::Logger::Info));
101106
#else
102107
// create a console logger with debug level (default is console logger with info level)
108+
/// [logging]
103109
libfreenect2::setGlobalLogger(libfreenect2::createConsoleLogger(libfreenect2::Logger::Debug));
110+
/// [logging]
104111
#endif
112+
/// [file logging]
105113
MyFileLogger *filelogger = new MyFileLogger(getenv("LOGFILE"));
106114
if (filelogger->good())
107115
libfreenect2::setGlobalLogger(filelogger);
116+
/// [file logging]
108117

118+
/// [context]
119+
libfreenect2::Freenect2 freenect2;
109120
libfreenect2::Freenect2Device *dev = 0;
110121
libfreenect2::PacketPipeline *pipeline = 0;
122+
/// [context]
111123

124+
/// [discovery]
112125
if(freenect2.enumerateDevices() == 0)
113126
{
114127
std::cout << "no device connected!" << std::endl;
115128
return -1;
116129
}
117130

118131
std::string serial = freenect2.getDefaultDeviceSerialNumber();
132+
/// [discovery]
119133

120134
bool viewer_enabled = true;
121135

@@ -126,7 +140,9 @@ int main(int argc, char *argv[])
126140
if(arg == "cpu")
127141
{
128142
if(!pipeline)
143+
/// [pipeline]
129144
pipeline = new libfreenect2::CpuPacketPipeline();
145+
/// [pipeline]
130146
}
131147
else if(arg == "gl")
132148
{
@@ -162,7 +178,9 @@ int main(int argc, char *argv[])
162178

163179
if(pipeline)
164180
{
181+
/// [open]
165182
dev = freenect2.openDevice(serial, pipeline);
183+
/// [open]
166184
}
167185
else
168186
{
@@ -178,18 +196,25 @@ int main(int argc, char *argv[])
178196
signal(SIGINT,sigint_handler);
179197
protonect_shutdown = false;
180198

199+
/// [listeners]
181200
libfreenect2::SyncMultiFrameListener listener(libfreenect2::Frame::Color | libfreenect2::Frame::Ir | libfreenect2::Frame::Depth);
182201
libfreenect2::FrameMap frames;
183-
libfreenect2::Frame undistorted(512, 424, 4), registered(512, 424, 4);
184202

185203
dev->setColorFrameListener(&listener);
186204
dev->setIrAndDepthFrameListener(&listener);
205+
/// [listeners]
206+
207+
/// [start]
187208
dev->start();
188209

189210
std::cout << "device serial: " << dev->getSerialNumber() << std::endl;
190211
std::cout << "device firmware: " << dev->getFirmwareVersion() << std::endl;
212+
/// [start]
191213

214+
/// [registration setup]
192215
libfreenect2::Registration* registration = new libfreenect2::Registration(dev->getIrCameraParams(), dev->getColorCameraParams());
216+
libfreenect2::Frame undistorted(512, 424, 4), registered(512, 424, 4);
217+
/// [registration setup]
193218

194219
size_t framecount = 0;
195220
#ifdef EXAMPLES_WITH_OPENGL_SUPPORT
@@ -200,14 +225,18 @@ int main(int argc, char *argv[])
200225
viewer_enabled = false;
201226
#endif
202227

228+
/// [loop start]
203229
while(!protonect_shutdown)
204230
{
205231
listener.waitForNewFrame(frames);
206232
libfreenect2::Frame *rgb = frames[libfreenect2::Frame::Color];
207233
libfreenect2::Frame *ir = frames[libfreenect2::Frame::Ir];
208234
libfreenect2::Frame *depth = frames[libfreenect2::Frame::Depth];
235+
/// [loop start]
209236

237+
/// [registration]
210238
registration->apply(rgb, depth, &undistorted, &registered);
239+
/// [registration]
211240

212241
framecount++;
213242
if (!viewer_enabled)
@@ -227,14 +256,18 @@ int main(int argc, char *argv[])
227256
protonect_shutdown = protonect_shutdown || viewer.render();
228257
#endif
229258

259+
/// [loop end]
230260
listener.release(frames);
231-
//libfreenect2::this_thread::sleep_for(libfreenect2::chrono::milliseconds(100));
261+
/** libfreenect2::this_thread::sleep_for(libfreenect2::chrono::milliseconds(100)); */
232262
}
263+
/// [loop end]
233264

234265
// TODO: restarting ir stream doesn't work!
235266
// TODO: bad things will happen, if frame listeners are freed before dev->stop() :(
267+
/// [stop]
236268
dev->stop();
237269
dev->close();
270+
/// [stop]
238271

239272
delete registration;
240273

0 commit comments

Comments
 (0)