Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Nov 4, 2015, 10:25:42 PM (9 years ago)
Author:
landauf
Message:

replace 'NULL' by 'nullptr'

Location:
code/branches/cpp11_v2/src/modules/objects/triggers
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • code/branches/cpp11_v2/src/modules/objects/triggers/DistanceMultiTrigger.cc

    r10624 r10765  
    9797    {
    9898
    99         std::queue<MultiTriggerState*>* queue = NULL;
     99        std::queue<MultiTriggerState*>* queue = nullptr;
    100100
    101101        // Check for objects that were in range but no longer are. Iterate through all objects, that are in range.
     
    105105
    106106            // If the entity no longer exists.
    107             if(entity == NULL)
     107            if(entity == nullptr)
    108108            {
    109109                this->range_.erase(it++);
     
    118118
    119119                // If no queue has been created, yet.
    120                 if(queue == NULL)
     120                if(queue == nullptr)
    121121                    queue = new std::queue<MultiTriggerState*>();
    122122
     
    186186
    187187                // If no queue has been created, yet.
    188                 if(queue == NULL)
     188                if(queue == nullptr)
    189189                    queue = new std::queue<MultiTriggerState*>();
    190190
  • code/branches/cpp11_v2/src/modules/objects/triggers/DistanceTrigger.cc

    r10624 r10765  
    106106            this->setForPlayer(true);
    107107
    108         if (targetId == NULL)
     108        if (targetId == nullptr)
    109109        {
    110110            orxout(internal_error, context::triggers) << "\"" << targetStr << "\" is not a valid class name to include in ClassTreeMask (in " << this->getName() << ", class " << this->getIdentifier()->getName() << ')' << endl;
     
    147147    {
    148148        // Check whether there is a cached object, it still exists and whether it is still in range, if so nothing further needs to be done.
    149         if(this->cache_ != NULL)
     149        if(this->cache_ != nullptr)
    150150        {
    151151            if((this->cache_->getWorldPosition() - this->getWorldPosition()).length() < this->distance_)
     
    206206
    207207                    Pawn* pawn = orxonox_cast<Pawn*>(entity);
    208                     if(pawn != NULL)
     208                    if(pawn != nullptr)
    209209                        this->setTriggeringPawn(pawn);
    210210                    else
    211                         orxout(internal_warning, context::triggers) << "Pawn was NULL." << endl;
     211                        orxout(internal_warning, context::triggers) << "Pawn was nullptr." << endl;
    212212                }
    213213               
  • code/branches/cpp11_v2/src/modules/objects/triggers/EventMultiTrigger.cc

    r9667 r10765  
    9696    {
    9797        // If the originator is a MultiTriggerContainer, the event originates from a MultiTrigger and thus the event only triggers the EventMultiTrigger for the originator that caused the MultiTrigger to trigger.
    98         if(originator != NULL && originator->isA(ClassIdentifier<MultiTriggerContainer>::getIdentifier()))
     98        if(originator != nullptr && originator->isA(ClassIdentifier<MultiTriggerContainer>::getIdentifier()))
    9999        {
    100100            MultiTriggerContainer* container = static_cast<MultiTriggerContainer*>(originator);
  • code/branches/cpp11_v2/src/modules/objects/triggers/MultiTrigger.cc

    r9667 r10765  
    124124        // Let the MultiTrigger return the states that trigger and process the new states if there are any.
    125125        std::queue<MultiTriggerState*>* queue  = this->letTrigger();
    126         if(queue != NULL)
     126        if(queue != nullptr)
    127127        {
    128128            while(queue->size() > 0)
    129129            {
    130130                MultiTriggerState* state = queue->front();
    131                 // If the state is NULL. (This really shouldn't happen)
    132                 if(state == NULL)
     131                // If the state is nullptr. (This really shouldn't happen)
     132                if(state == nullptr)
    133133                {
    134                     orxout(internal_error, context::triggers) << "In MultiTrigger '" << this->getName() << "' (&" << this << "), Error: State of new states queue was NULL. State ignored." << endl;
     134                    orxout(internal_error, context::triggers) << "In MultiTrigger '" << this->getName() << "' (&" << this << "), Error: State of new states queue was nullptr. State ignored." << endl;
    135135                    queue->pop();
    136136                    continue;
     
    227227                            {
    228228                                // If the MultiTrigger is set to broadcast and has no originator a boradcast is fired.
    229                                 if(this->getBroadcast() && state->originator == NULL)
     229                                if(this->getBroadcast() && state->originator == nullptr)
    230230                                    this->broadcast(bActive);
    231231                                // Else a normal event is fired.
     
    240240                        {
    241241                            // Print some debug output if the state has changed.
    242                             if(state->originator != NULL)
     242                            if(state->originator != nullptr)
    243243                                orxout(verbose, context::triggers) << "MultiTrigger '" << this->getName() << "' (&" << this << ") changed state. originator: " << state->originator->getIdentifier()->getName() << " (&" << state->originator << "), active: " << bActive << ", triggered: " << state->bTriggered << "." << endl;
    244244                            else
    245                                 orxout(verbose, context::triggers) << "MultiTrigger '" << this->getName() << "' (&" << this << ") changed state. originator: NULL, active: " << bActive << ", triggered: " << state->bTriggered << "." << endl;
     245                                orxout(verbose, context::triggers) << "MultiTrigger '" << this->getName() << "' (&" << this << ") changed state. originator: nullptr, active: " << bActive << ", triggered: " << state->bTriggered << "." << endl;
    246246
    247247                            // If the MultiTrigger has a parent trigger, that is itself a MultiTrigger, it needs to call a method to notify him, that its activity has changed.
    248                             if(this->parent_ != NULL && this->parent_->isMultiTrigger())
     248                            if(this->parent_ != nullptr && this->parent_->isMultiTrigger())
    249249                                static_cast<MultiTrigger*>(this->parent_)->childActivityChanged(state->originator);
    250250                        }
     
    299299
    300300        // If the target is not a valid class name display an error.
    301         if (target == NULL)
     301        if (target == nullptr)
    302302        {
    303303            orxout(internal_error, context::triggers) << "'" << targetStr << "' is not a valid class name to include in ClassTreeMask (in " << this->getName() << ", class " << this->getIdentifier()->getName() << ")" << endl;
     
    327327
    328328        // If the target is not a valid class name display an error.
    329         if (target == NULL)
     329        if (target == nullptr)
    330330        {
    331331            orxout(internal_error, context::triggers) << "'" << targetStr << "' is not a valid class name to include in ClassTreeMask (in " << this->getName() << ", class " << this->getIdentifier()->getName() << ")" << endl;
     
    346346    std::queue<MultiTriggerState*>* MultiTrigger::letTrigger(void)
    347347    {
    348         return NULL;
     348        return nullptr;
    349349    }
    350350
     
    443443    void MultiTrigger::fire(bool status, BaseObject* originator)
    444444    {
    445         // If the originator is NULL, a normal event without MultiTriggerContainer is sent.
    446         if(originator == NULL)
     445        // If the originator is nullptr, a normal event without MultiTriggerContainer is sent.
     446        if(originator == nullptr)
    447447        {
    448448            this->fireEvent(status);
     
    479479    bool MultiTrigger::addState(MultiTriggerState* state)
    480480    {
    481         assert(state); // The state really shouldn't be NULL.
     481        assert(state); // The state really shouldn't be nullptr.
    482482
    483483        // If the originator is no target of this MultiTrigger.
  • code/branches/cpp11_v2/src/modules/objects/triggers/MultiTrigger.h

    r9667 r10765  
    7676        - @b simultaneousTriggerers The number of simultaneous triggerers limits the number of objects that are allowed to trigger the MultiTrigger at the same time. Or more precisely, the number of distinct objects the MultiTrigger has <em>triggered</em> states for, at each point in time. The default is <code>-1</code>, which denotes infinity.
    7777        - @b mode The mode describes how the MultiTrigger acts in relation to all the triggers, that are appended to it. There are 3 modes: <em>and</em>, meaning that the MultiTrigger can only be triggered if all the appended triggers are active. <em>or</em>, meaning that the MultiTrigger can only triggered if at least one of the appended triggers is active. And <em>xor</em>, meaning that the MultiTrigger can only be triggered if one and only one appended trigger is active. Note, that I wrote <em>can only be active</em>, that implies, that there is an additional condition to the <em>activity</em> of the MultiTrigger and that is the fulfillment of the triggering condition (the MultiTrigger itself doesn't have one, but all derived classes should). Also bear in mind, that the <em>activity</em> of a MultiTrigger is still coupled to the object that triggered it. The default is <em>and</em>.
    78         - @b broadcast Broadcast is a boolean, if true the MutliTrigger is in <em>broadcast-mode</em>, meaning, that all trigger events that are caused by no originator (originator is NULL) are broadcast as having come from every possible originator, or more precisely as having come from all objects that are specified targets of this MultiTrigger. The default is false.
     78        - @b broadcast Broadcast is a boolean, if true the MutliTrigger is in <em>broadcast-mode</em>, meaning, that all trigger events that are caused by no originator (originator is nullptr) are broadcast as having come from every possible originator, or more precisely as having come from all objects that are specified targets of this MultiTrigger. The default is false.
    7979        - @b target The target describes the kind of objects that are allowed to trigger this MultiTrigger. The default is @ref orxonox::Pawn "Pawn".
    8080        - Also there is the possibility of appending triggers (as long as they inherit from TriggerBase) to the MultiTrigger just by adding them as children in the XML description of your MultiTrigger.
     
    110110            */
    111111            inline bool isActive(void) const
    112                 { return this->isActive(NULL); }
    113             bool isActive(BaseObject* triggerer = NULL) const; //!< Check whether the MultiTrigger is active for a given object.
     112                { return this->isActive(nullptr); }
     113            bool isActive(BaseObject* triggerer = nullptr) const; //!< Check whether the MultiTrigger is active for a given object.
    114114
    115115            /**
     
    145145            */
    146146            inline bool isTarget(BaseObject* target)
    147                 { if(target == NULL) return true; else return targetMask_.isIncluded(target->getIdentifier()); }
     147                { if(target == nullptr) return true; else return targetMask_.isIncluded(target->getIdentifier()); }
    148148               
    149149            void addTarget(const std::string& targets); //!< Add some target to the MultiTrigger.
     
    152152            virtual std::queue<MultiTriggerState*>* letTrigger(void); //!< This method is called by the MultiTrigger to get information about new trigger events that need to be looked at.
    153153
    154             void changeTriggered(BaseObject* originator = NULL); //!< This method can be called by any class inheriting from MultiTrigger to change it's triggered status for a specified originator.
    155 
    156             bool isModeTriggered(BaseObject* triggerer = NULL); //!< Checks whether the MultiTrigger is triggered concerning it's children.
    157             bool isTriggered(BaseObject* triggerer = NULL); //!< Get whether the MultiTrigger is triggered for a given object.
    158 
    159             virtual void fire(bool status, BaseObject* originator = NULL);  //!< Helper method. Creates an Event for the given status and originator and fires it.
     154            void changeTriggered(BaseObject* originator = nullptr); //!< This method can be called by any class inheriting from MultiTrigger to change it's triggered status for a specified originator.
     155
     156            bool isModeTriggered(BaseObject* triggerer = nullptr); //!< Checks whether the MultiTrigger is triggered concerning it's children.
     157            bool isTriggered(BaseObject* triggerer = nullptr); //!< Get whether the MultiTrigger is triggered for a given object.
     158
     159            virtual void fire(bool status, BaseObject* originator = nullptr);  //!< Helper method. Creates an Event for the given status and originator and fires it.
    160160            void broadcast(bool status); //!< Helper method. Broadcasts an Event for every object that is a target.
    161161
  • code/branches/cpp11_v2/src/modules/objects/triggers/MultiTriggerContainer.cc

    r9667 r10765  
    5050        The creator.
    5151    */
    52     MultiTriggerContainer::MultiTriggerContainer(Context* context) : BaseObject(context), originator_(NULL), data_(NULL)
     52    MultiTriggerContainer::MultiTriggerContainer(Context* context) : BaseObject(context), originator_(nullptr), data_(nullptr)
    5353    {
    5454        RegisterObject(MultiTriggerContainer);
     
    7070
    7171        Pawn* pawn = orxonox_cast<Pawn*>(data);
    72         if(pawn != NULL)
     72        if(pawn != nullptr)
    7373        {
    7474            this->setForPlayer(true);
  • code/branches/cpp11_v2/src/modules/objects/triggers/TriggerBase.cc

    r9667 r10765  
    6767        this->mode_ = TriggerMode::EventTriggerAND;
    6868
    69         this->parent_ = NULL;
     69        this->parent_ = nullptr;
    7070
    7171        this->bMultiTrigger_ = false;
     
    170170        The index.
    171171    @return
    172         Returns a pointer ot the trigger. NULL if no such trigger exists.
     172        Returns a pointer ot the trigger. nullptr if no such trigger exists.
    173173    */
    174174    const TriggerBase* TriggerBase::getTrigger(unsigned int index) const
     
    176176        // If the index is greater than the number of children.
    177177        if (this->children_.size() <= index)
    178             return NULL;
     178            return nullptr;
    179179
    180180        std::set<TriggerBase*>::const_iterator it;
Note: See TracChangeset for help on using the changeset viewer.