![]() |
Inviwo 0.9.12-pre
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 (const std::filesystem::path &filename="") | |
| void | setFilename (const std::filesystem::path &filename) |
| const std::filesystem::path & | 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 (FileSystemObserver *app) | |
| FileObserver (const FileObserver &)=delete | |
| FileObserver & | operator= (const FileObserver &)=delete |
| FileObserver (FileObserver &&rhs) | |
| FileObserver & | operator= (FileObserver &&that) |
| virtual | ~FileObserver () |
| bool | startFileObservation (const std::filesystem::path &filePath) |
| Starts observing file if it exists. | |
| bool | stopFileObservation (const std::filesystem::path &filePath) |
| Stops observing the file if being observed. | |
| void | stopAllObservation () |
| const std::unordered_set< std::filesystem::path, PathHash > & | getFiles () const |
| bool | isObserved (const std::filesystem::path &fileName) const |
Additional Inherited Members | |
| Protected Attributes inherited from inviwo::FileObserver | |
| FileSystemObserver * | fileSystemObserver_ |
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 | ( | const std::filesystem::path & | filename = "" | ) |
Creates a file observer for filename and start observing that file
| const 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