Panda3D

configVariableInt64.I

00001 // Filename: configVariableInt64.I
00002 // Created by:  drose (19Dec07)
00003 //
00004 ////////////////////////////////////////////////////////////////////
00005 //
00006 // PANDA 3D SOFTWARE
00007 // Copyright (c) Carnegie Mellon University.  All rights reserved.
00008 //
00009 // All use of this software is subject to the terms of the revised BSD
00010 // license.  You should have received a copy of this license along
00011 // with this source code in a file named "LICENSE."
00012 //
00013 ////////////////////////////////////////////////////////////////////
00014 
00015 
00016 ////////////////////////////////////////////////////////////////////
00017 //     Function: ConfigVariableInt64::Constructor
00018 //       Access: Published
00019 //  Description: 
00020 ////////////////////////////////////////////////////////////////////
00021 INLINE ConfigVariableInt64::
00022 ConfigVariableInt64(const string &name) :
00023   ConfigVariable(name, VT_int64),
00024   _local_modified(initial_invalid_cache())
00025 {
00026   _core->set_used();
00027 }
00028 
00029 ////////////////////////////////////////////////////////////////////
00030 //     Function: ConfigVariableInt64::Constructor
00031 //       Access: Published
00032 //  Description: 
00033 ////////////////////////////////////////////////////////////////////
00034 INLINE ConfigVariableInt64::
00035 ConfigVariableInt64(const string &name, PN_int64 default_value, 
00036                   const string &description, PN_int64 flags) :
00037 #ifdef PRC_SAVE_DESCRIPTIONS
00038   ConfigVariable(name, ConfigVariableCore::VT_int64, description, flags),
00039 #else
00040   ConfigVariable(name, ConfigVariableCore::VT_int64, string(), flags),
00041 #endif
00042   _local_modified(initial_invalid_cache())
00043 {
00044   set_default_value(default_value);
00045   _core->set_used();
00046 }
00047 
00048 ////////////////////////////////////////////////////////////////////
00049 //     Function: ConfigVariableInt64::Constructor
00050 //       Access: Published
00051 //  Description: 
00052 ////////////////////////////////////////////////////////////////////
00053 INLINE ConfigVariableInt64::
00054 ConfigVariableInt64(const string &name, const string &default_value, 
00055                   const string &description, PN_int64 flags) :
00056 #ifdef PRC_SAVE_DESCRIPTIONS
00057   ConfigVariable(name, ConfigVariableCore::VT_int64, description, flags),
00058 #else
00059   ConfigVariable(name, ConfigVariableCore::VT_int64, string(), flags),
00060 #endif
00061   _local_modified(initial_invalid_cache())
00062 {
00063   _core->set_default_value(default_value);
00064   _core->set_used();
00065 }
00066 
00067 ////////////////////////////////////////////////////////////////////
00068 //     Function: ConfigVariableInt64::operator =
00069 //       Access: Published
00070 //  Description: Reassigns the variable's local value.
00071 ////////////////////////////////////////////////////////////////////
00072 INLINE void ConfigVariableInt64::
00073 operator = (PN_int64 value) {
00074   set_value(value);
00075 }
00076 
00077 ////////////////////////////////////////////////////////////////////
00078 //     Function: ConfigVariableInt64::typecast operator
00079 //       Access: Published
00080 //  Description: Returns the variable's value.
00081 ////////////////////////////////////////////////////////////////////
00082 INLINE ConfigVariableInt64::
00083 operator PN_int64 () const {
00084   return get_value();
00085 }
00086 
00087 ////////////////////////////////////////////////////////////////////
00088 //     Function: ConfigVariableInt64::size()
00089 //       Access: Published
00090 //  Description: Returns the number of unique words in the variable.
00091 ////////////////////////////////////////////////////////////////////
00092 INLINE PN_int64 ConfigVariableInt64::
00093 size() const {
00094   return get_num_words();
00095 }
00096 
00097 ////////////////////////////////////////////////////////////////////
00098 //     Function: ConfigVariableInt64::operator []
00099 //       Access: Published
00100 //  Description: Returns the value of the variable's nth word.
00101 ////////////////////////////////////////////////////////////////////
00102 INLINE PN_int64 ConfigVariableInt64::
00103 operator [] (int n) const {
00104   return get_word(n);
00105 }
00106 
00107 ////////////////////////////////////////////////////////////////////
00108 //     Function: ConfigVariableInt64::set_value
00109 //       Access: Published
00110 //  Description: Reassigns the variable's local value.
00111 ////////////////////////////////////////////////////////////////////
00112 INLINE void ConfigVariableInt64::
00113 set_value(PN_int64 value) {
00114   set_string_value("");
00115   set_int64_word(0, value);
00116 }
00117 
00118 ////////////////////////////////////////////////////////////////////
00119 //     Function: ConfigVariableInt64::get_value
00120 //       Access: Published
00121 //  Description: Returns the variable's value.
00122 ////////////////////////////////////////////////////////////////////
00123 INLINE PN_int64 ConfigVariableInt64::
00124 get_value() const {
00125   TAU_PROFILE("PN_int64 ConfigVariableInt64::get_value() const", " ", TAU_USER);
00126   if (!is_cache_valid(_local_modified)) {
00127     mark_cache_valid(((ConfigVariableInt64 *)this)->_local_modified);
00128     ((ConfigVariableInt64 *)this)->_cache = get_int64_word(0);
00129   }
00130   return _cache;
00131 }
00132 
00133 ////////////////////////////////////////////////////////////////////
00134 //     Function: ConfigVariableInt64::get_default_value
00135 //       Access: Published
00136 //  Description: Returns the variable's default value.
00137 ////////////////////////////////////////////////////////////////////
00138 INLINE PN_int64 ConfigVariableInt64::
00139 get_default_value() const {
00140   const ConfigDeclaration *decl = ConfigVariable::get_default_value();
00141   if (decl != (ConfigDeclaration *)NULL) {
00142     return decl->get_int64_word(0);
00143   }
00144   return 0;
00145 }
00146 
00147 ////////////////////////////////////////////////////////////////////
00148 //     Function: ConfigVariableInt64::get_word
00149 //       Access: Published
00150 //  Description: Returns the variable's nth value.
00151 ////////////////////////////////////////////////////////////////////
00152 INLINE PN_int64 ConfigVariableInt64::
00153 get_word(int n) const {
00154   return get_int64_word(n);
00155 }
00156 
00157 ////////////////////////////////////////////////////////////////////
00158 //     Function: ConfigVariableInt64::set_word
00159 //       Access: Published
00160 //  Description: Reassigns the variable's nth value.  This makes a
00161 //               local copy of the variable's overall value.
00162 ////////////////////////////////////////////////////////////////////
00163 INLINE void ConfigVariableInt64::
00164 set_word(int n, PN_int64 value) {
00165   set_int64_word(n, value);
00166 }
00167 
 All Classes Functions Variables Enumerations