diff options
author | Aaron Brashears <aaronb@lindenlab.com> | 2009-05-18 23:38:35 +0000 |
---|---|---|
committer | Aaron Brashears <aaronb@lindenlab.com> | 2009-05-18 23:38:35 +0000 |
commit | 6df2755ba6b24d0cefd52ce175b0212dd46c9b10 (patch) | |
tree | 833bc29e7bd5438eb89f34119ae157efe6258b2c /indra/llcommon/lllivefile.h | |
parent | 0257214763203708e8e29d09346e777b95cdfce6 (diff) |
Result of svn merge -r119432:120464 svn+ssh://svn/svn/linden/branches/http_database/merge-03 into trunk. QAR-1462
Diffstat (limited to 'indra/llcommon/lllivefile.h')
-rw-r--r-- | indra/llcommon/lllivefile.h | 50 |
1 files changed, 43 insertions, 7 deletions
diff --git a/indra/llcommon/lllivefile.h b/indra/llcommon/lllivefile.h index a3a9cf49ab..89b5d95e44 100644 --- a/indra/llcommon/lllivefile.h +++ b/indra/llcommon/lllivefile.h @@ -33,29 +33,65 @@ #ifndef LL_LLLIVEFILE_H #define LL_LLLIVEFILE_H -const F32 configFileRefreshRate = 5.0; // seconds +extern const F32 DEFAULT_CONFIG_FILE_REFRESH; class LLLiveFile { public: - LLLiveFile(const std::string &filename, const F32 refresh_period = 5.f); + LLLiveFile(const std::string& filename, const F32 refresh_period = 5.f); virtual ~LLLiveFile(); + /** + * @brief Check to see if this live file should reload. + * + * Call this before using anything that was read & cached + * from the file. + * + * This method calls the <code>loadFile()</code> method if + * any of: + * file has a new modify time since the last check + * file used to exist and now does not + * file used to not exist but now does + * @return Returns true if the file was reloaded. + */ bool checkAndReload(); - // Returns true if the file changed in any way - // Call this before using anything that was read & cached from the file + std::string filename() const; + /** + * @brief Add this live file to an automated recheck. + * + * Normally, just calling checkAndReload() is enough. In some + * cases though, you may need to let the live file periodically + * check itself. + */ void addToEventTimer(); - // Normally, just calling checkAndReload() is enough. In some cases - // though, you may need to let the live file periodically check itself. void setRefreshPeriod(F32 seconds); protected: - virtual void loadFile() = 0; // Implement this to load your file if it changed + /** + * @breif Implement this to load your file if it changed. + * + * This method is called automatically by <code>checkAndReload()</code>, + * so though you must implement this in derived classes, you do + * not need to call it manually. + * @return Returns true if the file was successfully loaded. + */ + virtual bool loadFile() = 0; + + /** + * @brief Implement this method if you want to get a change callback. + * + * This virtual function will be called automatically at the end + * of <code>checkAndReload()</code> if a new configuration was + * loaded. This does not track differences between the current and + * newly loaded file, so any successful load event will trigger a + * <code>changed()</code> callback. Default is to do nothing. + */ + virtual void changed() {} private: class Impl; |