2005-12-16 18:16:29 +08:00
|
|
|
//
|
|
|
|
// ZoneMinder Configuration, $Date$, $Revision$
|
2006-01-17 18:56:30 +08:00
|
|
|
// Copyright (C) 2003, 2004, 2005, 2006 Philip Coombes
|
2005-12-16 18:16:29 +08:00
|
|
|
//
|
|
|
|
// This program is free software; you can redistribute it and/or
|
|
|
|
// modify it under the terms of the GNU General Public License
|
|
|
|
// as published by the Free Software Foundation; either version 2
|
|
|
|
// of the License, or (at your option) any later version.
|
|
|
|
//
|
|
|
|
// This program is distributed in the hope that it will be useful,
|
|
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
// GNU General Public License for more details.
|
|
|
|
//
|
|
|
|
// You should have received a copy of the GNU General Public License
|
|
|
|
// along with this program; if not, write to the Free Software
|
|
|
|
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|
|
|
//
|
|
|
|
|
|
|
|
#include "config.h"
|
|
|
|
#include "zm_config_defines.h"
|
|
|
|
|
|
|
|
#define ZM_CONFIG "@ZM_CONFIG@" // Path to config file
|
|
|
|
#define ZM_VERSION "@VERSION@" // ZoneMinder Version
|
|
|
|
|
|
|
|
#define ZM_MAX_IMAGE_WIDTH 2048 // The largest image we imagine ever handling
|
|
|
|
#define ZM_MAX_IMAGE_HEIGHT 1536 // The largest image we imagine ever handling
|
|
|
|
#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)
|
|
|
|
|
2007-08-30 02:11:09 +08:00
|
|
|
#define ZM_SCALE_BASE 100 // The factor by which we bump up 'scale' to simulate FP
|
|
|
|
#define ZM_RATE_BASE 100 // The factor by which we bump up 'rate' to simulate FP
|
2005-12-16 18:16:29 +08:00
|
|
|
|
|
|
|
#define ZM_MAX_FPS 30 // The maximum frame rate we expect to handle
|
|
|
|
#define ZM_SAMPLE_RATE int(1000000/ZM_MAX_FPS) // A general nyquist sample frequency for delays etc
|
2005-12-23 00:46:25 +08:00
|
|
|
#define ZM_SUSPENDED_RATE int(1000000/4) // A slower rate for when disabled etc
|
2005-12-16 18:16:29 +08:00
|
|
|
|
|
|
|
extern char *ZM_DB_HOST, *ZM_DB_NAME, *ZM_DB_USER, *ZM_DB_PASS, *ZM_PATH_WEB;
|
|
|
|
extern void zmLoadConfig();
|
|
|
|
|
|
|
|
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
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
ZM_CFG_DECLARE_LIST
|
|
|
|
|
|
|
|
private:
|
|
|
|
int n_items;
|
|
|
|
ConfigItem **items;
|
|
|
|
|
|
|
|
public:
|
|
|
|
Config();
|
|
|
|
~Config();
|
|
|
|
|
|
|
|
void Load();
|
|
|
|
void Assign();
|
|
|
|
const ConfigItem &Item( int id );
|
|
|
|
};
|
|
|
|
|
|
|
|
extern Config config;
|