#include <glib.h>#include "scbpoint.h"

Go to the source code of this file.
Classes | |
| struct | _ScbPoints |
Typedefs | |
| typedef struct _ScbPoints | ScbPoints |
| typedef ScbPoints * | ScbPointsPtr |
Functions | |
| gboolean | scb_points_new (ScbPointsPtr points, const int initSize) |
| void | scb_points_free (ScbPointsPtr points) |
| void | scb_points_append (ScbPointsPtr points, ScbDevPointPtr point) |
| int | scb_points_get_count (ScbPointsPtr ptr) |
| ScbPointPtr | scb_points_get_data (ScbPointsPtr points) |
| void | scb_points_dump (ScbPointsPtr points) |
| typedef struct _ScbPoints ScbPoints |
Copyright (C) 2005-2008 iRex Technologies B.V. All rights reserved.
| typedef ScbPoints* ScbPointsPtr |
Definition at line 40 of file scbpoints.h.
| void scb_points_append | ( | ScbPointsPtr | points, | |
| ScbDevPointPtr | point | |||
| ) |
Definition at line 64 of file scbpoints.c.
00065 { 00066 // check 00067 SCB_RET_IF(NULL == points || NULL == point, "Invalid pointer(s)!"); 00068 00069 // by value. they are binary compatible 00070 g_array_append_val(points->points, *((ScbPointPtr)point)); 00071 g_array_append_val(points->pressures, point->pressure); 00072 }
| void scb_points_dump | ( | ScbPointsPtr | points | ) |
Definition at line 93 of file scbpoints.c.
00094 { 00095 ScbPointPtr point = scb_points_get_data(ptr); 00096 SCB_RET_IF(NULL == point, ""); 00097 00098 int len = scb_points_get_count(ptr); 00099 SCB_DUMP("points count %d. data:", len); 00100 while (len > 0) 00101 { 00102 SCB_DUMP("(%d, %d)", point->x, point->y); 00103 ++point; --len; 00104 } 00105 }

| void scb_points_free | ( | ScbPointsPtr | points | ) |
Definition at line 52 of file scbpoints.c.
00053 { 00054 SCB_RET_IF(NULL == ptr, "Try to release NULL pointer!"); 00055 00056 g_array_free(ptr->points, TRUE); 00057 g_array_free(ptr->pressures, TRUE); 00058 ptr->points = NULL; 00059 ptr->pressures = NULL; 00060 }
| int scb_points_get_count | ( | ScbPointsPtr | ptr | ) |
Definition at line 76 of file scbpoints.c.
00077 { 00078 SCB_RET_INT_IF(NULL == ptr, SCB_INVALID_COUNT, "Attempt to access NULL pointer!"); 00079 SCB_RET_INT_IF(NULL == ptr->points, SCB_INVALID_COUNT, "Point array is not allocated!"); 00080 // lengthes are equal 00081 return ptr->points->len; 00082 }
| ScbPointPtr scb_points_get_data | ( | ScbPointsPtr | points | ) |
Definition at line 86 of file scbpoints.c.
00087 { 00088 SCB_RET_NULL_IF(NULL == ptr || NULL == ptr->points, "NULL pointer(s)"); 00089 return (ScbPointPtr)ptr->points->data; 00090 }
| gboolean scb_points_new | ( | ScbPointsPtr | ptr, | |
| const int | initSize | |||
| ) |
Copyright (C) 2005-2008 iRex Technologies B.V. All rights reserved.
Definition at line 32 of file scbpoints.c.
00033 { 00034 SCB_RET_FALSE_IF(NULL == ptr, "Invalid pointer!"); 00035 SCB_RET_FALSE_IF(initSize <= 0, "Invalid initial size!"); 00036 00037 ptr->points = g_array_sized_new(FALSE, TRUE, sizeof(ScbPoint), initSize); 00038 00039 SCB_RET_FALSE_IF(NULL == ptr->points, "Could not allocate enough memory!"); 00040 ptr->pressures = g_array_sized_new(FALSE, TRUE, sizeof(int), initSize); 00041 00042 if (NULL == ptr->pressures) 00043 { 00044 g_free(ptr->points); ptr->points = NULL; 00045 return FALSE; 00046 } 00047 return TRUE; 00048 }
1.5.6