|
||||
Warning, file /include/root/TMessageHandler.h was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).
0001 // @(#)root/base:$Id$ 0002 // Author: Rene Brun 11/11/99 0003 0004 /************************************************************************* 0005 * Copyright (C) 1995-2000, Rene Brun and Fons Rademakers. * 0006 * All rights reserved. * 0007 * * 0008 * For the licensing terms see $ROOTSYS/LICENSE. * 0009 * For the list of contributors see $ROOTSYS/README/CREDITS. * 0010 *************************************************************************/ 0011 0012 #ifndef ROOT_TMessageHandler 0013 #define ROOT_TMessageHandler 0014 0015 0016 ////////////////////////////////////////////////////////////////////////// 0017 // // 0018 // TMessageHandler // 0019 // // 0020 // Handle messages that might be generated by the system. // 0021 // By default a handler only keeps track of the different messages // 0022 // generated for a specific class. By deriving from this class and // 0023 // overriding Notify() one can implement custom message handling. // 0024 // In Notify() one has access to the message id and the object // 0025 // generating the message. One can install more than one message // 0026 // handler per class. A message handler can be removed or again // 0027 // added when needed. // 0028 // // 0029 ////////////////////////////////////////////////////////////////////////// 0030 0031 #include "TNamed.h" 0032 #include "TQObject.h" 0033 0034 class TMessageHandler : public TNamed, public TQObject { 0035 0036 protected: 0037 const TClass *fClass; // class for which message has to be handled 0038 const TObject *fMessObj; // object generating message 0039 Long_t fMessId; // message id (often matching specific enum in fClass) 0040 Int_t fSize; // number of different messages handled 0041 Int_t *fCnts; // count per message 0042 Long_t *fMessIds; // message ids 0043 Bool_t fDerived; // if true handle messages also for derived classes 0044 0045 void *GetSender() override { return this; } //used to set gTQSender 0046 0047 public: 0048 TMessageHandler(const TClass *cl, Bool_t derived = kTRUE); 0049 TMessageHandler(const char *cl, Bool_t derived = kTRUE); 0050 virtual ~TMessageHandler(); 0051 0052 Int_t GetSize() const { return fSize; } 0053 virtual Int_t GetMessageCount(Long_t messId) const; 0054 virtual Int_t GetTotalMessageCount() const; 0055 Bool_t HandleDerived() const { return fDerived; } 0056 virtual void HandleMessage(Long_t id, const TObject *obj); 0057 0058 void Print(Option_t *option= "") const override; 0059 0060 virtual void Add(); 0061 virtual void Remove(); 0062 Bool_t Notify() override; 0063 0064 virtual void Added() { Emit("Added()"); } //*SIGNAL* 0065 virtual void Removed() { Emit("Removed()"); } //*SIGNAL* 0066 virtual void Notified() { Emit("Notified()"); } //*SIGNAL* 0067 0068 ClassDefOverride(TMessageHandler,0) // Generic message handler 0069 }; 0070 0071 #endif
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |