simplify ConfigureDecl etc.

This commit is contained in:
David Rose 2009-06-15 22:25:52 +00:00
parent d2aa0ecba4
commit cbfa38d2b5
27 changed files with 80 additions and 752 deletions

View File

@ -7,6 +7,7 @@
prc:c pstatclient:c pandabase:c linmath:c putil:c \ prc:c pstatclient:c pandabase:c linmath:c putil:c \
pipeline:c \ pipeline:c \
$[if $[HAVE_NET],net:c] $[if $[WANT_NATIVE_NET],nativenet:c] \ $[if $[HAVE_NET],net:c] $[if $[WANT_NATIVE_NET],nativenet:c] \
panda:m \
pystub pystub
#define C++FLAGS -DWITHIN_PANDA #define C++FLAGS -DWITHIN_PANDA
@ -17,5 +18,6 @@
#define SOURCES \ #define SOURCES \
dcparse.cxx dcparse.cxx
#define WIN_SYS_LIBS shell32.lib
#end bin_target #end bin_target

View File

@ -17,7 +17,7 @@
/* See dtoolsymbols.h for a rant on the purpose of this file. */ /* See dtoolsymbols.h for a rant on the purpose of this file. */
#if defined(WIN32_VC) && !defined(CPPPARSER) #if defined(WIN32_VC) && !defined(CPPPARSER) && !defined(LINK_ALL_STATIC)
#ifdef BUILDING_DIRECT #ifdef BUILDING_DIRECT
#define EXPCL_DIRECT __declspec(dllexport) #define EXPCL_DIRECT __declspec(dllexport)

View File

@ -1,9 +1,9 @@
// This directory is still experimental. Define HAVE_P3D_PLUGIN in // This directory is still experimental. Define HAVE_P3D_PLUGIN in
// your Config.pp to build it. // your Config.pp to build it.
#define BUILD_DIRECTORY $[and $[HAVE_P3D_PLUGIN],$[HAVE_TINYXML],$[HAVE_OPENSSL],$[HAVE_ZLIB],$[HAVE_TAR]] #define BUILD_DIRECTORY $[and $[HAVE_P3D_PLUGIN],$[HAVE_TINYXML],$[HAVE_OPENSSL],$[HAVE_ZLIB]]
#begin lib_target #begin lib_target
#define USE_PACKAGES tinyxml openssl zlib tar #define USE_PACKAGES tinyxml openssl zlib
#define TARGET p3d_plugin #define TARGET p3d_plugin
#define COMBINED_SOURCES \ #define COMBINED_SOURCES \
@ -58,7 +58,7 @@
#end bin_target #end bin_target
#begin bin_target #begin bin_target
#define USE_PACKAGES openssl zlib tar #define USE_PACKAGES openssl zlib
#define TARGET panda3d #define TARGET panda3d
#define OTHER_LIBS \ #define OTHER_LIBS \

View File

@ -1 +0,0 @@
forcetype ConfigShowbase

View File

