Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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

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

cleaned out useless non-portable stuff

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 <= EXECUTOR_MAX_ARGUMENTS; i++)
57  {
58    if (this->defaultValue[i] == MT_NULL || i == EXECUTOR_MAX_ARGUMENTS)
59    {
60      this->paramCount = i;
61      break;
62    }
63    else
64      this->defaultValue[i].storeString();
65  }
66}
67
68/**
69 * clones this element into executor.
70 * @param executor the Executor to clone
71 */
72void ExecutorBase::cloning(ExecutorBase* executor) const
73{
74  executor->functorType  = this->functorType;
75  executor->paramCount   = this->paramCount;
76  for (unsigned int i = 0; i < this->paramCount; i++)
77    executor->defaultValue[i] =  this->defaultValue[i];
78}
79
80/**
81 * @brief set the default values of the executor
82 * @param value0 the first default value
83 * @param value1 the second default value
84 * @param value2 the third default value
85 * @param value3 the fourth default value
86 * @param value4 the fifth default value
87 * @returns itself
88 */
89void ExecutorBase::defaultValues(const MultiType& value0,
90                                  const MultiType& value1,
91                                  const MultiType& value2,
92                                  const MultiType& value3,
93                                  const MultiType& value4,
94                                  const MultiType& value5,
95                                  const MultiType& value6)
96{
97  const MultiType* value[5];
98  value[0] = &value0;
99  value[1] = &value1;
100  value[2] = &value2;
101  value[3] = &value3;
102  value[4] = &value4;
103  value[5] = &value5;
104  value[6] = &value6;
105  for (unsigned int i = 0; i < this->paramCount; i++)
106  {
107    if (*value[i] != MT_NULL)
108    {
109      this->defaultValue[i].setValueOf(*value[i]);
110      this->defaultValue[i].storeString();
111    }
112  }
113}
114
115/**
116 * @brief prints out nice information about the Executor
117 */
118void ExecutorBase::debug()
119{
120}
Note: See TracBrowser for help on using the repository browser.