ML Reference
|
00001 // **InsertLicense** code 00002 //------------------------------------------------------------------------- 00004 00021 //------------------------------------------------------------------------- 00022 #ifndef __mlNotify_H 00023 #define __mlNotify_H 00024 00025 #ifndef __mlUtilsSystem_H 00026 #include "mlUtilsSystem.h" 00027 #endif 00028 00029 ML_UTILS_START_NAMESPACE 00030 00031 00032 //--------------------------------------------------------------------------------------------- 00034 //--------------------------------------------------------------------------------------------- 00035 class ML_UTILS_EXPORT Notify { 00036 00037 public: 00038 //--------------------------------------------------------------------------------------------- 00040 00041 //--------------------------------------------------------------------------------------------- 00042 00044 Notify(); 00045 00047 Notify(const Notify ¬ifyObj); 00048 00050 ~Notify(); 00051 00053 Notify& operator=(const Notify& notifyObj); 00054 00056 void reset(); 00057 00059 void setEnabled(bool flag); 00060 00062 bool isEnabled() const; 00063 00065 void addNotifyCB(void* userData, MLNotifyCB* callback); 00066 00069 void removeNotifyCB(void* userData, MLNotifyCB* callback); 00070 00073 void removeAllNotifyCBs(); 00074 00076 size_t getNumNotifyCBs() const; 00077 00079 const std::vector<void*>& getUserDataList() const; 00080 00082 const std::vector<MLNotifyCB*>& getCallbackList() const; 00083 00086 void notify(MLuint32 objType, 00087 void* objData1=NULL, 00088 void* objData2=NULL); 00089 00091 00092 protected: 00093 00094 //--------------------------------------------------------------------------------------------- 00096 00097 //--------------------------------------------------------------------------------------------- 00098 00100 std::vector<void*> _notifyCBUserDataList; 00101 00103 std::vector<MLNotifyCB*> _notifyCBList; 00104 00106 bool _enabled; 00107 00109 }; 00110 00111 00112 //--------------------------------------------------------------------------------------------- 00114 //--------------------------------------------------------------------------------------------- 00115 ML_UTILS_EXPORT extern Notify MLNotify; 00116 00117 ML_UTILS_END_NAMESPACE 00118 00119 //----------------------------------------------------------------------------------- 00120 // Stream output for std::ostream 00121 //----------------------------------------------------------------------------------- 00122 namespace std { 00123 00125 ML_UTILS_EXPORT ostream& operator<<(ostream& s, const ML_UTILS_NAMESPACE::Notify ¬ify); 00126 00127 } 00128 00129 #endif // End of __mlNotify_H 00130 00131 00132 00133