@ -49,8 +49,9 @@ throw_new_frame() {
// Returns the configure object for accessing config variables from a // Returns the configure object for accessing config variables from a
// scripting language. // scripting language.
ConfigShowbase & DConfig &
get_config_showbase() { get_config_showbase() {
static DConfig config_showbase;
return config_showbase; return config_showbase;
} }

View File

@ -28,7 +28,6 @@
#include "nodePath.h" #include "nodePath.h"
ConfigureDecl(config_showbase, EXPCL_DIRECT, EXPTP_DIRECT); ConfigureDecl(config_showbase, EXPCL_DIRECT, EXPTP_DIRECT);
typedef Config::Config<ConfigureGetConfig_config_showbase> ConfigShowbase;
class CollisionTraverser; class CollisionTraverser;
class Camera; class Camera;
@ -40,7 +39,7 @@ EXPCL_DIRECT ConfigVariableSearchPath &get_particle_path();
EXPCL_DIRECT void throw_new_frame(); EXPCL_DIRECT void throw_new_frame();
EXPCL_DIRECT ConfigShowbase &get_config_showbase(); EXPCL_DIRECT DConfig &get_config_showbase();
// klunky interface since we cant pass array from python->C++ // klunky interface since we cant pass array from python->C++

View File

@ -6,21 +6,15 @@
#define COMBINED_SOURCES $[TARGET]_composite1.cxx #define COMBINED_SOURCES $[TARGET]_composite1.cxx
#define SOURCES \ #define SOURCES \
configTable.I configTable.h \ config_dconfig.h \
config_dconfig.h config_setup.h \ dconfig.I dconfig.h
dconfig.I dconfig.h \
serialization.I serialization.h \
symbolEnt.I symbolEnt.h
#define INCLUDED_SOURCES \ #define INCLUDED_SOURCES \
configTable.cxx config_dconfig.cxx dconfig.cxx \ config_dconfig.cxx dconfig.cxx
symbolEnt.cxx
#define INSTALL_HEADERS \ #define INSTALL_HEADERS \
configTable.I configTable.h config_dconfig.h config_setup.h \ config_dconfig.h \
dconfig.I dconfig.h \ dconfig.I dconfig.h
serialization.I serialization.h \
symbolEnt.I symbolEnt.h
#end lib_target #end lib_target

View File

@ -1,13 +0,0 @@
// Filename: configTable.I
// Created by: drose (15May00)
//
////////////////////////////////////////////////////////////////////
//
// PANDA 3D SOFTWARE
// Copyright (c) Carnegie Mellon University. All rights reserved.
//
// All use of this software is subject to the terms of the revised BSD
// license. You should have received a copy of this license along
// with this source code in a file named "LICENSE."
//
////////////////////////////////////////////////////////////////////

View File

@ -1,15 +0,0 @@
// Filename: configTable.cxx
// Created by: drose (15May00)
//
////////////////////////////////////////////////////////////////////
//
// PANDA 3D SOFTWARE
// Copyright (c) Carnegie Mellon University. All rights reserved.
//
// All use of this software is subject to the terms of the revised BSD
// license. You should have received a copy of this license along
// with this source code in a file named "LICENSE."
//
////////////////////////////////////////////////////////////////////
#include "configTable.h"

View File

@ -1,34 +0,0 @@
// Filename: configTable.h
// Created by: drose (15May00)
//
////////////////////////////////////////////////////////////////////
//
// PANDA 3D SOFTWARE
// Copyright (c) Carnegie Mellon University. All rights reserved.
//
// All use of this software is subject to the terms of the revised BSD
// license. You should have received a copy of this license along
// with this source code in a file named "LICENSE."
//
////////////////////////////////////////////////////////////////////
#ifndef CONFIGTABLE_H
#define CONFIGTABLE_H
#include "dtoolbase.h"
#include "symbolEnt.h"
namespace Config {
class EXPCL_DTOOLCONFIG ConfigTable {
public:
typedef SymbolEnt SymEnt;
typedef vector_SymbolEnt Symbol;
};
#include "configTable.I"
} // close Config namespace
#endif

View File

@ -1,23 +0,0 @@
// Filename: config_setup.h
// Created by: cary (20Mar00)
//
////////////////////////////////////////////////////////////////////
//
// PANDA 3D SOFTWARE
// Copyright (c) Carnegie Mellon University. All rights reserved.
//
// All use of this software is subject to the terms of the revised BSD
// license. You should have received a copy of this license along
// with this source code in a file named "LICENSE."
//
////////////////////////////////////////////////////////////////////
#ifndef __CONFIG_SETUP_H__
#define __CONFIG_SETUP_H__
#include <string>
// use 8-bit chars for now. Change this line to make config switch to wchar
typedef std::string ConfigString;
#endif /* __CONFIG_SETUP_H__ */

View File

@ -13,14 +13,32 @@
//////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////
INLINE double get_total_time_config_init() { bool DConfig::
return (double)total_time_config_init / (double)CLOCKS_PER_SEC; GetBool(const string &sym, bool def) {
ConfigVariableBool var(sym, def, "DConfig", ConfigFlags::F_dconfig);
return var.get_value();
} }
INLINE double get_total_time_external_init() { int DConfig::
return (double)total_time_external_init / (double)CLOCKS_PER_SEC; GetInt(const string &sym, int def) {
ConfigVariableInt var(sym, def, "DConfig", ConfigFlags::F_dconfig);
return var.get_value();
} }
INLINE double get_total_num_get() { float DConfig::
return total_num_get; GetFloat(const string &sym, float def) {
ConfigVariableDouble var(sym, def, "DConfig", ConfigFlags::F_dconfig);
return var.get_value();
}
double DConfig::
GetDouble(const string &sym, double def) {
ConfigVariableDouble var(sym, def, "DConfig", ConfigFlags::F_dconfig);
return var.get_value();
}
string DConfig::
GetString(const string &sym, const string &def) {
ConfigVariableString var(sym, def, "DConfig", ConfigFlags::F_dconfig);
return var.get_value();
} }

View File

@ -13,8 +13,3 @@
//////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////
#include "dconfig.h" #include "dconfig.h"
clock_t Config::total_time_config_init = 0;
clock_t Config::total_time_external_init = 0;
int Config::total_num_get = 0;

View File

@ -17,10 +17,7 @@
#include "dtoolbase.h" #include "dtoolbase.h"
#include "config_setup.h"
#include "config_dconfig.h" #include "config_dconfig.h"
#include "configTable.h"
#include "executionEnvironment.h"
#include "configVariableString.h" #include "configVariableString.h"
#include "configVariableBool.h" #include "configVariableBool.h"
#include "configVariableInt.h" #include "configVariableInt.h"
@ -28,290 +25,56 @@
#include "configVariableList.h" #include "configVariableList.h"
#include "configFlags.h" #include "configFlags.h"
#include <vector> ////////////////////////////////////////////////////////////////////
#include <map> // Class : DConfig
#include <time.h> // Description : This class emulates the old dconfig-style interface
// to our Panda config system. It exists only to
namespace Config { // provide backward-compatible support, and it is used
// primarily by Python code. For modern code, use the
// Config is, itself, configurable. The things that can be set are: // new ConfigVariable* interface instead of this
// path separator ( ': ' ) [pathsep] // deprecated interface.
// filename separator ( / ) [filesep] ////////////////////////////////////////////////////////////////////
// config filename ( Configrc ) [configname] class EXPCL_DTOOLCONFIG DConfig {
// config file suffix ( ) [configsuffix]
// config file path ( $CONFIG_PATH ) [configpath]
// (can be multiple of these)
// config file comment ( '#' ) [configcmt]
// 'args' suffix ( _ARGS ) [argsuffix]
// command arg env ( CONFIG + _____ ) [commandstub]
// debugging output ( false ) [configdbg]
// read commandline ( true ) [readargs]
// read environment ( true ) [readenv]
// all of these can be set from the one unconfigurable thing in config, the
// environment variable called CONFIG_CONFIG. The format is:
// separator_char{{field_id}={field_value}separator_char}*
// Call these functions to get stats on how Config is spending its
// time.
EXPCL_DTOOLCONFIG INLINE double get_total_time_config_init();
EXPCL_DTOOLCONFIG INLINE double get_total_time_external_init();
EXPCL_DTOOLCONFIG INLINE double get_total_num_get();
// These globals are intended for internal bookkeeping by Config to
// compute the above functions' return values.
EXPCL_DTOOLCONFIG extern clock_t total_time_config_init;
EXPCL_DTOOLCONFIG extern clock_t total_time_external_init;
EXPCL_DTOOLCONFIG extern int total_num_get;
template <class GetConfig>
class Config {
public:
Config();
~Config();
static bool AmInitializing();
static ConfigString Name();
static bool Flag();
static void Init();
static bool Defined(const ConfigString& sym);
static ConfigString Get(const ConfigString sym);
static ConfigTable::Symbol& GetAll(const ConfigString,
ConfigTable::Symbol&);
PUBLISHED: PUBLISHED:
static bool GetBool(const ConfigString sym, bool def = false); static INLINE bool GetBool(const string &sym, bool def = false);
static int GetInt(const ConfigString sym, int def = 0); static INLINE int GetInt(const string &sym, int def = 0);
static float GetFloat(const ConfigString sym, float def = 0.); static INLINE float GetFloat(const string &sym, float def = 0.);
static double GetDouble(const ConfigString sym, double def = 0.); static INLINE double GetDouble(const string &sym, double def = 0.);
static ConfigString GetString(const ConfigString sym, static INLINE string GetString(const string &sym, const string &def = "");
const ConfigString def = "");
protected:
static void ConfigFunc();
static void Flag(bool);
}; };
// Implementation follows
template<class GetConfig>
void Config<GetConfig>::ConfigFunc() {
GetConfig::config_func();
}
template<class GetConfig>
bool Config<GetConfig>::AmInitializing() {
return false;
}
template<class GetConfig>
ConfigString Config<GetConfig>::Name() {
return GetConfig::get_name();
}
template<class GetConfig>
bool Config<GetConfig>::Flag() {
return GetConfig::_flag;
}
template<class GetConfig>
void Config<GetConfig>::Flag(bool f) {
GetConfig::_flag = f;
}
template<class GetConfig>
void Config<GetConfig>::Init() {
if (Flag())
return;
Flag(true);
ConfigFunc();
}
template<class GetConfig>
Config<GetConfig>::Config() {
Init();
}
template<class GetConfig>
Config<GetConfig>::~Config() {
}
template<class GetConfig>
bool Config<GetConfig>::Defined(const ConfigString& sym)
{
Init();
return true;
}
template<class GetConfig>
ConfigString Config<GetConfig>::Get(ConfigString sym)
{
Init();
ConfigVariableString var(sym);
return var.get_value();
}
template<class GetConfig>
ConfigTable::Symbol& Config<GetConfig>::GetAll(const ConfigString sym,
ConfigTable::Symbol& s)
{
Init();
ConfigVariableList var(sym, "DConfig", ConfigFlags::F_dconfig);
int num_values = var.get_num_values();
for (int i = 0; i < num_values; ++i) {
string value = var.get_string_value(i);
s.push_back(SymbolEnt(SymbolEnt::ConfigFile, value));
}
return s;
}
template<class GetConfig>
bool Config<GetConfig>::GetBool(const ConfigString sym, bool def)
{
Init();
ConfigVariableBool var(sym, def, "DConfig", ConfigFlags::F_dconfig);
return var.get_value();
}
template<class GetConfig>
int Config<GetConfig>::GetInt(const ConfigString sym, int def)
{
Init();
ConfigVariableInt var(sym, def, "DConfig", ConfigFlags::F_dconfig);
return var.get_value();
}
template<class GetConfig>
float Config<GetConfig>::GetFloat(const ConfigString sym, float def)
{
Init();
ConfigVariableDouble var(sym, def, "DConfig", ConfigFlags::F_dconfig);
return var.get_value();
}
template<class GetConfig>
double Config<GetConfig>::GetDouble(const ConfigString sym, double def)
{
Init();
ConfigVariableDouble var(sym, def, "DConfig", ConfigFlags::F_dconfig);
return var.get_value();
}
template<class GetConfig>
ConfigString Config<GetConfig>::GetString(const ConfigString sym,
const ConfigString def)
{
Init();
ConfigVariableString var(sym, def, "DConfig", ConfigFlags::F_dconfig);
return var.get_value();
}
#include "dconfig.I" #include "dconfig.I"
} // close Config namespace
// These macros are used in each directory to call an initialization
// function at static-init time. These macros may eventually be
// phased out in favor of a simpler interface that does not require
// static init.
// Finally, here is a set of handy macros to define and reference a // This macro should appear in the config_*.h file.
// Configure object in each package.
// This macro defines an external reference to a suitable Configure #define ConfigureDecl(name, expcl, exptp)
// object; it should appear in the config_*.h file. The config object
// will be named name.
#if defined(WIN32_VC) && !defined(CPPPARSER) // This macro defines the actual declaration of the object defined
// above; it should appear in the config_*.cxx file.
#define ConfigureDecl(name, expcl, exptp) \
class expcl ConfigureGetConfig_ ## name { \
public: \
static const char *get_name(); \
static void config_func(); \
static bool _flag; \
}; \
exptp template class expcl Config::Config<ConfigureGetConfig_ ## name>; \
extern expcl Config::Config<ConfigureGetConfig_ ## name> name;
#else // WIN32_VC
#define ConfigureDecl(name, expcl, exptp) \
class expcl ConfigureGetConfig_ ## name { \
public: \
static const char *get_name(); \
static void config_func(); \
static bool _flag; \
}; \
extern expcl Config::Config<ConfigureGetConfig_ ## name> name;
#endif // WIN32_VC
// This macro defines the actual declaration of the Configure object
// defined above; it should appear in the config_*.C file.
#if defined(PENV_OSX)
#define ConfigureDef(name) \ #define ConfigureDef(name) \
Config::Config<ConfigureGetConfig_ ## name> name; \ class StaticInitializer_ ## name { \
bool ConfigureGetConfig_ ## name::_flag = false; \ public: \
int FILE_SYM_NAME = 0; \ StaticInitializer_ ## name(); \
const char *ConfigureGetConfig_ ## name:: \ }; \
get_name() { \ static StaticInitializer_ ## name name;
return #name; \
}
#else /* PENV_OSX */
#define ConfigureDef(name) \
Config::Config<ConfigureGetConfig_ ## name> name; \
bool ConfigureGetConfig_ ## name::_flag = false; \
const char *ConfigureGetConfig_ ## name:: \
get_name() { \
return #name; \
}
#endif /* PENV_OSX */
// This macro can be used in lieu of the above two when the Configure // This macro can be used in lieu of the above two when the Configure
// object does not need to be visible outside of the current C file. // object does not need to be visible outside of the current C file.
#if defined(PENV_OSX) #define Configure(name) ConfigureDef(name)
#define Configure(name) \
class ConfigureGetConfig_ ## name { \
public: \
static const char *get_name(); \
static void config_func(); \
static bool _flag; \
}; \
static Config::Config<ConfigureGetConfig_ ## name> name; \
bool ConfigureGetConfig_ ## name::_flag = false; \
int FILE_SYM_NAME = 0; \
const char *ConfigureGetConfig_ ## name:: \
get_name() { \
return #name; \
}
#else /* PENV_OSX */
#define Configure(name) \
class ConfigureGetConfig_ ## name { \
public: \
static const char *get_name(); \
static void config_func(); \
static bool _flag; \
}; \
static Config::Config<ConfigureGetConfig_ ## name> name; \
bool ConfigureGetConfig_ ## name::_flag = false; \
const char *ConfigureGetConfig_ ## name:: \
get_name() { \
return #name; \
}
#endif /* PENV_OSX */
// This one defines a block of code that will be executed at static // This one defines a block of code that will be executed at static
// init time. It must always be defined (in the C file), even if no // init time. It must always be defined (in the C file), even if no
// code is to be executed. // code is to be executed.
#define ConfigureFn(name) \ #define ConfigureFn(name) \
void ConfigureGetConfig_ ## name::config_func() StaticInitializer_ ## name::StaticInitializer_ ## name()
#if defined(PENV_OSX)
// This is a hack to provide a unique locatable symbol in each lib.
#define ConfigureLibSym \
char LIB_SYMBOL_NAME[] = ALL_FILE_SYMS_NAME ;
#else
#define ConfigureLibSym
#endif /* PENV_OSX */
#endif /* __CONFIG_H__ */ #endif /* __CONFIG_H__ */

