00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015 #include "configVariableBase.h"
00016
00017 ConfigVariableBase::Unconstructed *ConfigVariableBase::_unconstructed;
00018
00019
00020
00021
00022
00023
00024
00025 ConfigVariableBase::
00026 ConfigVariableBase(const string &name,
00027 ConfigVariableBase::ValueType value_type,
00028 const string &description, int flags) :
00029 _core(ConfigVariableManager::get_global_ptr()->make_variable(name))
00030 {
00031 #ifndef NDEBUG
00032 if (was_unconstructed()) {
00033 prc_cat->error()
00034 << "Late constructing " << this << ": " << name << "\n";
00035 }
00036 #endif // NDEBUG
00037
00038 if (value_type != VT_undefined) {
00039 _core->set_value_type(value_type);
00040 }
00041 #ifdef PRC_SAVE_DESCRIPTIONS
00042 if (!description.empty()) {
00043 _core->set_description(description);
00044 }
00045 #endif // PRC_SAVE_DESCRIPTIONS
00046 if (flags != 0) {
00047 _core->set_flags(flags);
00048 }
00049 }
00050
00051
00052
00053
00054
00055
00056
00057
00058
00059
00060
00061 void ConfigVariableBase::
00062 record_unconstructed() const {
00063 #ifndef NDEBUG
00064 if (_unconstructed == (Unconstructed *)NULL) {
00065 _unconstructed = new Unconstructed;
00066 }
00067 _unconstructed->insert(this);
00068 #endif
00069 }
00070
00071
00072
00073
00074
00075
00076
00077 bool ConfigVariableBase::
00078 was_unconstructed() const {
00079 #ifndef NDEBUG
00080 if (_unconstructed != (Unconstructed *)NULL) {
00081 Unconstructed::const_iterator ui = _unconstructed->find(this);
00082 if (ui != _unconstructed->end()) {
00083 return true;
00084 }
00085 }
00086 #endif
00087 return false;
00088 }
00089