Changeset 11071 for code/trunk/src/libraries/core/command/Executor.h
- Timestamp:
- Jan 17, 2016, 10:29:21 PM (9 years ago)
- Location:
- code/trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
code/trunk
- Property svn:mergeinfo changed
-
code/trunk/src/libraries/core/command/Executor.h
r9550 r11071 42 42 orxonox::Executor is used to wrap an orxonox::Functor and to store default values for 43 43 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::SharedPtr45 "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. 46 46 47 47 Executors are mostly used to execute callbacks. Because some callback functions need arguments, … … 74 74 @endcode 75 75 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(). 78 78 */ 79 79 … … 100 100 Executor(const FunctorPtr& functor, const std::string& name = ""); 101 101 Executor(const Executor& other); 102 virtual ~Executor() ;102 virtual ~Executor() = default; 103 103 104 104 /// Calls the wrapped function with 0 arguments. If the function needs more arguments, the executor's default values are used. … … 121 121 { return (*this->functor_)(arg1, arg2, arg3, arg4, arg5); } 122 122 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; 127 127 128 128 /// Changes the functor. … … 147 147 { return this->functor_->hasReturnvalue(); } 148 148 /// Returns the type of the wrapped function (static or member). 149 inline Functor::Type ::EnumgetType() const149 inline Functor::Type getType() const 150 150 { return this->functor_->getType(); } 151 151 /// Returns the name of the type of a parameter with given index (the first parameter has index 0). … … 249 249 250 250 /// 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) const251 MultiType parse(T* object, const std::string& arguments, int* error = nullptr, const std::string& delimiter = " ", bool bPrintError = false) const 252 252 { 253 253 T* oldobject = this->functorMember_->getObject(); … … 267 267 inline ExecutorPtr createExecutor(const FunctorPtr& functor, const std::string& name = "") 268 268 { 269 return new Executor(functor, name);269 return std::make_shared<Executor>(functor, name); 270 270 } 271 271 … … 274 274 inline ExecutorMemberPtr<T> createExecutor(const FunctorMemberPtr<T>& functor, const std::string& name = "") 275 275 { 276 return new ExecutorMember<T>(functor, name);276 return std::make_shared<ExecutorMember<T>>(functor, name); 277 277 } 278 278 … … 280 280 inline ExecutorStaticPtr createExecutor(const FunctorStaticPtr& functor, const std::string& name = "") 281 281 { 282 return new ExecutorStatic(functor, name);282 return std::make_shared<ExecutorStatic>(functor, name); 283 283 } 284 284 }
Note: See TracChangeset
for help on using the changeset viewer.