106 {
return (*this->functor_)(this->defaultValue_[0], this->defaultValue_[1], this->defaultValue_[2], this->defaultValue_[3], this->defaultValue_[4]); }
109 {
return (*this->functor_)(arg1, this->defaultValue_[1], this->defaultValue_[2], this->defaultValue_[3], this->defaultValue_[4]); }
112 {
return (*this->functor_)(arg1, arg2, this->defaultValue_[2], this->defaultValue_[3], this->defaultValue_[4]); }
115 {
return (*this->functor_)(arg1, arg2, arg3, this->defaultValue_[3], this->defaultValue_[4]); }
118 {
return (*this->functor_)(arg1, arg2, arg3, arg4, this->defaultValue_[4]); }
121 {
return (*this->functor_)(arg1, arg2, arg3, arg4, arg5); }
130 { this->functor_ = functor; }
133 {
return this->functor_; }
137 { this->
name_ = name; }
140 {
return this->
name_; }
144 {
return this->functor_->getParamCount(); }
147 {
return this->functor_->hasReturnvalue(); }
150 {
return this->functor_->getType(); }
153 {
return this->functor_->getTypenameParam(param); }
156 {
return this->functor_->getTypenameReturnvalue(); }
158 void setDefaultValues(
const MultiType& arg1);
163 void setDefaultValue(
unsigned int index,
const MultiType& arg);
168 if (index < MAX_FUNCTOR_ARGUMENTS)
169 return this->defaultValue_[index];
174 bool allDefaultValuesSet()
const;
179 if (index < MAX_FUNCTOR_ARGUMENTS)
180 return !this->defaultValue_[index].null();
220 using Executor::operator();
224 {
return (*this->functorMember_)(object, this->defaultValue_[0], this->defaultValue_[1], this->defaultValue_[2], this->defaultValue_[3], this->defaultValue_[4]); }
227 {
return (*this->functorMember_)(object, arg1, this->defaultValue_[1], this->defaultValue_[2], this->defaultValue_[3], this->defaultValue_[4]); }
230 {
return (*this->functorMember_)(object, arg1, arg2, this->defaultValue_[2], this->defaultValue_[3], this->defaultValue_[4]); }
233 {
return (*this->functorMember_)(object, arg1, arg2, arg3, this->defaultValue_[3], this->defaultValue_[4]); }
236 {
return (*this->functorMember_)(object, arg1, arg2, arg3, arg4, this->defaultValue_[4]); }
239 {
return (*this->functorMember_)(object, arg1, arg2, arg3, arg4, arg5); }
243 { this->functorMember_->setObject(
object); }
246 {
return this->functorMember_->getObject(); }
253 T* oldobject = this->functorMember_->getObject();
255 this->functorMember_->setObject(
object);
257 this->functorMember_->setObject(oldobject);
269 return std::make_shared<Executor>(functor, name);
276 return std::make_shared<ExecutorMember<T>>(functor, name);
282 return std::make_shared<ExecutorStatic>(functor, name);
std::shared_ptr< ExecutorStatic > ExecutorStaticPtr
Definition: ExecutorPtr.h:56
FunctorPtr functor_
The underlying Functor that wraps a function.
Definition: Executor.h:186
std::shared_ptr< Functor > FunctorPtr
Definition: FunctorPtr.h:57
ExecutorMember(const FunctorMemberPtr< T > &functor, const std::string &name="")
Constructor: Initializes the parent class and the pointer to the member-functor.
Definition: Executor.h:216
MultiType operator()(T *object, const MultiType &arg1, const MultiType &arg2, const MultiType &arg3, const MultiType &arg4) const
Calls the wrapped function with 4 arguments and an object-pointer. If the function needs more argumen...
Definition: Executor.h:235
void error(const std::string &text)
Prints output with error level.
Definition: ConsoleCommandCompilation.cc:145
FunctorMemberPtr< T > functorMember_
A pointer to the FunctorMember is stored separately to avoid casting when executing the function...
Definition: Executor.h:263
Definition of orxonox::Functor and its specialized subclasses, as well as the createFunctor() functio...
MultiType operator()(const MultiType &arg1, const MultiType &arg2, const MultiType &arg3) const
Calls the wrapped function with 3 arguments. If the function needs more arguments, the executor's default values are used.
Definition: Executor.h:114
Shared library macros, enums, constants and forward declarations for the core library ...
::std::string string
Definition: gtest-port.h:756
bool hasReturnvalue() const
Returns true if the wrapped function returns a value.
Definition: Executor.h:146
T * getObject() const
Returns the object-pointer of the underlying FunctorMember.
Definition: Executor.h:245
ExecutorPtr createExecutor(const FunctorPtr &functor, const std::string &name="")
Creates a new Executor that wraps a given Functor.
Definition: Executor.h:267
MultiType operator()(T *object, const MultiType &arg1) const
Calls the wrapped function with 1 argument and an object-pointer. If the function needs more argument...
Definition: Executor.h:226
MultiType operator()(const MultiType &arg1, const MultiType &arg2, const MultiType &arg3, const MultiType &arg4, const MultiType &arg5) const
Calls the wrapped function with 5 arguments. If the function needs more arguments, the executor's default values are used.
Definition: Executor.h:120
Type
Defines the type of a function (static or member)
Definition: Functor.h:179
Functor::Type getType() const
Returns the type of the wrapped function (static or member).
Definition: Executor.h:149
MultiType getDefaultValue(unsigned int index) const
Returns the default value for a parameter with given index (the first parameter has index 0)...
Definition: Executor.h:166
This class is used to wrap a Functor and to store default values for any of its parameters.
Definition: Executor.h:97
std::string getTypenameParam(unsigned int param) const
Returns the name of the type of a parameter with given index (the first parameter has index 0)...
Definition: Executor.h:152
A child class of Executor, used for easier handling of non-static member-functions.
Definition: Executor.h:212
A child class of Executor, used to distinguish executors that wrap static functions from executors th...
Definition: Executor.h:196
virtual ~ExecutorMember()
Destructor.
Definition: Executor.h:218
void setFunctor(const FunctorPtr &functor)
Changes the functor.
Definition: Executor.h:129
A class that splits a string into multiple tokens using different options.
Definition: SubString.h:101
Die Wagnis Klasse hat die folgenden Aufgaben:
Definition: ApplicationPaths.cc:66
Declaration of the MultiType and some helper constructs.
MultiType parse(const std::string &arguments, int *error=nullptr, const std::string &delimiter=" ", bool bPrintError=false) const
Calls the wrapped function with arguments that are passed in a string.
Definition: Executor.cc:76
#define _CoreExport
Definition: CorePrereqs.h:61
ExecutorStatic(const FunctorStaticPtr &functor, const std::string &name="")
Constructor: Initializes the parent class.
Definition: Executor.h:200
The MultiType can hold a value of many possible types and convert them to other types.
Definition: MultiType.h:130
Typedefs and definitions of ExecutorPtr, ExecutorStaticPtr, and ExecutorMemberPtr.
void setObject(T *object) const
Changes the object-pointer of the underlying FunctorMember.
Definition: Executor.h:242
static const MultiType Null
Definition: MultiType.h:304
Definition: InputPrereqs.h:78
MultiType operator()(T *object) const
Calls the wrapped function with 0 arguments and an object-pointer. If the function needs more argumen...
Definition: Executor.h:223
MultiType operator()(T *object, const MultiType &arg1, const MultiType &arg2) const
Calls the wrapped function with 2 arguments and an object-pointer. If the function needs more argumen...
Definition: Executor.h:229
MultiType operator()(const MultiType &arg1, const MultiType &arg2) const
Calls the wrapped function with 2 arguments. If the function needs more arguments, the executor's default values are used.
Definition: Executor.h:111
std::shared_ptr< ExecutorMember< T >> ExecutorMemberPtr
Definition: ExecutorPtr.h:58
std::string name_
The name of the executor.
Definition: Executor.h:187
const unsigned int MAX_FUNCTOR_ARGUMENTS
The maximum number of parameters of a function that is supported by Functor.
Definition: Functor.h:127
std::shared_ptr< FunctorMember< void >> FunctorStaticPtr
Definition: FunctorPtr.h:60
std::shared_ptr< FunctorMember< T >> FunctorMemberPtr
Definition: FunctorPtr.h:59
void setName(const std::string &name)
Changes the name of the executor.
Definition: Executor.h:136
unsigned int getParamCount() const
Returns the number of parameters of the wrapped function.
Definition: Executor.h:143
std::string getTypenameReturnvalue() const
Returns the name of the type of the return value.
Definition: Executor.h:155
MultiType operator()(T *object, const MultiType &arg1, const MultiType &arg2, const MultiType &arg3) const
Calls the wrapped function with 3 arguments and an object-pointer. If the function needs more argumen...
Definition: Executor.h:232
MultiType parse(T *object, const std::string &arguments, int *error=nullptr, const std::string &delimiter=" ", bool bPrintError=false) const
Overloads Executor::parse() with an additional object-pointer.
Definition: Executor.h:251
bool defaultValueSet(unsigned int index) const
Returns true if the executor contains a default value for the parameter with given index (the first p...
Definition: Executor.h:177
MultiType operator()(const MultiType &arg1) const
Calls the wrapped function with 1 argument. If the function needs more arguments, the executor's defa...
Definition: Executor.h:108
const std::string & getName() const
Returns the name of the executor.
Definition: Executor.h:139
internal::String name_
Definition: gtest.cc:2289
const FunctorPtr & getFunctor() const
Returns the functor.
Definition: Executor.h:132
virtual ~ExecutorStatic()
Destructor.
Definition: Executor.h:202
std::shared_ptr< Executor > ExecutorPtr
Definition: ExecutorPtr.h:55
MultiType operator()() const
Calls the wrapped function with 0 arguments. If the function needs more arguments, the executor's default values are used.
Definition: Executor.h:105
MultiType operator()(const MultiType &arg1, const MultiType &arg2, const MultiType &arg3, const MultiType &arg4) const
Calls the wrapped function with 4 arguments. If the function needs more arguments, the executor's default values are used.
Definition: Executor.h:117
MultiType operator()(T *object, const MultiType &arg1, const MultiType &arg2, const MultiType &arg3, const MultiType &arg4, const MultiType &arg5) const
Calls the wrapped function with 5 arguments and an object-pointer. If the function needs more argumen...
Definition: Executor.h:238