1 #ifndef SUBJECT_H_INCLUDED 
    2 #define SUBJECT_H_INCLUDED 
   33 template <
typename E, 
typename K = 
void>
 
   37         typedef const K*                               KeyType;
 
   38         typedef std::function<void(const EventType&)>  CallbackType;
 
   46         void Register(
const U*, CallbackType);
 
   49         void Unregister(
const U*);
 
   53         void Notify(
const EventType&);
 
   56         typedef std::less<KeyType>  Compare;
 
   58         std::map<KeyType, CallbackType, Compare> m_observers;
 
   99         typedef std::weak_ptr<const void>              KeyType;
 
  100         typedef std::function<void(const EventType&)>  CallbackType;
 
  108         template <
typename U>
 
  109         void Register(
const std::shared_ptr<U>&, CallbackType);
 
  111         template <
typename U>
 
  112         void Unregister(
const std::shared_ptr<U>&);
 
  114         void UnregisterAll();
 
  116         void Notify(
const EventType&);
 
  119         typedef std::owner_less<KeyType>  Compare;
 
  121         std::map<KeyType, CallbackType, Compare> m_observers;
 
  129         m_observers.insert(make_pair(std::static_pointer_cast<const void>(u), f));
 
  132 template <
typename E>
 
  133 template <
typename U>
 
  136         m_observers.erase(std::static_pointer_cast<const void>(u));
 
  140 void Subject<E, std::weak_ptr<const void>>::UnregisterAll()
 
  146 void Subject<E, std::weak_ptr<const void>>::Notify(
const EventType& e)
 
  148         for (
auto const& o : m_observers) {
 
  149                 auto spt = o.first.lock();
 
Namespace for the core simulator. 
 
Subject in Observer pattern.