VR-Link API Documentation for HLA Evolved
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
vlDeclNotifier.h
Go to the documentation of this file.
1 /*********************************************************************
2 ** Copyright (c) 1992-2010 VT MAK
3 ** All rights reserved.
4 *********************************************************************/
8 #pragma once
9 
10 #include "vlAbsNotifyObs.h"
11 
26 #define DtDECLARE_OBSERVER_NOTIFIER(ClassName) \
27 class DT_DLL_VLUTIL DtObservee; \
28 class DT_DLL_VLUTIL ClassName##Notifier : public DtAbsNotifyObserver \
29 { \
30 public: \
31  \
32  ClassName##Notifier(ClassName* observer); \
33  \
34  virtual ~ClassName##Notifier(); \
35  \
36  ClassName##Notifier(const ClassName##Notifier& orig); \
37  \
38  ClassName##Notifier& operator=(const ClassName##Notifier& orig); \
39  \
40  virtual bool notifyFromObserved(DtObservee* observed, \
41  const DtObservee::DtWhyNotifyObserver& why); \
42  \
43 protected: \
44  \
45  ClassName* myObjectToNotify; \
46  \
47 }; \
48 
49 
50 
56 #define DtDEFINE_OBSERVER_NOTIFIER(ClassName) \
57 ClassName##Notifier::ClassName##Notifier(ClassName* observer) : \
58  DtAbsNotifyObserver(), \
59  myObjectToNotify(observer) \
60 { \
61 } \
62  \
63 ClassName##Notifier::~ClassName##Notifier() \
64 { \
65 } \
66  \
67 ClassName##Notifier::ClassName##Notifier( \
68  const ClassName##Notifier& orig) : \
69  DtAbsNotifyObserver(orig), \
70  myObjectToNotify(orig.myObjectToNotify) \
71 { \
72 } \
73  \
74 ClassName##Notifier& ClassName##Notifier::operator=( \
75  const ClassName##Notifier& orig) \
76 { \
77  if (this == &orig) \
78  { \
79  return *this; \
80  } \
81  \
82  DtAbsNotifyObserver::operator=(orig); \
83  \
84  myObjectToNotify = orig.myObjectToNotify; \
85  \
86  return *this; \
87 } \
88  \
89 bool ClassName##Notifier::notifyFromObserved( \
90  DtObservee* observed, \
91  const DtObservee::DtWhyNotifyObserver& why) \
92 { \
93  if (!myObjectToNotify) \
94  { \
95  return false; \
96  } \
97  \
98  myObjectToNotify->notifyFromYourObserved(observed, why); \
99  \
100  return true; \
101 } \
102 
This file declares DtAbsNotifyObserver.

Document ID: Generated on Mon Apr 25 03:39:01 EDT 2022 from SVN revision 242502
Copyright © 2005-2021 MAK Technologies. All Rights Reserved (www.mak.com)