diff options
author | Matthias Vogelgesang <matthias.vogelgesang@gmail.com> | 2012-06-12 10:21:55 +0200 |
---|---|---|
committer | Matthias Vogelgesang <matthias.vogelgesang@gmail.com> | 2012-06-12 10:21:55 +0200 |
commit | 580dae2183e27ccec00f127b85188df143f49c54 (patch) | |
tree | 35e43a1587a8b624218006e2e41d73c28dd1b160 /src/cameras | |
parent | 733da14c66d347bb2ae452766a36bf3c1381cacd (diff) | |
download | uca-580dae2183e27ccec00f127b85188df143f49c54.tar.gz uca-580dae2183e27ccec00f127b85188df143f49c54.tar.bz2 uca-580dae2183e27ccec00f127b85188df143f49c54.tar.xz uca-580dae2183e27ccec00f127b85188df143f49c54.zip |
Generate enum types from source
It became a little unwieldy to create the enum types manually via
g_enums_register_static(). This changeset creates the types from enum
definitions in public headers using glib2-mkenum.
Be sure to include uca-enums.h in every source file that needs to know GObject
enum type.
Diffstat (limited to 'src/cameras')
-rw-r--r-- | src/cameras/uca-pco-camera.c | 59 | ||||
-rw-r--r-- | src/cameras/uca-pco-camera.h | 4 |
2 files changed, 14 insertions, 49 deletions
diff --git a/src/cameras/uca-pco-camera.c b/src/cameras/uca-pco-camera.c index bba69c2..d12083f 100644 --- a/src/cameras/uca-pco-camera.c +++ b/src/cameras/uca-pco-camera.c @@ -24,6 +24,7 @@ #include <fgrab_prototyp.h> #include "uca-camera.h" #include "uca-pco-camera.h" +#include "uca-enums.h" #define FG_TRY_PARAM(fg, camobj, param, val_addr, port) \ { int r = Fg_setParameter(fg, param, val_addr, port); \ @@ -58,6 +59,19 @@ G_DEFINE_TYPE(UcaPcoCamera, uca_pco_camera, UCA_TYPE_CAMERA) #define TIMEBASE_INVALID 0xDEAD /** + * UcaPcoCameraRecordMode: + * @UCA_PCO_CAMERA_RECORD_MODE_SEQUENCE: Store all frames and stop if necessary + * @UCA_PCO_CAMERA_RECORD_MODE_RING_BUFFER: Store frames in ring-buffer fashion + * and overwrite if necessary + */ + +/** + * UcaPcoCameraAcquireMode: + * @UCA_PCO_CAMERA_ACQUIRE_MODE_AUTO: Take all images + * @UCA_PCO_CAMERA_ACQUIRE_MODE_EXTERNAL: Use <acq enbl> signal + */ + +/** * UcaPcoCameraError: * @UCA_PCO_CAMERA_ERROR_LIBPCO_INIT: Initializing libpco failed * @UCA_PCO_CAMERA_ERROR_LIBPCO_GENERAL: General libpco error @@ -156,51 +170,6 @@ struct _UcaPcoCameraPrivate { guint current_image; }; -/** - * UcaPcoCameraRecordMode: - * @UCA_PCO_CAMERA_RECORD_MODE_SEQUENCE: Store all frames and stop if necessary - * @UCA_PCO_CAMERA_RECORD_MODE_RING_BUFFER: Store frames in ring-buffer fashion - * and overwrite if necessary - */ -static GType uca_pco_camera_record_mode_get_type(void) -{ - static GType record_mode_type = 0; - - if (!record_mode_type) { - static GEnumValue record_modes[] = { - { UCA_PCO_CAMERA_RECORD_MODE_SEQUENCE, "Store frames in a ring buffer", "ring-buffer" }, - { UCA_PCO_CAMERA_RECORD_MODE_RING_BUFFER, "Store frames in a sequence", "sequence" }, - { 0, NULL, NULL } - }; - - record_mode_type = g_enum_register_static("UcaPcoCameraRecordMode", record_modes); - } - - return record_mode_type; -} - -/** - * UcaPcoCameraAcquireMode: - * @UCA_PCO_CAMERA_ACQUIRE_MODE_AUTO: Take all images - * @UCA_PCO_CAMERA_ACQUIRE_MODE_EXTERNAL: Use <acq enbl> signal - */ -static GType uca_pco_camera_acquire_mode_get_type(void) -{ - static GType acquire_mode_type = 0; - - if (!acquire_mode_type) { - static GEnumValue acquire_modes[] = { - { UCA_PCO_CAMERA_ACQUIRE_MODE_AUTO, "Take all images", "auto" }, - { UCA_PCO_CAMERA_ACQUIRE_MODE_EXTERNAL, "Use <acq enbl> signal", "external" }, - { 0, NULL, NULL } - }; - - acquire_mode_type = g_enum_register_static("UcaPcoCameraAcquireMode", acquire_modes); - } - - return acquire_mode_type; -} - static pco_cl_map_entry pco_cl_map[] = { { CAMERATYPE_PCO_EDGE, "libFullAreaGray8.so", FG_CL_8BIT_FULL_10, FG_GRAY, 30.0f, FALSE }, { CAMERATYPE_PCO4000, "libDualAreaGray16.so", FG_CL_SINGLETAP_16_BIT, FG_GRAY16, 5.0f, TRUE }, diff --git a/src/cameras/uca-pco-camera.h b/src/cameras/uca-pco-camera.h index 243fac4..d2892b2 100644 --- a/src/cameras/uca-pco-camera.h +++ b/src/cameras/uca-pco-camera.h @@ -42,15 +42,11 @@ typedef struct _UcaPcoCamera UcaPcoCamera; typedef struct _UcaPcoCameraClass UcaPcoCameraClass; typedef struct _UcaPcoCameraPrivate UcaPcoCameraPrivate; -#define UCA_TYPE_PCO_CAMERA_RECORD_MODE (uca_pco_camera_record_mode_get_type()) - typedef enum { UCA_PCO_CAMERA_RECORD_MODE_SEQUENCE, UCA_PCO_CAMERA_RECORD_MODE_RING_BUFFER, } UcaPcoCameraRecordMode; -#define UCA_TYPE_PCO_CAMERA_ACQUIRE_MODE (uca_pco_camera_acquire_mode_get_type()) - typedef enum { UCA_PCO_CAMERA_ACQUIRE_MODE_AUTO, UCA_PCO_CAMERA_ACQUIRE_MODE_EXTERNAL |