Changes to support dynamic config.

git-svn-id: http://svn.zoneminder.com/svn/zm/trunk@589 e3e1d417-86f3-4887-817a-d78f3d33393f
This commit is contained in:
stan 2003-07-03 22:07:31 +00:00
parent 16d338b2ab
commit 9c3bf369c0
4 changed files with 75 additions and 13 deletions

View File

@ -11,7 +11,7 @@ webgroup = @WEB_GROUP@
bin_PROGRAMS = zmc zma zmu zms zmf zmfix
zm_SOURCES = zm.cpp zm_db.cpp zm_coord.cpp zm_box.cpp zm_image.cpp zm_event.cpp zm_zone.cpp zm_camera.cpp zm_local_camera.cpp zm_remote_camera.cpp zm_monitor.cpp zm_debug.c zm_jpeg.c
zm_SOURCES = zm.cpp zm_db.cpp zm_config.cpp zm_coord.cpp zm_box.cpp zm_image.cpp zm_event.cpp zm_zone.cpp zm_camera.cpp zm_local_camera.cpp zm_remote_camera.cpp zm_monitor.cpp zm_debug.c zm_jpeg.c
zmc_SOURCES = zmc.cpp $(zm_SOURCES)
zma_SOURCES = zma.cpp $(zm_SOURCES)
zms_SOURCES = zms.cpp $(zm_SOURCES)

View File

@ -128,7 +128,7 @@ webgroup = @WEB_GROUP@
bin_PROGRAMS = zmc zma zmu zms zmf zmfix
zm_SOURCES = zm.cpp zm_db.cpp zm_coord.cpp zm_box.cpp zm_image.cpp zm_event.cpp zm_zone.cpp zm_camera.cpp zm_local_camera.cpp zm_remote_camera.cpp zm_monitor.cpp zm_debug.c zm_jpeg.c
zm_SOURCES = zm.cpp zm_db.cpp zm_config.cpp zm_coord.cpp zm_box.cpp zm_image.cpp zm_event.cpp zm_zone.cpp zm_camera.cpp zm_local_camera.cpp zm_remote_camera.cpp zm_monitor.cpp zm_debug.c zm_jpeg.c
zmc_SOURCES = zmc.cpp $(zm_SOURCES)
zma_SOURCES = zma.cpp $(zm_SOURCES)
zms_SOURCES = zms.cpp $(zm_SOURCES)
@ -147,11 +147,11 @@ bin_PROGRAMS = zmc$(EXEEXT) zma$(EXEEXT) zmu$(EXEEXT) zms$(EXEEXT) \
zmf$(EXEEXT) zmfix$(EXEEXT)
PROGRAMS = $(bin_PROGRAMS)
am__objects_1 = zm.$(OBJEXT) zm_db.$(OBJEXT) zm_coord.$(OBJEXT) \
zm_box.$(OBJEXT) zm_image.$(OBJEXT) zm_event.$(OBJEXT) \
zm_zone.$(OBJEXT) zm_camera.$(OBJEXT) zm_local_camera.$(OBJEXT) \
zm_remote_camera.$(OBJEXT) zm_monitor.$(OBJEXT) \
zm_debug.$(OBJEXT) zm_jpeg.$(OBJEXT)
am__objects_1 = zm.$(OBJEXT) zm_db.$(OBJEXT) zm_config.$(OBJEXT) \
zm_coord.$(OBJEXT) zm_box.$(OBJEXT) zm_image.$(OBJEXT) \
zm_event.$(OBJEXT) zm_zone.$(OBJEXT) zm_camera.$(OBJEXT) \
zm_local_camera.$(OBJEXT) zm_remote_camera.$(OBJEXT) \
zm_monitor.$(OBJEXT) zm_debug.$(OBJEXT) zm_jpeg.$(OBJEXT)
am_zma_OBJECTS = zma.$(OBJEXT) $(am__objects_1)
zma_OBJECTS = $(am_zma_OBJECTS)
zma_LDADD = $(LDADD)
@ -188,10 +188,10 @@ DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir)
depcomp = $(SHELL) $(top_srcdir)/depcomp
am__depfiles_maybe = depfiles
@AMDEP_TRUE@DEP_FILES = ./$(DEPDIR)/zm.Po ./$(DEPDIR)/zm_box.Po \
@AMDEP_TRUE@ ./$(DEPDIR)/zm_camera.Po ./$(DEPDIR)/zm_coord.Po \
@AMDEP_TRUE@ ./$(DEPDIR)/zm_db.Po ./$(DEPDIR)/zm_debug.Po \
@AMDEP_TRUE@ ./$(DEPDIR)/zm_event.Po ./$(DEPDIR)/zm_image.Po \
@AMDEP_TRUE@ ./$(DEPDIR)/zm_jpeg.Po \
@AMDEP_TRUE@ ./$(DEPDIR)/zm_camera.Po ./$(DEPDIR)/zm_config.Po \
@AMDEP_TRUE@ ./$(DEPDIR)/zm_coord.Po ./$(DEPDIR)/zm_db.Po \
@AMDEP_TRUE@ ./$(DEPDIR)/zm_debug.Po ./$(DEPDIR)/zm_event.Po \
@AMDEP_TRUE@ ./$(DEPDIR)/zm_image.Po ./$(DEPDIR)/zm_jpeg.Po \
@AMDEP_TRUE@ ./$(DEPDIR)/zm_local_camera.Po \
@AMDEP_TRUE@ ./$(DEPDIR)/zm_monitor.Po \
@AMDEP_TRUE@ ./$(DEPDIR)/zm_remote_camera.Po \
@ -276,6 +276,7 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/zm.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/zm_box.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/zm_camera.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/zm_config.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/zm_coord.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/zm_db.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/zm_debug.Po@am__quote@

