Ignore:
Timestamp:
Dec 13, 2011, 9:43:39 AM (14 years ago)
Author:
Frederik Heber <heber@…>
Children:
e2e035e
Parents:
e7352a5
git-author:
Frederik Heber <heber@…> (12/01/11 09:09:18)
git-committer:
Frederik Heber <heber@…> (12/13/11 09:43:39)
Message:

NotificationChannels is now static entity.

  • this is in line with the other static entities on Observable that are intended to save memory (before we needed 8 bytes for the pointer in each and every Observable instances, whether it had channels or not.)
  • Modified NOTIFY macro to accomodate for the changes.
  • enhanced documentation of class Notifications.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/Patterns/Observer.cpp

    re7352a5 rbc2698  
    4343std::map<Observable*,std::set<Notification*> > Observable::notifications;
    4444set<Observable*> Observable::busyObservables; //!< Set of Observables that are currently busy notifying their sign-on'ed Observers
     45Observable::ChannelMap Observable::NotificationChannels; //!< Map of Observables to their Channels.
    4546
    4647/** Attaching Sub-observables to Observables.
     
    278279Notification_ptr Observable::getChannel(size_t no) const
    279280{
    280   ASSERT(NotificationChannels != NULL,
     281  ChannelMap::iterator iter = NotificationChannels.find(const_cast<Observable *>(this));
     282  ASSERT(iter != NotificationChannels.end(),
     283      "Observable::getChannel() - we do not have a channel in NotificationChannels.");
     284  const Channels *OurChannel = iter->second;
     285  ASSERT(OurChannel != NULL,
    281286      "Observable::getChannel() - observable has no channels.");
    282   return NotificationChannels->getChannel(no);
     287  return OurChannel->getChannel(no);
    283288}
    284289
Note: See TracChangeset for help on using the changeset viewer.