View File

@ -1,5 +1,3 @@
#include "config_dconfig.cxx" #include "config_dconfig.cxx"
#include "dconfig.cxx" #include "dconfig.cxx"
#include "configTable.cxx"
#include "symbolEnt.cxx"

View File

@ -1,21 +0,0 @@
// Filename: serialization.I
// Created by: cary (20Mar00)
//
////////////////////////////////////////////////////////////////////
//
// PANDA 3D SOFTWARE
// Copyright (c) Carnegie Mellon University. All rights reserved.
//
// All use of this software is subject to the terms of the revised BSD
// license. You should have received a copy of this license along
// with this source code in a file named "LICENSE."
//
////////////////////////////////////////////////////////////////////
INLINE int Length(char) {
return 1;
}
INLINE int Length(char* x) {
return strlen(x);
}

View File

@ -1,184 +0,0 @@
// Filename: serialization.h
// Created by: cary (26Aug98)
//
////////////////////////////////////////////////////////////////////
//
// PANDA 3D SOFTWARE
// Copyright (c) Carnegie Mellon University. All rights reserved.
//
// All use of this software is subject to the terms of the revised BSD
// license. You should have received a copy of this license along
// with this source code in a file named "LICENSE."
//
////////////////////////////////////////////////////////////////////
#ifndef __SERIALIZATION_H__
#define __SERIALIZATION_H__
#include "dtoolbase.h"
#include "config_setup.h"
namespace Serialize {
template <class X>
class StdIns {
public:
INLINE ConfigString operator()(const X& val) {
ostringstream oss;
oss << val;
return oss.str();
}
};
template <class X>
class StdExt {
public:
INLINE X operator()(ConfigString S) {
istringstream iss(S);
X ret;
iss >> ret;
return ret;
}
};
template <class X>
INLINE int Length(X c) {
return c.length();
}
template <class Collection, class Inserter = StdIns<TYPENAME Collection::value_type> >
class Serializer {
private:
ConfigString _result;
ConfigString SerializeToString(const Collection&, const ConfigString&);
Serializer() {}
public:
Serializer(const Collection& C, ConfigString Delim = ":") :
_result(Serializer::SerializeToString(C, Delim)) {}
Serializer(const Serializer<Collection, Inserter>& c) :
_result(c._result) {}
~Serializer() {}
INLINE ConfigString operator()() { return _result; }
INLINE ConfigString operator()(const Collection& C,
const ConfigString& Delim = ":") {
_result = SerializeToString(C, Delim);
return _result;
}
INLINE operator ConfigString() { return _result; }
};
template <class Collection, class Inserter>
ConfigString
Serializer<Collection, Inserter>::SerializeToString(const Collection& C,
const ConfigString& Delim)
{
ConfigString ret;
Inserter in;
for (TYPENAME Collection::const_iterator i=C.begin(); i!=C.end(); ++i) {
if (i != C.begin())
ret += Delim;
ret += in(*i);
}
return ret;
}
template <class Collection, class Extractor = StdExt<TYPENAME Collection::value_type> >
class Deserializer {
private:
Collection _result;
INLINE void Clear() { _result.erase(_result.begin(), _result.end()); }
template <class ForwardIterator>
int FindFirstOfInString(ConfigString S, ForwardIterator DelimBegin,
ForwardIterator DelimEnd) {
int i = ConfigString::npos;
ForwardIterator j = DelimBegin;
while (j != DelimEnd) {
int k = S.find(*j);
if (k != ConfigString::npos)
if ((i == ConfigString::npos) || (i > k))
i = k;
++j;
}
return i;
}
template <class ForwardIterator>
int FindFirstNotOfInString(ConfigString S, ForwardIterator DelimBegin,
ForwardIterator DelimEnd) {
int i = ConfigString::npos;
ForwardIterator j = DelimBegin;
ForwardIterator k = DelimBegin;
while (j != DelimEnd) {
int l = S.find(*j);
if (l != ConfigString::npos)
if ((i == ConfigString::npos) || (i > l)) {
i = l;
k = j;
}
++j;
}
if (i != ConfigString::npos) {
i += Serialize::Length(*k);
if (i >= S.length())
i = ConfigString::npos;
}
return i;
}
template <class ForwardIterator>
void DeserializeFromString(ConfigString S, ForwardIterator DelimBegin,
ForwardIterator DelimEnd) {
Clear();
Extractor ex;
while (!S.empty()) {
int i = FindFirstOfInString(S, DelimBegin, DelimEnd);
_result.push_back(ex(S.substr(0, i)));
S.erase(0, i);
i = FindFirstNotOfInString(S, DelimBegin, DelimEnd);
S.erase(0, i);
}
}
void DeserializeFromString(ConfigString S, ConfigString Delim) {
Clear();
Extractor ex;
while (!S.empty()) {
size_t i = S.find_first_of(Delim);
_result.push_back(ex(S.substr(0, i)));
if (i == ConfigString::npos)
S.erase(0, i);
else
S.erase(0, i+1);
}
}
Deserializer() {}
public:
Deserializer(ConfigString S, ConfigString Delim = ":") {
Deserializer::DeserializeFromString(S, Delim);
}
template <class ForwardIterator>
Deserializer(ConfigString S, ForwardIterator DelimBegin,
ForwardIterator DelimEnd) {
Deserializer::DeserializeFromString(S, DelimBegin, DelimEnd);
}
~Deserializer() {}
INLINE const Collection& operator()() { return _result; }
template <class ForwardIterator>
INLINE const Collection& operator()(ConfigString S,
ForwardIterator DelimBegin,
ForwardIterator DelimEnd) {
Deserializer::DeserializeFromString(S, DelimBegin, DelimEnd);
}
INLINE operator const Collection&() { return _result; }
};
#include "serialization.I"
} // close Serialize namespace
#endif /* __SERIALIZATION_H__ */

