Skip to content

Commit

Permalink
rename types enum
Browse files Browse the repository at this point in the history
  • Loading branch information
9prady9 committed Mar 25, 2016
1 parent e912de2 commit b5f891a
Show file tree
Hide file tree
Showing 22 changed files with 60 additions and 47 deletions.
4 changes: 2 additions & 2 deletions examples/cpu/bubblechart.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -79,9 +79,9 @@ int main(void)
/* Create several plot objects which creates the necessary
* vertex buffer objects to hold the different plot types
*/
fg::Plot plt1 = chart.plot(cosData.size()/2, f32,
fg::Plot plt1 = chart.plot(cosData.size()/2, fg::f32,
FG_PLOT_LINE, FG_MARKER_TRIANGLE); //or specify a specific plot type
fg::Plot plt2 = chart.plot(tanData.size()/2, f32,
fg::Plot plt2 = chart.plot(tanData.size()/2, fg::f32,
FG_PLOT_LINE, FG_MARKER_CIRCLE); //last parameter specifies marker shape

/* Set plot colors */
Expand Down
2 changes: 1 addition & 1 deletion examples/cpu/fractal.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ int main(void)
/* Create an image object which creates the necessary
* textures and pixel buffer objects to hold the image
* */
fg::Image img(DIMX, DIMY, FG_RGBA, u8);
fg::Image img(DIMX, DIMY, FG_RGBA, fg::u8);
/* copy your data into the pixel buffer object exposed by
* fg::Image class and then proceed to rendering.
* To help the users with copying the data from compute
Expand Down
4 changes: 2 additions & 2 deletions examples/cpu/histogram.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ int main(void)
*/
wnd.grid(WIN_ROWS, WIN_COLS);

fg::Image img(IMGW, IMGH, FG_RGBA, u8);
fg::Image img(IMGW, IMGH, FG_RGBA, fg::u8);

fg::Chart chart(FG_CHART_2D);
/* set x axis limits to maximum and minimum values of data
Expand All @@ -79,7 +79,7 @@ int main(void)
/*
* Create histogram object specifying number of bins
*/
fg::Histogram hist = chart.histogram(NBINS, s32);
fg::Histogram hist = chart.histogram(NBINS, fg::s32);
/*
* Set histogram colors
*/
Expand Down
2 changes: 1 addition & 1 deletion examples/cpu/plot3.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ int main(void)
chart.setAxesLimits(-1.1f, 1.1f, -1.1f, 1.1f, 0.f, 10.f);
chart.setAxesTitles("x-axis", "y-axis", "z-axis");

fg::Plot plot3 = chart.plot(ZSIZE, f32);
fg::Plot plot3 = chart.plot(ZSIZE, fg::f32);

//generate a surface
std::vector<float> function;
Expand Down
8 changes: 4 additions & 4 deletions examples/cpu/plotting.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,10 @@ int main(void)
/* Create several plot objects which creates the necessary
* vertex buffer objects to hold the different plot types
*/
fg::Plot plt0 = chart.plot(sinData.size()/2, f32); //create a default plot
fg::Plot plt1 = chart.plot(cosData.size()/2, f32, FG_PLOT_LINE, FG_MARKER_NONE); //or specify a specific plot type
fg::Plot plt2 = chart.plot(tanData.size()/2, f32, FG_PLOT_LINE, FG_MARKER_TRIANGLE); //last parameter specifies marker shape
fg::Plot plt3 = chart.plot(logData.size()/2, f32, FG_PLOT_SCATTER, FG_MARKER_CROSS);
fg::Plot plt0 = chart.plot(sinData.size()/2, fg::f32); //create a default plot
fg::Plot plt1 = chart.plot(cosData.size()/2, fg::f32, FG_PLOT_LINE, FG_MARKER_NONE); //or specify a specific plot type
fg::Plot plt2 = chart.plot(tanData.size()/2, fg::f32, FG_PLOT_LINE, FG_MARKER_TRIANGLE); //last parameter specifies marker shape
fg::Plot plt3 = chart.plot(logData.size()/2, fg::f32, FG_PLOT_SCATTER, FG_MARKER_CROSS);

/*
* Set plot colors
Expand Down
2 changes: 1 addition & 1 deletion examples/cpu/surface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ int main(void)
chart.setAxesLimits(-10.f, 10.f, -10.f, 10.f, -0.5f, 1.f);
chart.setAxesTitles("x-axis", "y-axis", "z-axis");

fg::Surface surf = chart.surface(XSIZE, YSIZE, f32);
fg::Surface surf = chart.surface(XSIZE, YSIZE, fg::f32);
surf.setColor(FG_YELLOW);

//generate a surface
Expand Down
2 changes: 1 addition & 1 deletion examples/cuda/fractal.cu
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ int main(void)
/* Create an image object which creates the necessary
* textures and pixel buffer objects to hold the image
* */
fg::Image img(DIMX, DIMY, FG_RGBA, u8);
fg::Image img(DIMX, DIMY, FG_RGBA, fg::u8);
/* copy your data into the pixel buffer object exposed by
* fg::Image class and then proceed to rendering.
* To help the users with copying the data from compute
Expand Down
4 changes: 2 additions & 2 deletions examples/cuda/histogram.cu
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ int main(void)
*/
wnd.grid(WIN_ROWS, WIN_COLS);

fg::Image img(IMGW, IMGH, FG_RGBA, u8);
fg::Image img(IMGW, IMGH, FG_RGBA, fg::u8);

fg::Chart chart(FG_CHART_2D);
/* set x axis limits to maximum and minimum values of data
Expand All @@ -90,7 +90,7 @@ int main(void)
/*
* Create histogram object specifying number of bins
*/
fg::Histogram hist = chart.histogram(NBINS, s32);
fg::Histogram hist = chart.histogram(NBINS, fg::s32);
/*
* Set histogram colors
*/
Expand Down
2 changes: 1 addition & 1 deletion examples/cuda/plot3.cu
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ int main(void)
chart.setAxesLimits(-1.1f, 1.1f, -1.1f, 1.1f, 0.f, 10.f);
chart.setAxesTitles("x-axis", "y-axis", "z-axis");

fg::Plot plot3 = chart.plot(ZSIZE, f32);
fg::Plot plot3 = chart.plot(ZSIZE, fg::f32);

static float t=0;
FORGE_CUDA_CHECK(cudaMalloc((void**)&dev_out, ZSIZE * 3 * sizeof(float) ));
Expand Down
8 changes: 4 additions & 4 deletions examples/cuda/plotting.cu
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,10 @@ int main(void)
/* Create several plot objects which creates the necessary
* vertex buffer objects to hold the different plot types
*/
fg::Plot plt0 = chart.plot( DATA_SIZE, f32); //create a default plot
fg::Plot plt1 = chart.plot( DATA_SIZE, f32, FG_PLOT_LINE, FG_MARKER_NONE); //or specify a specific plot type
fg::Plot plt2 = chart.plot( DATA_SIZE, f32, FG_PLOT_LINE, FG_MARKER_TRIANGLE); //last parameter specifies marker shape
fg::Plot plt3 = chart.plot( DATA_SIZE, f32, FG_PLOT_SCATTER, FG_MARKER_CROSS);
fg::Plot plt0 = chart.plot( DATA_SIZE, fg::f32); //create a default plot
fg::Plot plt1 = chart.plot( DATA_SIZE, fg::f32, FG_PLOT_LINE, FG_MARKER_NONE); //or specify a specific plot type
fg::Plot plt2 = chart.plot( DATA_SIZE, fg::f32, FG_PLOT_LINE, FG_MARKER_TRIANGLE); //last parameter specifies marker shape
fg::Plot plt3 = chart.plot( DATA_SIZE, fg::f32, FG_PLOT_SCATTER, FG_MARKER_CROSS);

/*
* Set plot colors
Expand Down
2 changes: 1 addition & 1 deletion examples/cuda/surface.cu
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ int main(void)
chart.setAxesLimits(-10.f, 10.f, -10.f, 10.f, -0.5f, 1.f);
chart.setAxesTitles("x-axis", "y-axis", "z-axis");

fg::Surface surf = chart.surface(XSIZE, YSIZE, f32);
fg::Surface surf = chart.surface(XSIZE, YSIZE, fg::f32);
surf.setColor(FG_YELLOW);

FORGE_CUDA_CHECK(cudaMalloc((void**)&dev_out, XSIZE * YSIZE * 3 * sizeof(float) ));
Expand Down
2 changes: 1 addition & 1 deletion examples/opencl/fractal.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ int main(void)
/* Create an image object which creates the necessary
* textures and pixel buffer objects to hold the image
* */
fg::Image img(DIMX, DIMY, FG_RGBA, u8);
fg::Image img(DIMX, DIMY, FG_RGBA, fg::u8);


Platform plat = getPlatform();
Expand Down
4 changes: 2 additions & 2 deletions examples/opencl/histogram.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,7 @@ int main(void)
*/
wnd.grid(WIN_ROWS, WIN_COLS);

fg::Image img(IMGW, IMGH, FG_RGBA, u8);
fg::Image img(IMGW, IMGH, FG_RGBA, fg::u8);

fg::Chart chart(FG_CHART_2D);
/* set x axis limits to maximum and minimum values of data
Expand All @@ -285,7 +285,7 @@ int main(void)
/*
* Create histogram object specifying number of bins
*/
fg::Histogram hist = chart.histogram(NBINS, s32);
fg::Histogram hist = chart.histogram(NBINS, fg::s32);
/*
* Set histogram colors
*/
Expand Down
2 changes: 1 addition & 1 deletion examples/opencl/plot3.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ int main(void)
chart.setAxesLimits(-1.1f, 1.1f, -1.1f, 1.1f, 0.f, 10.f);
chart.setAxesTitles("x-axis", "y-axis", "z-axis");

fg::Plot plot3 = chart.plot(ZSIZE, f32);
fg::Plot plot3 = chart.plot(ZSIZE, fg::f32);

Platform plat = getPlatform();
// Select the default platform and create a context using this platform and the GPU
Expand Down
8 changes: 4 additions & 4 deletions examples/opencl/plotting.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -92,10 +92,10 @@ int main(void)
/* Create several plot objects which creates the necessary
* vertex buffer objects to hold the different plot types
*/
fg::Plot plt0 = chart.plot(DATA_SIZE, f32); //create a default plot
fg::Plot plt1 = chart.plot(DATA_SIZE, f32, FG_PLOT_LINE, FG_MARKER_NONE); //or specify a specific plot type
fg::Plot plt2 = chart.plot(DATA_SIZE, f32, FG_PLOT_LINE, FG_MARKER_TRIANGLE); //last parameter specifies marker shape
fg::Plot plt3 = chart.plot(DATA_SIZE, f32, FG_PLOT_SCATTER, FG_MARKER_CROSS);
fg::Plot plt0 = chart.plot(DATA_SIZE, fg::f32); //create a default plot
fg::Plot plt1 = chart.plot(DATA_SIZE, fg::f32, FG_PLOT_LINE, FG_MARKER_NONE); //or specify a specific plot type
fg::Plot plt2 = chart.plot(DATA_SIZE, fg::f32, FG_PLOT_LINE, FG_MARKER_TRIANGLE); //last parameter specifies marker shape
fg::Plot plt3 = chart.plot(DATA_SIZE, fg::f32, FG_PLOT_SCATTER, FG_MARKER_CROSS);

/*
* Set plot colors
Expand Down
2 changes: 1 addition & 1 deletion examples/opencl/surface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ int main(void)
chart.setAxesLimits(-10.f, 10.f, -10.f, 10.f, -0.5f, 1.f);
chart.setAxesTitles("x-axis", "y-axis", "z-axis");

fg::Surface surf = chart.surface(XSIZE, YSIZE, f32);
fg::Surface surf = chart.surface(XSIZE, YSIZE, fg::f32);
surf.setColor(FG_YELLOW);

Platform plat = getPlatform();
Expand Down
25 changes: 17 additions & 8 deletions include/fg/defines.h
Original file line number Diff line number Diff line change
Expand Up @@ -159,13 +159,13 @@ typedef enum {
} fg_color;

typedef enum {
s8 = 0, ///< Signed byte (8-bits)
u8 = 1, ///< Unsigned byte (8-bits)
s32 = 2, ///< Signed integer (32-bits)
u32 = 3, ///< Unsigned integer (32-bits)
f32 = 4, ///< Float (32-bits)
s16 = 5, ///< Signed integer (16-bits)
u16 = 6 ///< Unsigned integer (16-bits)
FG_INT8 = 0, ///< Signed byte (8-bits)
FG_UINT8 = 1, ///< Unsigned byte (8-bits)
FG_INT32 = 2, ///< Signed integer (32-bits)
FG_UINT32 = 3, ///< Unsigned integer (32-bits)
FG_FLOAT32 = 4, ///< Float (32-bits)
FG_INT16 = 5, ///< Signed integer (16-bits)
FG_UINT16 = 6 ///< Unsigned integer (16-bits)
} fg_dtype;

typedef enum {
Expand Down Expand Up @@ -194,8 +194,17 @@ namespace fg
typedef fg_chart_type ChartType;
typedef fg_color_map ColorMap;
typedef fg_color Color;
typedef fg_dtype dtype;
typedef fg_plot_type PlotType;
typedef fg_marker_type MarkerType;

typedef enum {
s8 = FG_INT8,
u8 = FG_UINT8,
s32 = FG_INT32,
u32 = FG_UINT32,
f32 = FG_FLOAT32,
s16 = FG_INT16,
u16 = FG_UINT16,
} dtype;
}
#endif
12 changes: 7 additions & 5 deletions src/api/c/chart.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ fg_err fg_add_image_to_chart(fg_image* pImage, fg_chart pHandle,
const fg_dtype pType)
{
try {
common::Image* img = new common::Image(pWidth, pHeight, pFormat, pType);
common::Image* img = new common::Image(pWidth, pHeight, pFormat, (fg::dtype)pType);
getChart(pHandle)->addRenderable(img->impl());
*pImage = getHandle(img);
}
Expand All @@ -102,7 +102,7 @@ fg_err fg_add_histogram_to_chart(fg_histogram* pHistogram, fg_chart pHandle,
common::Chart* chrt = getChart(pHandle);

if (chrt->chartType()== FG_CHART_2D) {
common::Histogram* hist = new common::Histogram(pNBins, pType);
common::Histogram* hist = new common::Histogram(pNBins, (fg::dtype)pType);
chrt->addRenderable(hist->impl());
*pHistogram = getHandle(hist);
} else {
Expand All @@ -124,11 +124,13 @@ fg_err fg_add_plot_to_chart(fg_plot* pPlot, fg_chart pHandle,
fg::ChartType ctype = chrt->chartType();

if (ctype == FG_CHART_2D) {
common::Plot* plt = new common::Plot(pNPoints, pType, pPlotType, pMarkerType, FG_CHART_2D);
common::Plot* plt = new common::Plot(pNPoints, (fg::dtype)pType, pPlotType,
pMarkerType, FG_CHART_2D);
chrt->addRenderable(plt->impl());
*pPlot = getHandle(plt);
} else {
common::Plot* plt = new common::Plot(pNPoints, pType, pPlotType, pMarkerType, FG_CHART_3D);
common::Plot* plt = new common::Plot(pNPoints, (fg::dtype)pType, pPlotType,
pMarkerType, FG_CHART_3D);
chrt->addRenderable(plt->impl());
*pPlot = getHandle(plt);
}
Expand All @@ -147,7 +149,7 @@ fg_err fg_add_surface_to_chart(fg_surface* pSurface, fg_chart pHandle,
fg::ChartType ctype = chrt->chartType();

if (ctype == FG_CHART_3D) {
common::Surface* surf = new common::Surface(pXPoints, pYPoints, pType,
common::Surface* surf = new common::Surface(pXPoints, pYPoints, (fg::dtype)pType,
pPlotType, pMarkerType);
chrt->addRenderable(surf->impl());
*pSurface = getHandle(surf);
Expand Down
2 changes: 1 addition & 1 deletion src/api/c/histogram.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ fg_err fg_create_histogram(fg_histogram *pHistogram,
const uint pNBins, const fg_dtype pType)
{
try {
*pHistogram = getHandle(new common::Histogram(pNBins, pType));
*pHistogram = getHandle(new common::Histogram(pNBins, (fg::dtype)pType));
}
CATCHALL

Expand Down
4 changes: 2 additions & 2 deletions src/api/c/image.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ fg_err fg_create_image(fg_image* pImage,
const fg_channel_format pFormat, const fg_dtype pType)
{
try {
*pImage = getHandle(new common::Image(pWidth, pHeight, pFormat, pType));
*pImage = getHandle(new common::Image(pWidth, pHeight, pFormat, (fg::dtype)pType));
}
CATCHALL

Expand Down Expand Up @@ -93,7 +93,7 @@ fg_err fg_get_image_pixelformat(fg_channel_format* pOut, const fg_image pImage)
fg_err fg_get_image_type(fg_dtype* pOut, const fg_image pImage)
{
try {
*pOut = getImage(pImage)->channelType();
*pOut = (fg_dtype)(getImage(pImage)->channelType());
}
CATCHALL

Expand Down
3 changes: 2 additions & 1 deletion src/api/c/plot.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ fg_err fg_create_plot(fg_plot *pPlot,
const fg_marker_type pMarkerType)
{
try {
*pPlot = getHandle(new common::Plot(pNPoints, pType, pPlotType, pMarkerType, pChartType));
*pPlot = getHandle(new common::Plot(pNPoints, (fg::dtype)pType, pPlotType,
pMarkerType, pChartType));
}
CATCHALL

Expand Down
3 changes: 2 additions & 1 deletion src/api/c/surface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ fg_err fg_create_surface(fg_surface *pSurface,
const fg_marker_type pMarkerType)
{
try {
*pSurface = getHandle(new common::Surface(pXPoints, pYPoints, pType, pPlotType, pMarkerType));
*pSurface = getHandle(new common::Surface(pXPoints, pYPoints, (fg::dtype)pType,
pPlotType, pMarkerType));
}
CATCHALL

Expand Down

0 comments on commit b5f891a

Please sign in to comment.