SubjectImp.h
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010 #ifndef SUBJECTIMP_H
00011 #define SUBJECTIMP_H
00012
00013 #include "SafeSlot.h"
00014 #include "TypesFile.h"
00015
00016 #include <boost/any.hpp>
00017 #include <list>
00018 #include <map>
00019 #include <string>
00020 #include <vector>
00021
00022 class SubjectImpPrivate;
00023
00024
00025
00026
00027
00028 class SubjectImp
00029 {
00030 friend class Signal::SignalValue;
00031
00032 public:
00033 SubjectImp();
00034 virtual ~SubjectImp();
00035
00036 virtual bool attach(const std::string& signal, const Slot& slot);
00037 virtual bool detach(const std::string& signal, const Slot& slot);
00038
00039
00040
00041
00042
00043
00044
00045 virtual const std::string& getObjectType() const;
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056
00057 virtual bool isKindOf(const std::string& className) const;
00058
00059
00060
00061
00062
00063
00064
00065
00066
00067
00068 const std::list<SafeSlot>& getSlots(const std::string& signal);
00069
00070
00071
00072
00073
00074
00075 bool signalsEnabled() const;
00076
00077 protected:
00078 void notify(const std::string& signal, const boost::any& data = boost::any());
00079
00080
00081
00082
00083
00084
00085
00086
00087 void enableSignals(bool enabled);
00088
00089 SubjectImpPrivate* mpImpPrivate;
00090 };
00091
00092 #define SUBJECTADAPTEREXTENSION_CLASSES
00093
00094 #define SUBJECTADAPTER_METHODS(impClass) \
00095 bool attach(const std::string& signal, const Slot& slot) \
00096 { \
00097 return impClass::attach(signal, slot); \
00098 } \
00099 bool detach(const std::string& signal, const Slot& slot) \
00100 { \
00101 return impClass::detach(signal, slot); \
00102 } \
00103 private: \
00104 void enableSignals(bool enabled) \
00105 { \
00106 impClass::enableSignals(enabled); \
00107 } \
00108 public: \
00109 bool signalsEnabled() const \
00110 { \
00111 return impClass::signalsEnabled(); \
00112 }
00113
00114 #endif