View File

@ -1,53 +0,0 @@
// Filename: symbolEnt.I
// Created by: drose (15May00)
//
////////////////////////////////////////////////////////////////////
//
// PANDA 3D SOFTWARE
// Copyright (c) Carnegie Mellon University. All rights reserved.
//
// All use of this software is subject to the terms of the revised BSD
// license. You should have received a copy of this license along
// with this source code in a file named "LICENSE."
//
////////////////////////////////////////////////////////////////////
INLINE SymbolEnt& SymbolEnt::operator=(const SymbolEnt& c) {
_src = c._src;
_val = c._val;
_srctok = c._srctok;
_state = c._state;
return *this;
}
INLINE bool SymbolEnt::
operator == (const SymbolEnt &) const {
return true;
}
INLINE bool SymbolEnt::
operator != (const SymbolEnt &) const {
return false;
}
INLINE bool SymbolEnt::
operator < (const SymbolEnt &) const {
return false;
}
INLINE ConfigString SymbolEnt::Src(void) const {
return _src;
}
INLINE ConfigString SymbolEnt::Val(void) const {
return _val;
}
INLINE SymbolEnt::SymbolEntSrc SymbolEnt::SrcTok(void) const {
return _srctok;
}
INLINE bool SymbolEnt::State(void) const {
return _state;
}

