Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: orxonox.OLD/branches/new_class_id/src/lib/util/executor/executor.cc @ 9728

Last change on this file since 9728 was 9728, checked in by bensch, 18 years ago

cleanup

File size: 3.5 KB
Line 
1/*
2   orxonox - the future of 3D-vertical-scrollers
3
4   Copyright (C) 2004 orx
5
6   This program is free software; you can redistribute it and/or modify
7   it under the terms of the GNU General Public License as published by
8   the Free Software Foundation; either version 2, or (at your option)
9   any later version.
10
11   ### File Specific:
12   main-programmer: Benjamin Grauer
13   co-programmer: ...
14*/
15
16//#define DEBUG_SPECIAL_MODULE DEBUG_MODULE_
17
18#include "executor.h"
19
20
21template<> MT_Type ExecutorParamType<bool>() { return MT_BOOL; };
22template<> MT_Type ExecutorParamType<int>() { return MT_INT; };
23template<> MT_Type ExecutorParamType<unsigned int>() { return MT_UINT; };
24template<> MT_Type ExecutorParamType<float>() { return MT_FLOAT; };
25template<> MT_Type ExecutorParamType<char>() { return MT_CHAR; };
26template<> MT_Type ExecutorParamType<const std::string&>() { return MT_STRING; };
27
28
29
30/**
31 * @brief constructs and registers a new Command
32 * @param commandName the name of the Command
33 * @param className the name of the class to apply this command to
34 * @param paramCount the count of parameters this command takes
35 */
36ExecutorBase::ExecutorBase(bool hasRetVal,
37                           const MultiType& param0,
38                           const MultiType& param1,
39                           const MultiType& param2,
40                           const MultiType& param3,
41                           const MultiType& param4,
42                           const MultiType& param5,
43                           const MultiType& param6)
44  : bRetVal(hasRetVal)
45{
46  // What Parameters have we got
47  this->defaultValue[0] = param0;
48  this->defaultValue[1] = param1;
49  this->defaultValue[2] = param2;
50  this->defaultValue[3] = param3;
51  this->defaultValue[4] = param4;
52  this->defaultValue[5] = param5;
53  this->defaultValue[6] = param6;
54
55  this->paramCount = 0;
56  for (unsigned int i = 0; i <= FUNCTOR_MAX_ARGUMENTS; i++)
57  {
58    if (this->defaultValue[i] == MT_NULL || i == FUNCTOR_MAX_ARGUMENTS)
59    {
60      this->paramCount = i;
61      break;
62    }
63  }
64}
65
66/**
67 * clones this element into executor.
68 * @param executor the Executor to clone
69 */
70void ExecutorBase::cloning(ExecutorBase* executor) const
71{
72  executor->functorType  = this->functorType;
73  executor->paramCount   = this->paramCount;
74  for (unsigned int i = 0; i < this->paramCount; i++)
75    executor->defaultValue[i] =  this->defaultValue[i];
76}
77
78/**
79 * @brief set the default values of the executor
80 * @param value0 the first default value
81 * @param value1 the second default value
82 * @param value2 the third default value
83 * @param value3 the fourth default value
84 * @param value4 the fifth default value
85 * @returns itself
86 */
87void ExecutorBase::defaultValues(const MultiType& value0,
88                                  const MultiType& value1,
89                                  const MultiType& value2,
90                                  const MultiType& value3,
91                                  const MultiType& value4,
92                                  const MultiType& value5,
93                                  const MultiType& value6)
94{
95  const MultiType* value[5];
96  value[0] = &value0;
97  value[1] = &value1;
98  value[2] = &value2;
99  value[3] = &value3;
100  value[4] = &value4;
101  value[5] = &value5;
102  value[6] = &value6;
103  for (unsigned int i = 0; i < this->paramCount; i++)
104  {
105    if (*value[i] != MT_NULL)
106    {
107      this->defaultValue[i].setValueOf(*value[i]);
108    }
109  }
110}
111
112/**
113 * @brief prints out nice information about the Executor
114 */
115void ExecutorBase::debug()
116{
117}
Note: See TracBrowser for help on using the repository browser.