Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Sep 23, 2010, 1:00:42 PM (14 years ago)
Author:
dafrick
Message:

Doing some documentation.

Location:
code/trunk/src/modules/notifications
Files:
11 edited

Legend:

Unmodified
Added
Removed
  • code/trunk/src/modules/notifications/Notification.cc

    r7474 r7484  
    5050        RegisterRootObject(Notification);
    5151        this->initialize();
    52         this->registerVariables();
    5352    }
    5453
     
    122121    bool Notification::setMessage(const std::string & message)
    123122    {
    124         if(this->isSent()) //!< The message cannot be changed if the message has already been sent.
     123        if(this->isSent()) // The message cannot be changed if the message has already been sent.
    125124            return false;
    126125        this->message_ = message;
  • code/trunk/src/modules/notifications/Notification.h

    r7474 r7484  
    4747    /**
    4848    @brief
    49         A Notification is a short message used to inform the player about something that just happened. A Notification can be sent from any part of orxonox and is then displayed in the proper NotificationQueue (depending on which senders the specific NotificationQueue accepts).
     49        A Notification is a short message used to inform the player about something that just happened. A Notification can be sent from any part of orxonox and is then displayed in the proper @ref orxonox::NotificationQueue "NotificationQueue" (depending on which senders the specific @ref orxonox::NotificationQueue "NotificationQueue" accepts).
    5050    @author
    5151        Damian 'Mozork' Frick
     
    8383            bool sent_; //!< Whether Notification has been sent, if so it cannot be changed.
    8484
    85             void initialize(void);
    86             void registerVariables(void);
     85            void initialize(void); //!< Registers the object and sets some default values.
    8786
    8887    };
  • code/trunk/src/modules/notifications/NotificationDispatcher.cc

    r7474 r7484  
    9393    }
    9494
     95    /**
     96    @brief
     97        Registers variables for synchronisation.
     98    */
    9599    void NotificationDispatcher::registerVariables(void)
    96100    {
     
    113117        else if(GameMode::isServer())
    114118        {
     119            //TODO: This may fail if the object has not been synchronized, yet.
    115120            callMemberNetworkFunction(NotificationDispatcher, dispatch, this->getObjectID(), clientId, clientId);
    116121        }
  • code/trunk/src/modules/notifications/NotificationDispatcher.h

    r7474 r7484  
    4747    /**
    4848    @brief
    49         A NotificationDispatcher is an entity that, upon being triggered, dispatches (or sends) a specified Notification.
     49        A NotificationDispatcher is an entity that, upon being triggered, dispatches (or sends) a specified @ref orxonox::Notification "Notification".
     50
     51        Its standard usage is:
     52        @code
     53        <NotificationDispatcher>
     54            <events>
     55                <trigger>
     56                    <PlayerTrigger />
     57                </trigger>
     58            </event>
     59        </NotificationDispatcher>
     60        @endcode
     61        But keep in mind, that NotificationDispatcher is an abstract class and in this example @ref orxonox::PlayerTrigger "PlayerTrigger" stands for any event that is caused by a @ref orxonox::PlayerTrigger "PlayerTrigger", so instead of @ref orxonox::PlayerTrigger "PlayerTrigger", there could be a @ref orxonox::DistanceTrigger "DistanceTrigger", or a @ref orxonox::DistanceMultiTrigger "DistanceMutliTrigger", or even an @ref orxonox::EventListener "EventListener" that waits for an event coming from any kind of @ref orxonox::PlayerTrigger "PlayerTrigger".
    5062    @author
    5163        Damian 'Mozork' Frick
     
    7385            std::string sender_; //!< The name of the sender of the Notification dispatched by this NotificationDispatcher.
    7486
    75            void registerVariables(void);
     87            void registerVariables(void); //!< Register some variables for synchronisation.
    7688
    7789            /**
  • code/trunk/src/modules/notifications/NotificationManager.cc

    r7474 r7484  
    6060    ManageScopedSingleton(NotificationManager, ScopeID::Graphics, false);
    6161
     62    // Setting console command to enter the edit mode.
    6263    SetConsoleCommand("enterEditMode", &NotificationManager::enterEditMode);
    6364
     
    106107    }
    107108
     109    /**
     110    @brief
     111        Sends a Notification with the specified message to the specified client from the specified sender.
     112    @param message
     113        The message that should be sent.
     114    @param clientId
     115        The id of the client the notification should be sent to.
     116    @param sender
     117        The sender that sent the notification.
     118    */
    108119    /*static*/ void NotificationManager::sendNotification(const std::string& message, unsigned int clientId, const std::string& sender)
    109120    {
     121        // If we're in standalone mode or we're already no the right client we create and send the Notification.
    110122        if(GameMode::isStandalone() || Host::getPlayerID() == clientId)
    111123        {
     
    113125            notification->send(sender);
    114126        }
     127        // If we're on the server (and the server is not the intended recipient of the Notification) we send it over the network.
    115128        else if(GameMode::isServer())
    116129        {
  • code/trunk/src/modules/notifications/NotificationManager.h

    r7474 r7484  
    5050    /**
    5151    @brief
    52         The Singleton NotificationManager functions as a gateway between Notifications and NotificationListeners.
    53         It receives, organizes Notifications and the redistributes them to the specific NotificationListeners.
     52        The Singleton NotificationManager functions as a gateway between @ref orxonox::Notification "Notifications" and @ref orxonox::NotificationListener "NotificationListeners".
     53        It receives, organizes @ref orxonox::Notification "Notifications" and the redistributes them to the specific @ref orxonox::NotificationListener "NotificationListeners".
     54        It also provides a static function to send @ref orxonox::Notification "Notifications" and works as a liaison between the @ref orxonox>>NotificationQueue "NotificationQueues" and the GUI that displays notification, called NotificationLayer.
    5455    @author
    5556        Damian 'Mozork' Frick
     
    6566            virtual void preDestroy(void); //!< Is called before the object is destroyed.
    6667
     68            /**
     69            @brief Get the instance of the NotificationManager Singleton.
     70            @return Returns a reference to the NotificationManager.
     71            */
    6772            static NotificationManager& getInstance() { return Singleton<NotificationManager>::getInstance(); } // tolua_export
    6873
     
    7075            static const std::string NONE; //!< Static string to indicare a sender that sends to no specific NotificationListener.
    7176
     77            //! Sends a Notification with the specified message to the specified client from the specified sender.
    7278            static void sendNotification(const std::string& message, unsigned int clientId, const std::string& sender = NotificationManager::NONE);
    7379
  • code/trunk/src/modules/notifications/NotificationQueue.cc

    r7417 r7484  
    5252        Constructor. Creates and initializes the object.
    5353    @param name
    54         The name of the new NotificationQueue.
     54        The name of the new NotificationQueue. It needs to be unique
    5555    @param senders
    5656        The senders that are targets of this NotificationQueue, i.e. the names of senders whose Notifications this NotificationQueue displays.
  • code/trunk/src/modules/notifications/NotificationQueue.h

    r7456 r7484  
    5454    struct NotificationContainer
    5555    {
    56         Notification* notification; //!< The Notification displayed.
    57         time_t time; //!< The time the Notification was sent and thus first displayed.
     56        Notification* notification; // The Notification displayed.
     57        time_t time; // The time the Notification was sent and thus first displayed.
    5858    };
    5959
     
    6161    struct NotificationContainerCompare {
    6262        bool operator() (const NotificationContainer* const & a, const NotificationContainer* const & b) const
    63             { return a->time < b->time; } //!< Ordered by time.
     63            { return a->time < b->time; } // Ordered by time.
    6464    };
    6565
    6666    /**
    6767    @brief
    68         Displays Notifications from specific senders.
     68        Displays @ref orxonox::Notification "Notifications" from specific senders.
     69
     70        There are quite some parameters that influence the behaviour of the NotificationQueue:
     71        - 'name': The name of the NotificationQueue. It needs to be unique.
     72        - 'senders': The senders that are targets of this NotificationQueue, i.e. the names of senders whose Notifications this NotificationQueue displays.
     73        - 'size': The size of the NotificationQueue, it specifies how many @ref orxonox::Notification "Notifications" are displayed at once at the most.
     74        - 'displayTime': The time a @ref orxonox::Notification "Notification" is displayed with this NotificationQueue.
    6975    @author
    7076        Damian 'Mozork' Frick
  • code/trunk/src/modules/notifications/dispatchers/CommandNotification.cc

    r7474 r7484  
    8080    }
    8181
     82    /**
     83    @brief
     84        Register some variables for synchronisation.
     85    */
    8286    void CommandNotification::registerVariables(void)
    8387    {
  • code/trunk/src/modules/notifications/dispatchers/CommandNotification.h

    r7474 r7484  
    4747        This class implements a method of displaying a Notification with information to an input command and the key the command is mapped to.
    4848        The message that is displayed is a string made out uf the concatenation of the preMessage, the key the specified command is mapped to and the postMessage.
     49
     50        In use it would like this:
     51        @code
     52        <CommandNotification preMessage="Please press " command="someCommand" postMessage=" to do something." >
     53            <events>
     54                <trigger>
     55                    <PlayerTrigger />
     56                </trigger>
     57            </events>
     58        </CommandNotification>
     59        @endcode
     60        Upon being triggered this would display the @ref orxonox::Notification "Notification" "Please press {the binding of the specified command} to do something".
     61        For more information on what can be used for @code <PlayerTrigger /> @endcode see the @ref orxonox::NotificationDispatcher "NotificationDispatcher" documentation.
    4962    @author
    5063        Damian 'Mozork' Frick
     
    8699            std::string postMessage_; //!< The last part of the displayed message.
    87100
    88             void registerVariables(void);
     101            void registerVariables(void); //!< Register some variables for synchronisation.
    89102
    90103            /**
  • code/trunk/src/modules/notifications/dispatchers/SimpleNotification.h

    r7456 r7484  
    4646    @brief
    4747        The SimpleNotification class enables the sending of (in XML) predefined Notifications upon some kind of triggering event.
     48
     49        In use it would like this:
     50        @code
     51        <SimpleNotification message="some message..." >
     52            <events>
     53                <trigger>
     54                    <PlayerTrigger />
     55                </trigger>
     56            </events>
     57        </SimpleNotification>
     58        @endcode
     59        For more information on what can be used for @code <PlayerTrigger /> @endcode see the @ref orxonox::NotificationDispatcher "NotificationDispatcher" documentation.
    4860    @author
    4961        Damian 'Mozork' Frick
Note: See TracChangeset for help on using the changeset viewer.