View File

@ -1,26 +0,0 @@
// Filename: symbolEnt.cxx
// Created by: drose (15May00)
//
////////////////////////////////////////////////////////////////////
//
// PANDA 3D SOFTWARE
// Copyright (c) Carnegie Mellon University. All rights reserved.
//
// All use of this software is subject to the terms of the revised BSD
// license. You should have received a copy of this license along
// with this source code in a file named "LICENSE."
//
////////////////////////////////////////////////////////////////////
#include "symbolEnt.h"
#define EXPCL EXPCL_DTOOLCONFIG
#define EXPTP EXPTP_DTOOLCONFIG
#define TYPE Config::SymbolEnt
#define NAME vector_SymbolEnt
#include "vector_src.cxx"
// Tell GCC that we'll take care of the instantiation explicitly here.
#ifdef __GNUC__
#pragma implementation
#endif

View File

@ -1,77 +0,0 @@
// Filename: symbolEnt.h
// Created by: drose (15May00)
//
////////////////////////////////////////////////////////////////////
//
// PANDA 3D SOFTWARE
// Copyright (c) Carnegie Mellon University. All rights reserved.
//
// All use of this software is subject to the terms of the revised BSD
// license. You should have received a copy of this license along
// with this source code in a file named "LICENSE."
//
////////////////////////////////////////////////////////////////////
#ifndef SYMBOLENT_H
#define SYMBOLENT_H
#include "dtoolbase.h"
#include "config_setup.h"
#include "pvector.h"
namespace Config {
class EXPCL_DTOOLCONFIG SymbolEnt {
public:
enum SymbolEntSrc { ConfigFile, Environment, CommandEnv, Commandline,
Other, Invalid };
private:
ConfigString _src;
ConfigString _val;
bool _state;
enum SymbolEntSrc _srctok;
public:
SymbolEnt() : _srctok(Invalid) {}
SymbolEnt(enum SymbolEntSrc tok, const ConfigString& val,
const ConfigString& src = "", bool state = false)
: _src(src), _val(val), _state(state), _srctok(tok) {}
SymbolEnt(const SymbolEnt& c) : _src(c._src), _val(c._val),
_state(c._state), _srctok(c._srctok) {}
INLINE SymbolEnt& operator=(const SymbolEnt&);
// We need these so we can explicitly instantiate the vector,
// below. They're not actually used and do nothing useful.
INLINE bool operator == (const SymbolEnt &other) const;
INLINE bool operator != (const SymbolEnt &other) const;
INLINE bool operator < (const SymbolEnt &other) const;
INLINE ConfigString Src(void) const;
INLINE ConfigString Val(void) const;
INLINE SymbolEntSrc SrcTok(void) const;
INLINE bool State(void) const;
};
} // close Config namespace
#define EXPCL EXPCL_DTOOLCONFIG
#define EXPTP EXPTP_DTOOLCONFIG
#define TYPE Config::SymbolEnt
#define NAME vector_SymbolEnt
#include "vector_src.h"
namespace Config {
typedef ::vector_SymbolEnt vector_SymbolEnt;
#include "symbolEnt.I"
} // close Config namespace
// Tell GCC that we'll take care of the instantiation explicitly here.
#ifdef __GNUC__
#pragma interface
#endif
#endif