View File

@ -22,10 +22,11 @@
extern "C"
{
#include "zm_config.h"
#include "zm_debug.h"
}
#include "zm_config.h"
// Structure used for storing the results of the subtraction
// of one struct timeval from another

View File

@ -18,6 +18,7 @@
//
#include "config.h"
#include "zm_config_defines.h"
#define ZM_VERSION "<from zmconfig>" // ZoneMinder verson number
#define ZM_DB_SERVER "<from zmconfig>" // Machine on which the database server is running
@ -27,7 +28,6 @@
#define ZM_DB_USERB "<from zmconfig>" // Unprivileged DB user name, need just select privilege.
#define ZM_DB_PASSB "<from zmconfig>" // Unprivileged DB user password
#define ZM_OPT_USE_AUTH "<from zmconfig>" // Authenticate user logins to ZoneMinder
#define ZM_HTTP_VERSION "<from zmconfig>" // The version of HTTP that ZoneMinder will use to connect
#define ZM_HTTP_UA "<from zmconfig>" // The user agent that ZoneMinder uses to identify itself
#define ZM_HTTP_TIMEOUT <from zmconfig> // How long ZoneMinder waits before giving up on images (millseconds)
@ -61,3 +61,63 @@
#define ZM_MAX_IMAGE_COLOURS 3 // The largest image we imagine ever handling
#define ZM_MAX_IMAGE_DIM (ZM_MAX_IMAGE_WIDTH*ZM_MAX_IMAGE_HEIGHT)
#define ZM_MAX_IMAGE_SIZE (ZM_MAX_IMAGE_DIM*ZM_MAX_IMAGE_COLOURS)
class ConfigItem
{
private:
char *name;
char *value;
char *type;
mutable enum { CFG_BOOLEAN, CFG_INTEGER, CFG_DECIMAL, CFG_STRING } cfg_type;
mutable union
{
bool boolean_value;
int integer_value;
double decimal_value;
char *string_value;
} cfg_value;
mutable bool accessed;
public:
ConfigItem( const char *p_name, const char *p_value, const char *const p_type );
~ConfigItem();
void ConvertValue() const;
bool BooleanValue() const;
int IntegerValue() const;
double DecimalValue() const;
const char *StringValue() const;
inline operator bool() const
{
return( BooleanValue() );
}
inline operator int() const
{
return( IntegerValue() );
}
inline operator double() const
{
return( DecimalValue() );
}
inline operator const char *() const
{
return( StringValue() );
}
};
class Config
{
private:
int n_items;
ConfigItem **items;
public:
Config();
~Config();
void Load();
const ConfigItem &GetItem( int id );
};
extern Config config;