Inviwo
0.9.10.1
Inviwo documentation
|
SingleFileObserver observes a single file for changes on disk. SingleFileObserver observes a single file for changes on disk. When the application detects the file has been modified it will invoke all lambda functions registered with onChange(...) More...
#include <singlefileobserver.h>
Public Member Functions | |
SingleFileObserver (std::string filename="") | |
void | setFilename (const std::string &filename) |
const std::string & | getFilename () const |
void | start () |
void | stop () |
const BaseCallBack * | onChange (std::function< void()> callback) |
void | removeOnChange (const BaseCallBack *callback) |
Public Member Functions inherited from inviwo::FileObserver | |
FileObserver (InviwoApplication *app) | |
FileObserver (const std::string &filePath="") | |
Starts observing file if existing. More... | |
FileObserver (const FileObserver &)=delete | |
FileObserver & | operator= (const FileObserver &)=delete |
FileObserver (FileObserver &&rhs) | |
FileObserver & | operator= (FileObserver &&that) |
virtual | ~FileObserver () |
bool | startFileObservation (const std::string &filePath) |
Starts observing file if it exists. More... | |
bool | stopFileObservation (const std::string &filePath) |
Stops observing the file if being observed. More... | |
void | stopAllObservation () |
const std::unordered_set< std::string > & | getFiles () const |
bool | isObserved (const std::string &fileName) const |
Additional Inherited Members | |
Protected Attributes inherited from inviwo::FileObserver | |
InviwoApplication * | app_ |
SingleFileObserver observes a single file for changes on disk. SingleFileObserver observes a single file for changes on disk. When the application detects the file has been modified it will invoke all lambda functions registered with onChange(...)
inviwo::SingleFileObserver::SingleFileObserver | ( | std::string | filename = "" | ) |
Creates a file observer for filename and start observing that file
const inviwo::BaseCallBack * inviwo::SingleFileObserver::onChange | ( | std::function< void()> | callback | ) |
Register a callback that will be called once the file has changed on disk.
void inviwo::SingleFileObserver::removeOnChange | ( | const BaseCallBack * | callback | ) |
Remove a callback from the list of callbacks
void inviwo::SingleFileObserver::start | ( | ) |
Start observing the file, not only needed to call if stop has been called in the first place since the constructor calls start()
void inviwo::SingleFileObserver::stop | ( | ) |
Stop observing the file. This is useful if you know the file will change and a callback is not needed, for example if you write to it yourself or if you know it will be updated several times