View File

@ -21,6 +21,8 @@
#include "dcast.h" #include "dcast.h"
#include "pnmImage.h" #include "pnmImage.h"
#include <time.h>
TypeHandle DisplayRegion::_type_handle; TypeHandle DisplayRegion::_type_handle;
TypeHandle DisplayRegionPipelineReader::_type_handle; TypeHandle DisplayRegionPipelineReader::_type_handle;

View File

@ -23,6 +23,7 @@
#include "filename.h" #include "filename.h"
#include "pset.h" #include "pset.h"
#include <stdio.h> #include <stdio.h>
#include <time.h>
bool create = false; // -c bool create = false; // -c

View File

@ -19,9 +19,7 @@ forcetype FileStream
forcetype IDecryptStream forcetype IDecryptStream
forcetype OEncryptStream forcetype OEncryptStream
forcetype ConfigExpress forcetype DConfig
renametype ConfigExpress ConfigExpress
forcetype ConfigFlags forcetype ConfigFlags
forcetype ConfigPage forcetype ConfigPage
forcetype ConfigPageManager forcetype ConfigPageManager

View File

@ -180,7 +180,8 @@ get_verify_dcast() {
// Returns the configure object for accessing config variables from a // Returns the configure object for accessing config variables from a
// scripting language. // scripting language.
ConfigExpress & DConfig &
get_config_express() { get_config_express() {
static DConfig config_express;
return config_express; return config_express;
} }

View File

@ -52,8 +52,7 @@ extern EXPCL_PANDAEXPRESS ConfigVariableDouble collect_tcp_interval;
// Expose the Config variable for Python access. // Expose the Config variable for Python access.
BEGIN_PUBLISH BEGIN_PUBLISH
typedef Config::Config<ConfigureGetConfig_config_express> ConfigExpress; EXPCL_PANDAEXPRESS DConfig &get_config_express();
EXPCL_PANDAEXPRESS ConfigExpress &get_config_express();
END_PUBLISH END_PUBLISH
extern EXPCL_PANDAEXPRESS void init_libexpress(); extern EXPCL_PANDAEXPRESS void init_libexpress();

View File

@ -18,6 +18,8 @@
#include "pandabase.h" #include "pandabase.h"
#include "mersenne.h" #include "mersenne.h"
#include <time.h>
//////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////
// Class : Randomizer // Class : Randomizer
// Description : A handy class to return random numbers. // Description : A handy class to return random numbers.

View File

@ -24,6 +24,8 @@
#include "reMutex.h" #include "reMutex.h"
#include "reMutexHolder.h" #include "reMutexHolder.h"
#include <time.h>
class BamCacheIndex; class BamCacheIndex;
//////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////