Ignore:
Timestamp:
Dec 13, 2011, 12:02:21 PM (14 years ago)
Author:
Frederik Heber <heber@…>
Children:
3324cf
Parents:
d85532
git-author:
Frederik Heber <heber@…> (12/02/11 13:13:44)
git-committer:
Frederik Heber <heber@…> (12/13/11 12:02:21)
Message:

Relay can now also relay notifications.

  • NOTE: We do not yet notify the Observables, whose update() we combine, when the Relay is destroyed. They have to signOff before by themselves (or by some other means, e.g. be destroyed before.).
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/Patterns/Observer/unittests/stubs/ObserverStub.cpp

    rd85532 rb760ac5  
    239239{}
    240240
     241/************ RelayNotification ***************/
     242
     243RelayNotification::RelayNotification() :
     244    Relay(std::string("RelayTest"))
     245{
     246  Channels *OurChannel = new Channels();
     247  NotificationChannels.insert( std::make_pair(this, OurChannel) );
     248  OurChannel->addChannel(NotificationObservable::Operation1Notify);
     249  OurChannel->addChannel(NotificationObservable::Operation2Notify);
     250}
     251
     252RelayNotification::~RelayNotification()
     253{}
     254
    241255/************ RelayCountObserver ***************/
    242256
     
    259273}
    260274
     275/********* RelayNotificationObserver ***********/
     276
     277RelayNotificationObserver::RelayNotificationObserver(const Observable * const _relay) :
     278  Observer("RelayNotificationObserver"),
     279  wasNotified(false),
     280  relay(_relay)
     281{}
     282
     283RelayNotificationObserver::~RelayNotificationObserver()
     284{}
     285
     286void RelayNotificationObserver::update(Observable*){}
     287void RelayNotificationObserver::subjectKilled(Observable*){}
     288void RelayNotificationObserver::recieveNotification(Observable *publisher, Notification_ptr notification){
     289  // check that we are not called by the relay itself
     290  CPPUNIT_ASSERT(publisher != relay);
     291  wasNotified = true;
     292}
     293
Note: See TracChangeset for help on using the changeset viewer.