Inviwo  0.9.10.1
Inviwo documentation
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 (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
 
FileObserveroperator= (const FileObserver &)=delete
 
 FileObserver (FileObserver &&rhs)
 
FileObserveroperator= (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
InviwoApplicationapp_
 

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 ( std::string  filename = "")

Creates a file observer for filename and start observing that file

Member Function Documentation

◆ onChange()

const inviwo::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 files: