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/libraries/core/command/Executor.h

    r9550 r11071  
    4242    orxonox::Executor is used to wrap an orxonox::Functor and to store default values for
    4343    its parameters. Usually one uses the function createExecutor() to create a new executor.
    44     This function returns an orxonox::ExecutorPtr which is a typedef of @ref orxonox::SharedPtr
    45     "SharedPtr<Executor>", used to manage the pointer to the executor.
     44    This function returns an orxonox::ExecutorPtr which is a typedef of "std::shared_ptr<Executor>",
     45    used to manage the pointer to the executor.
    4646
    4747    Executors are mostly used to execute callbacks. Because some callback functions need arguments,
     
    7474    @endcode
    7575
    76     Because executors that were created with createExecutor() are managed by an orxonox::SharedPtr,
    77     they don't need to be deleted after usage.
     76    Executors don't need to be deleted after usage normally because they are managed by an
     77    std::shared_ptr when they were created with createExecutor().
    7878*/
    7979
     
    100100            Executor(const FunctorPtr& functor, const std::string& name = "");
    101101            Executor(const Executor& other);
    102             virtual ~Executor();
     102            virtual ~Executor() = default;
    103103
    104104            /// Calls the wrapped function with 0 arguments. If the function needs more arguments, the executor's default values are used.
     
    121121                { return (*this->functor_)(arg1, arg2, arg3, arg4, arg5); }
    122122
    123             MultiType parse(const std::string& arguments, int* error = 0, const std::string& delimiter = " ", bool bPrintError = false) const;
    124             MultiType parse(const SubString& arguments, int* error = 0, const std::string& delimiter = " ", bool bPrintError = false) const;
    125 
    126             int evaluateArguments(const SubString& arguments, MultiType arg[MAX_FUNCTOR_ARGUMENTS], int* error = 0, const std::string& delimiter = " ") const;
     123            MultiType parse(const std::string& arguments, int* error = nullptr, const std::string& delimiter = " ", bool bPrintError = false) const;
     124            MultiType parse(const SubString& arguments, int* error = nullptr, const std::string& delimiter = " ", bool bPrintError = false) const;
     125
     126            int evaluateArguments(const SubString& arguments, MultiType arg[MAX_FUNCTOR_ARGUMENTS], int* error = nullptr, const std::string& delimiter = " ") const;
    127127
    128128            /// Changes the functor.
     
    147147                { return this->functor_->hasReturnvalue(); }
    148148            /// Returns the type of the wrapped function (static or member).
    149             inline Functor::Type::Enum getType() const
     149            inline Functor::Type getType() const
    150150                { return this->functor_->getType(); }
    151151            /// Returns the name of the type of a parameter with given index (the first parameter has index 0).
     
    249249
    250250            /// Overloads Executor::parse() with an additional object-pointer.
    251             MultiType parse(T* object, const std::string& arguments, int* error = 0, const std::string& delimiter = " ", bool bPrintError = false) const
     251            MultiType parse(T* object, const std::string& arguments, int* error = nullptr, const std::string& delimiter = " ", bool bPrintError = false) const
    252252            {
    253253                T* oldobject = this->functorMember_->getObject();
     
    267267    inline ExecutorPtr createExecutor(const FunctorPtr& functor, const std::string& name = "")
    268268    {
    269         return new Executor(functor, name);
     269        return std::make_shared<Executor>(functor, name);
    270270    }
    271271
     
    274274    inline ExecutorMemberPtr<T> createExecutor(const FunctorMemberPtr<T>& functor, const std::string& name = "")
    275275    {
    276         return new ExecutorMember<T>(functor, name);
     276        return std::make_shared<ExecutorMember<T>>(functor, name);
    277277    }
    278278
     
    280280    inline ExecutorStaticPtr createExecutor(const FunctorStaticPtr& functor, const std::string& name = "")
    281281    {
    282         return new ExecutorStatic(functor, name);
     282        return std::make_shared<ExecutorStatic>(functor, name);
    283283    }
    284284}
Note: See TracChangeset for help on using the changeset viewer.