1 #ifndef __creaImageIOListener_h_INCLUDED__
2 #define __creaImageIOListener_h_INCLUDED__
4 #include <creaImageIOSystem.h>
8 // Signal/slot mechanism
9 #include <boost/signal.hpp>
10 #include <boost/bind.hpp>
11 #include <boost/thread/mutex.hpp>
16 class Listener : public wxThread
23 ///Thread method that is executed once create is called
25 ///Thread method called upon exiting
27 ///Sets the new state of adding files
28 void SetAddFilesState(bool addFiles){boost::mutex::scoped_lock lock(mMutex);mAddFiles=addFiles;}
29 ///Sets the new state of removing files
30 void SetRemoveFilesState(bool removeFiles){boost::mutex::scoped_lock lock(mMutex);mRemoveFiles=removeFiles;}
31 ///Sets the new monitored drive
32 void SetMonitoredDrive(const std::string& dr){boost::mutex::scoped_lock lock(mMutex);mDrive=dr;}
33 ///Puts the name of the monitored drive in the given string
34 void GetMonitoredDrive(std::string& drive){drive=mDrive;}
36 ///Related with signals
37 //=============================================
38 typedef boost::signal<void (bool)> MountingSignalType;
39 typedef MountingSignalType::slot_function_type MountingCallbackType;
40 //=============================================
42 //==================================================================
43 void ConnectObserver(MountingCallbackType callback);
44 //==================================================================
46 ///Sends a boost::signal to alert that the drive has changed its state (mounted/unmounted)
47 void SendSignal(bool ivalid);
53 /// Boolean that declares if the files that are read on CD mount should be added
55 /// Boolean that declares if, on CD unmount, the files that were in the drive should be removed
57 ///Boolean that declares if a unit has been mounted
59 ///The monitored drive
61 ///The validation signal
62 MountingSignalType mMountingSignal;