Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
May 2, 2011, 10:20:45 AM (14 years ago)
Author:
dafrick
Message:

Changes in notifications module structure. Notifications can now be sent through the NotificationListener, meaning, they can be sent from anywhere within orxonox (and the modules of course).

Location:
code/branches/tutoriallevel2/src/orxonox/interfaces
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • code/branches/tutoriallevel2/src/orxonox/interfaces/CMakeLists.txt

    r7504 r8374  
    11ADD_SOURCE_FILES(ORXONOX_SRC_FILES
    22  InterfaceCompilation.cc
     3  NotificationListener.cc
    34  Pickupable.cc
    45  PickupCarrier.cc
  • code/branches/tutoriallevel2/src/orxonox/interfaces/InterfaceCompilation.cc

    r7606 r8374  
    8686        RegisterRootObject(Rewardable);
    8787    }
    88 
    89     //----------------------------
    90     // NotificationListener
    91     //----------------------------
    92     NotificationListener::NotificationListener()
    93     {
    94         RegisterRootObject(NotificationListener);
    95     }
    9688}
  • code/branches/tutoriallevel2/src/orxonox/interfaces/NotificationListener.h

    r7552 r8374  
    6767            NotificationListener();
    6868            virtual ~NotificationListener() {}
    69 
    70             /**
    71             @brief Get the senders that are targets of this NotificationListener.
    72             @return Returns the set of senders that are targets of this NotificationListener.
    73             */
    74             virtual const std::set<std::string> & getTargetsSet(void) = 0;
    75 
    76             /**
    77             @brief Updates the whole NotificationListener.
    78                    This is called by the @ref orxonox::NotificationManager "NotificationManager" when the @ref orxonox::Notification "Notifications" have changed so much, that the NotificationListener may have to re-initialize his operations.
    79             */
    80             virtual void update(void) = 0;
    81             /**
    82             @brief Updates the NotificationListener, when a new Notification has come in at the specified time.
    83             @param notification A pointer to the @ref orxonox::Notification "Notification".
    84             @param time The time the @ref orxonox::Notification "Notification" has come in.
    85             */
    86             virtual void update(Notification* notification, const std::time_t & time) = 0;
     69           
     70            static const std::string ALL; //!< Static string to indicate a sender that sends to all NotificationListeners.
     71            static const std::string NONE; //!< Static string to indicare a sender that sends to no specific NotificationListener.
     72           
     73            static void sendNotification(const std::string& message, unsigned int clientId, const std::string& sender = NotificationListener::NONE, bool isLocal = false);
     74           
     75            virtual bool registerNotification(const std::string& message, const std::string& sender)
     76                { return false; }
    8777    };
    8878}
Note: See TracChangeset for help on using the changeset viewer.