Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Jan 17, 2016, 10:29:21 PM (8 years ago)
Author:
landauf
Message:

merged branch cpp11_v3 back to trunk

Location:
code/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • code/trunk

  • code/trunk/src/orxonox/interfaces/NotificationListener.h

    r9667 r11071  
    4949{
    5050    // TODO: Document.
    51     namespace notificationMessageType
    52     {
    53         enum Value {
    54             info,
    55             important
    56         };
    57     }
     51    enum class NotificationMessageType {
     52        info,
     53        important
     54    };
    5855   
    59     namespace notificationSendMode
    60     {
    61         enum Value {
    62             local,
    63             network,
    64             broadcast
    65         };
    66     }
     56    enum class NotificationSendMode {
     57        local,
     58        network,
     59        broadcast
     60    };
    6761   
    68     namespace notificationCommand
    69     {
    70         enum Value {
    71             none,
    72             clear
    73         };
    74     }
     62    enum class NotificationCommand {
     63        none,
     64        clear
     65    };
    7566
    7667    // TODO: Update doc.
     
    10192            @param sender The sender that sent the notification. Default is 'none'.
    10293            @param messageType The type of the message, can be either 'info' or 'important'. Default is 'info'.
    103             @param sendMode The mode in which the notification is sent, can be 'local' to send the notification to the client where this function is executed, 'network' if the notification is to be sent to the client with the specified clientID, or 'broadcast' if the notification should be sent to all hosts. Default is notificationSendMode::local.
     94            @param sendMode The mode in which the notification is sent, can be 'local' to send the notification to the client where this function is executed, 'network' if the notification is to be sent to the client with the specified clientID, or 'broadcast' if the notification should be sent to all hosts. Default is NotificationSendMode::local.
    10495            @param clientId The id of the client the notification should be sent to. Default is 0.
    10596            */
    106             static void sendNotification(const std::string& message, const std::string& sender = NotificationListener::NONE, notificationMessageType::Value messageType = notificationMessageType::info, notificationSendMode::Value sendMode = notificationSendMode::local, unsigned int clientId = 0)
     97            static void sendNotification(const std::string& message, const std::string& sender = NotificationListener::NONE, NotificationMessageType messageType = NotificationMessageType::info, NotificationSendMode sendMode = NotificationSendMode::local, unsigned int clientId = 0)
    10798                { NotificationListener::sendNetworkHelper(message, sender, sendMode, clientId, false, messageType); }
    10899            /**
     
    110101            @param command The command that should be sent (and later executed).
    111102            @param sender The sender that sent the notification. Default is 'none'.
    112             @param sendMode The mode in which the command is sent, can be 'local' to send the command to the client where this function is executed, 'network' if the command is to be sent to the client with the specified clientID, or 'broadcast' if the command should be sent to all hosts. Default is notificationSendMode::local.
     103            @param sendMode The mode in which the command is sent, can be 'local' to send the command to the client where this function is executed, 'network' if the command is to be sent to the client with the specified clientID, or 'broadcast' if the command should be sent to all hosts. Default is NotificationSendMode::local.
    113104            @param clientId The id of the client the command should be sent to. Default is 0.
    114105            */
    115             static void sendCommand(const std::string& command, const std::string& sender = NotificationListener::NONE, notificationSendMode::Value sendMode = notificationSendMode::local, unsigned int clientId = 0)
     106            static void sendCommand(const std::string& command, const std::string& sender = NotificationListener::NONE, NotificationSendMode sendMode = NotificationSendMode::local, unsigned int clientId = 0)
    116107                { NotificationListener::sendNetworkHelper(command, sender, sendMode, clientId, true); }
    117108
    118             static void sendHelper(const std::string& message, const std::string& sender, bool isCommand = false, unsigned int messageMode = 0); // Helper method to register a notification/execute a command with all NotificationListeners after it has been sent over the network.
     109            static void sendHelper(const std::string& message, const std::string& sender, bool isCommand, NotificationMessageType type); // Helper method to register a notification/execute a command with all NotificationListeners after it has been sent over the network.
    119110
    120111            //TODO: Make protected?
     
    128119            @return Returns true if the notification was successfully registered, false if not.
    129120            */
    130             virtual bool registerNotification(const std::string& message, const std::string& sender, notificationMessageType::Value type)
     121            virtual bool registerNotification(const std::string& message, const std::string& sender, NotificationMessageType type)
    131122                { return false; }
    132123            /**
     
    137128            @return Returns true if the command was successfully executed, false if not.
    138129            */
    139             virtual bool executeCommand(notificationCommand::Value command, const std::string& sender) { return false; }
     130            virtual bool executeCommand(NotificationCommand command, const std::string& sender) { return false; }
    140131
    141132        public:
     
    149140           
    150141        protected:
    151             static void sendNetworkHelper(const std::string& message, const std::string& sender, notificationSendMode::Value sendMode, unsigned int clientId, bool isCommand = false, notificationMessageType::Value messageType = notificationMessageType::info); // Helper method to send both notifications and commands over the network.
     142            static void sendNetworkHelper(const std::string& message, const std::string& sender, NotificationSendMode sendMode, unsigned int clientId, bool isCommand = false, NotificationMessageType messageType = NotificationMessageType::info); // Helper method to send both notifications and commands over the network.
    152143
    153             static notificationCommand::Value str2Command(const std::string& string); // Helper method. Converts a string into the enum for a command.
    154             static const std::string& command2Str(notificationCommand::Value command); // Helper method. Converts a command enum into its corresponding string.
     144            static NotificationCommand str2Command(const std::string& string); // Helper method. Converts a string into the enum for a command.
     145            static const std::string& command2Str(NotificationCommand command); // Helper method. Converts a command enum into its corresponding string.
    155146    };
    156147}
Note: See TracChangeset for help on using the changeset viewer.