Skip to content

Commit d47cc0b

Browse files
author
pradeep
committed
Add, refactor & cleanup documentation
1 parent 938b452 commit d47cc0b

13 files changed

Lines changed: 65 additions & 53 deletions

File tree

include/ComputeCopy.h

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -49,17 +49,20 @@ extern "C" {
4949
#endif
5050

5151

52-
/** A backend-agnostic handle to a compute memory resource originating from an OpenGL resource.
53-
54-
- cudaGraphicsResource in CUDA
55-
- cl_mem in OpenCL
56-
- unsigned from standard cpu
57-
*/
52+
/// A backend-agnostic handle to a compute memory resource originating
53+
/// from an OpenGL resource.
54+
///
55+
/// - cudaGraphicsResource in CUDA
56+
/// - cl_mem in OpenCL
57+
/// - unsigned from standard cpu
5858
#if defined(USE_FORGE_CPU_COPY_HELPERS)
59+
/// OpenGL interop with CPU uses regular OpenGL buffer
5960
typedef unsigned GfxResourceHandle;
6061
#elif defined(USE_FORGE_CUDA_COPY_HELPERS)
62+
/// OpenGL interop with CUDA uses an opaque CUDA object
6163
typedef cudaGraphicsResource* GfxResourceHandle;
6264
#elif defined(USE_FORGE_OPENCL_COPY_HELPERS)
65+
/// OpenGL interop with OpenCL uses cl_mem object
6366
typedef cl_mem GfxResourceHandle;
6467
#endif
6568

@@ -72,11 +75,13 @@ typedef cl_mem GfxResourceHandle;
7275
*/
7376
typedef void* ComputeResourceHandle;
7477

78+
/// Enum to indicate if OpenCL buffer is a PBO or VBO
7579
typedef enum {
7680
FORGE_IMAGE_BUFFER = 0, ///< OpenGL Pixel Buffer Object
7781
FORGE_VERTEX_BUFFER = 1 ///< OpenGL Vertex Buffer Object
7882
} BufferType;
7983

84+
/// A tuple object of GfxResourceHandle and \ref BufferType
8085
typedef struct {
8186
GfxResourceHandle mId;
8287
BufferType mTarget;

include/fg/chart.h

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -80,8 +80,6 @@ FGAPI fg_err fg_set_chart_axes_titles(fg_chart pHandle,
8080
\param[in] pYmax is y-axis maximum data value
8181
\param[in] pZmin is z-axis minimum data value
8282
\param[in] pZmax is z-axis maximum data value
83-
84-
\ingroup chart_functions
8583
*/
8684
FGAPI fg_err fg_set_chart_axes_limits(fg_chart pHandle,
8785
const float pXmin, const float pXmax,
@@ -111,8 +109,6 @@ FGAPI fg_err fg_set_chart_label_format(fg_chart pHandle, const char* pXFormat,
111109
\param[out] pZmin is z-axis minimum data value
112110
\param[out] pZmax is z-axis maximum data value
113111
\param[in] pHandle is chart handle
114-
115-
\ingroup chart_functions
116112
*/
117113
FGAPI fg_err fg_get_chart_axes_limits(float* pXmin, float* pXmax,
118114
float* pYmin, float* pYmax,
@@ -305,8 +301,6 @@ namespace forge
305301
{
306302

307303
/**
308-
\class Chart
309-
310304
\brief Chart is base canvas where other plottable objects are rendered.
311305
312306
Charts come in two types:

include/fg/defines.h

Lines changed: 27 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -34,15 +34,31 @@
3434

3535
#include <cstdlib>
3636

37+
/// \brief Window handle
3738
typedef void* fg_window;
39+
40+
/// \brief Font handle
3841
typedef void* fg_font;
42+
43+
/// \brief Chart handle
3944
typedef void* fg_chart;
45+
46+
/// \brief Image handle
4047
typedef void* fg_image;
48+
49+
/// \brief Histogram handle
4150
typedef void* fg_histogram;
51+
52+
/// \brief Plot handle
4253
typedef void* fg_plot;
54+
55+
/// \brief Surface handle
4356
typedef void* fg_surface;
57+
58+
/// \brief Vector Field handle
4459
typedef void* fg_vector_field;
4560

61+
/// \brief Return Error Codes for Forge C API
4662
typedef enum {
4763
FG_ERR_NONE = 0, ///< Fuction returned successfully.
4864
/*
@@ -102,6 +118,7 @@ typedef enum {
102118
FG_ERR_UNKNOWN = 9003 ///< Unkown error
103119
} fg_err;
104120

121+
/// \brief Image Channel Formats
105122
typedef enum {
106123
FG_GRAYSCALE = 100, ///< Single channel
107124
FG_RG = 200, ///< Three(Red, Green & Blue) channels
@@ -111,14 +128,13 @@ typedef enum {
111128
FG_BGRA = 401 ///< Four(Red, Green, Blue & Alpha) channels
112129
} fg_channel_format;
113130

131+
/// \brief Chart dimensionality i.e. 2D or 3D
114132
typedef enum {
115133
FG_CHART_2D = 2, ///< Two dimensional charts
116134
FG_CHART_3D = 3 ///< Three dimensional charts
117135
} fg_chart_type;
118136

119-
/**
120-
Color maps
121-
*/
137+
/// \brief Color Maps
122138
typedef enum {
123139
FG_COLOR_MAP_DEFAULT = 0, ///< Default [0-255] grayscale colormap
124140
FG_COLOR_MAP_SPECTRUM = 1, ///< Visual spectrum (390nm-830nm) in sRGB colorspace
@@ -133,6 +149,7 @@ typedef enum {
133149
FG_COLOR_MAP_VIRIDIS = 10, ///< perceptually uniform shades of blue-green-yellow
134150
} fg_color_map;
135151

152+
/// \brief Color Constants
136153
typedef enum {
137154
FG_RED = 0xFF0000FF,
138155
FG_GREEN = 0x00FF00FF,
@@ -144,6 +161,7 @@ typedef enum {
144161
FG_BLACK = 0x000000FF
145162
} fg_color;
146163

164+
/// \brief Enum representation of internal data types
147165
typedef enum {
148166
FG_INT8 = 0, ///< Signed byte (8-bits)
149167
FG_UINT8 = 1, ///< Unsigned byte (8-bits)
@@ -154,12 +172,14 @@ typedef enum {
154172
FG_UINT16 = 6 ///< Unsigned integer (16-bits)
155173
} fg_dtype;
156174

175+
/// \brief Plot Style
157176
typedef enum {
158177
FG_PLOT_LINE = 0, ///< Line plot
159178
FG_PLOT_SCATTER = 1, ///< Scatter plot
160179
FG_PLOT_SURFACE = 2 ///< Surface plot
161180
} fg_plot_type;
162181

182+
/// \brief Markers rendered as sprites
163183
typedef enum {
164184
FG_MARKER_NONE = 0, ///< No marker
165185
FG_MARKER_POINT = 1, ///< Point marker
@@ -172,8 +192,9 @@ typedef enum {
172192
} fg_marker_type;
173193

174194
#ifdef __cplusplus
175-
namespace forge
176-
{
195+
196+
/// \brief Forge API namespace
197+
namespace forge {
177198
typedef fg_err ErrorCode;
178199
typedef fg_channel_format ChannelFormat;
179200
typedef fg_chart_type ChartType;
@@ -182,6 +203,7 @@ namespace forge
182203
typedef fg_plot_type PlotType;
183204
typedef fg_marker_type MarkerType;
184205

206+
/// \brief Alias Enum to \ref fg_dtype enum
185207
typedef enum {
186208
s8 = FG_INT8,
187209
u8 = FG_UINT8,

include/fg/exception.h

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
namespace forge
1919
{
2020

21+
/// \brief Error is exception object thrown by forge for internal errors
2122
class FGAPI Error : public std::exception
2223
{
2324
private:
@@ -59,7 +60,18 @@ class FGAPI Error : public std::exception
5960
extern "C" {
6061
#endif
6162

63+
/**
64+
Fetch the last error's error code
65+
66+
\ingroup util_functions
67+
*/
6268
FGAPI void fg_get_last_error(char **msg, int *len);
69+
70+
/**
71+
Fetch the string message associated to given error code
72+
73+
\ingroup util_functions
74+
*/
6375
FGAPI const char * fg_err_to_string(const fg_err err);
6476

6577
#ifdef __cplusplus

include/fg/font.h

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -78,11 +78,7 @@ FGAPI fg_err fg_load_system_font(fg_font pFont, const char* const pFontName);
7878
namespace forge
7979
{
8080

81-
/**
82-
\class Font
83-
84-
\brief Font object is essentially a resource handler for the specific font you want to use
85-
*/
81+
/// \brief Font object is a resource handler for the font you want to use
8682
class Font {
8783
private:
8884
fg_font mValue;

include/fg/histogram.h

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -155,11 +155,7 @@ FGAPI fg_err fg_get_histogram_alpha_buffer_size(unsigned* pOut, const fg_histogr
155155
namespace forge
156156
{
157157

158-
/**
159-
\class Histogram
160-
161-
\brief Histogram is a bar graph to display data frequencey.
162-
*/
158+
/// \brief Histogram is a bar graph to display data frequencey.
163159
class Histogram {
164160
private:
165161
fg_histogram mValue;

include/fg/image.h

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -166,11 +166,7 @@ namespace forge
166166

167167
class Window;
168168

169-
/**
170-
\class Image
171-
172-
\brief Image is plain rendering of an image over the window or sub-region of it.
173-
*/
169+
/// \brief Image helps rendering an image in a window
174170
class Image {
175171
private:
176172
fg_image mValue;

include/fg/plot.h

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -190,11 +190,7 @@ FGAPI fg_err fg_get_plot_radii_buffer_size(unsigned* pOut, const fg_plot pPlot);
190190
namespace forge
191191
{
192192

193-
/**
194-
\class Plot
195-
196-
\brief Plot is a line graph to display two dimensional data.
197-
*/
193+
/// \brief Plot is a line graph to display two dimensional data.
198194
class Plot {
199195
private:
200196
fg_plot mValue;

include/fg/surface.h

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -155,11 +155,7 @@ FGAPI fg_err fg_get_surface_alpha_buffer_size(unsigned* pOut, const fg_surface p
155155
namespace forge
156156
{
157157

158-
/**
159-
\class Surface
160-
161-
\brief Surface is a graph to display three dimensional data.
162-
*/
158+
/// \brief Surface is a graph to display three dimensional data.
163159
class Surface {
164160
private:
165161
fg_surface mValue;

include/fg/update_buffer.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,8 @@ namespace forge
6868
\param[in] pBufferId is the buffer identifier
6969
\param[in] pBufferSize is the buffer size in bytes
7070
\param[in] pBufferData is the pointer of the host side memory
71+
72+
\ingroup util_functions
7173
*/
7274
FGAPI void updateVertexBuffer(const unsigned pBufferId,
7375
const size_t pBufferSize,
@@ -79,13 +81,17 @@ FGAPI void updateVertexBuffer(const unsigned pBufferId,
7981
\param[in] pBufferId is the buffer identifier
8082
\param[in] pBufferSize is the buffer size in bytes
8183
\param[in] pBufferData is the pointer of the host side memory
84+
85+
\ingroup util_functions
8286
*/
8387
FGAPI void updatePixelBuffer(const unsigned pBufferId,
8488
const size_t pBufferSize,
8589
const void* pBufferData);
8690

8791
/**
8892
Sync all rendering operations till this point
93+
94+
\ingroup util_functions
8995
*/
9096
FGAPI void finish();
9197

0 commit comments

Comments
 (0)