Inviwo 0.9.12-pre
Inviwo documentation
Loading...
Searching...
No Matches
inviwo::SingleFileObserver Class Reference

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>

+ Inheritance diagram for inviwo::SingleFileObserver:

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
 
FileObserveroperator= (const FileObserver &)=delete
 
 FileObserver (FileObserver &&rhs)
 
FileObserveroperator= (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
FileSystemObserverfileSystemObserver_
 

Detailed Description

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(...)

Constructor & Destructor Documentation

◆ SingleFileObserver()

inviwo::SingleFileObserver::SingleFileObserver ( const std::filesystem::path & filename = "")

Creates a file observer for filename and start observing that file

Member Function Documentation

◆ onChange()

const BaseCallBack * inviwo::SingleFileObserver::onChange ( std::function< void()> callback)

Register a callback that will be called once the file has changed on disk.

◆ removeOnChange()

void inviwo::SingleFileObserver::removeOnChange ( const BaseCallBack * callback)

Remove a callback from the list of callbacks

◆ start()

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()

◆ stop()

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


The documentation for this class was generated from the following file: