TMessageDelegatorComp.h
Go to the documentation of this file.
1 #ifndef ilog_TMessageDelegatorComp_included
2 #define ilog_TMessageDelegatorComp_included
3 
4 
5 // ACF includes
6 #include <icomp/CComponentBase.h>
8 
9 
10 namespace ilog
11 {
12 
13 
19 template <class BaseComponent>
20 class TMessageDelegatorComp: public BaseComponent, virtual public ilog::IMessageConsumer
21 {
22 public:
23  typedef BaseComponent BaseClass;
24 
25  I_BEGIN_COMPONENT(TMessageDelegatorComp);
26  I_REGISTER_INTERFACE(ilog::IMessageConsumer);
27  I_ASSIGN(m_slaveMessageConsumerCompPtr, "SlaveMessageConsumer", "Slave message consumer", false, "SlaveMessageConsumer");
28  I_END_COMPONENT;
29 
30  // reimplemented (ilog::IMessageConsumer)
31  virtual bool IsMessageSupported(
32  int messageCategory = -1,
33  int messageId = -1,
34  const istd::IInformationProvider* messagePtr = NULL) const;
35  virtual void AddMessage(const MessagePtr& messagePtr);
36 
37 protected:
38  I_REF(ilog::IMessageConsumer, m_slaveMessageConsumerCompPtr);
39 };
40 
41 
42 // public methods
43 
44 // reimplemented (ilog::IMessageConsumer)
45 
46 template <class BaseComponent>
48  int messageCategory,
49  int messageId,
50  const istd::IInformationProvider* messagePtr) const
51 {
52  if (m_slaveMessageConsumerCompPtr.IsValid()){
53  return m_slaveMessageConsumerCompPtr->IsMessageSupported(messageCategory, messageId, messagePtr);
54  }
55 
56  return true;
57 }
58 
59 
60 template <class BaseComponent>
62 {
63  if (m_slaveMessageConsumerCompPtr.IsValid()){
64  return m_slaveMessageConsumerCompPtr->AddMessage(messagePtr);
65  }
66 }
67 
68 
69 } // namespace ilog
70 
71 
72 #endif // !ilog_TMessageDelegatorComp_included
73 
74 
Delegator component for a message consumer.
Implementation of a smart pointer.
Definition: TSmartPtr.h:24
virtual void AddMessage(const MessagePtr &messagePtr)
Adds a message item to the container.
#define NULL
Definition: istd.h:64
virtual bool IsMessageSupported(int messageCategory=-1, int messageId=-1, const istd::IInformationProvider *messagePtr=NULL) const
Check if some messge is supported.
Common interface for a message container consuming information objects (messages).
Common interface for class providing some basic information object.

© 2007-2017 Witold Gantzke and Kirill Lepskiy