26 #ifndef __TERRALIB_COMMON_INTERNAL_APPLICATIONSETTINGS_H 
   27 #define __TERRALIB_COMMON_INTERNAL_APPLICATIONSETTINGS_H 
   37 #include <boost/property_tree/ptree.hpp> 
   38 #include <boost/property_tree/xml_parser.hpp> 
   39 #include <boost/filesystem.hpp> 
   40 #include <boost/noncopyable.hpp> 
   68                                        ::boost::recursive_mutex,
 
   69                                        ::boost::lock_guard< ::boost::recursive_mutex>,
 
   70                                        ::boost::lock_guard< ::boost::recursive_mutex> >,
 
   71             public ::boost::noncopyable
 
   93         void setValue(
const std::string& key, 
const std::string& value);
 
  104         std::string 
getValue(
const std::string& key);
 
  119         void load(
const std::string& settingsFile);
 
  211       if(boost::filesystem::is_regular_file(settingsFile))
 
  212         boost::property_tree::read_xml(settingsFile, 
m_settings, boost::property_tree::xml_parser::trim_whitespace);
 
  225         boost::filesystem::remove(
m_file);
 
  229         boost::property_tree::xml_writer_settings<char> settings(
'\t', 1);
 
  230         boost::property_tree::write_xml(
m_file, 
m_settings, std::locale(), settings);
 
  256 #endif  // __TERRALIB_COMMON_INTERNAL_APPLICATIONSETTINGS_H 
void load(const std::string &settingsFile)
It initializes the application settings. 
 
bool m_dirty
A dirty bit to indicate wheter the clients have made changes in the settings since the last update...
 
const boost::property_tree::ptree & getAllSettings() const 
It return a reading reference to the internal settings. 
 
std::string getValue(const std::string &key)
It returns the value for a given key or empty. 
 
~ApplicationSettings()
The destructor will automatically save the settings to a file if one is set. 
 
void setValue(const std::string &key, const std::string &value)
It stores the value according to the key. 
 
ObjectLevelLockingPolicy< ::boost::lock_guard< ::boost::recursive_mutex > > LockWrite
 
boost::property_tree::ptree m_settings
This will keep our settings in memory. 
 
Threading policies that can be applied to TerraLib classes that need some synchronization schema...
 
void update()
It updates the application settings. 
 
This policy assures an object-level locking scheme for a derived class. 
 
void changed()
This method can be used by clients to inform manually that the internal state has changed...
 
A class for managing application settings. 
 
std::string m_file
The settings file name. 
 
ApplicationSettings()
Constructor. 
 
Configuration flags for the TerraLib Common Runtime module. 
 
ObjectLevelLockingPolicy< ::boost::lock_guard< ::boost::recursive_mutex > > LockRead