Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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

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

orxonox/new_class_id: new Executor construct, that is much more typesafe, faster, and easier to extend…

Also changed the LoadParam process, and adapted ScriptEngine calls

Then at the end, some missing headers appeared, and appended them to all the cc-files again.

File size: 3.1 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
21ObjectListDefinition(ExecutorBase);
22
23/**
24 * @brief constructs and registers a new Command
25 * @param commandName the name of the Command
26 * @param className the name of the class to apply this command to
27 * @param paramCount the count of parameters this command takes
28 */
29ExecutorBase::ExecutorBase(bool hasRetVal,
30                           const MultiType& param0,
31                           const MultiType& param1,
32                           const MultiType& param2,
33                           const MultiType& param3,
34                           const MultiType& param4,
35                           const MultiType& param5,
36                           const MultiType& param6)
37  : bRetVal(hasRetVal)
38{
39  this->registerObject(this, ExecutorBase::_objectList);
40
41  // What Parameters have we got
42  this->defaultValue[0] = param0;
43  this->defaultValue[1] = param1;
44  this->defaultValue[2] = param2;
45  this->defaultValue[3] = param3;
46  this->defaultValue[4] = param4;
47  this->defaultValue[5] = param5;
48  this->defaultValue[6] = param6;
49
50  this->paramCount = 0;
51  for (unsigned int i = 0; i <= FUNCTOR_MAX_ARGUMENTS; i++)
52  {
53    if (this->defaultValue[i] == MT_NULL || i == FUNCTOR_MAX_ARGUMENTS)
54    {
55      this->paramCount = i;
56      break;
57    }
58  }
59}
60
61/**
62 * clones this element into executor.
63 * @param executor the Executor to clone
64 */
65void ExecutorBase::cloning(ExecutorBase* executor) const
66{
67  executor->functorType  = this->functorType;
68  executor->paramCount   = this->paramCount;
69  for (unsigned int i = 0; i < this->paramCount; i++)
70    executor->defaultValue[i] =  this->defaultValue[i];
71}
72
73/**
74 * @brief set the default values of the executor
75 * @param value0 the first default value
76 * @param value1 the second default value
77 * @param value2 the third default value
78 * @param value3 the fourth default value
79 * @param value4 the fifth default value
80 * @returns itself
81 */
82void ExecutorBase::defaultValues(const MultiType& value0,
83                                  const MultiType& value1,
84                                  const MultiType& value2,
85                                  const MultiType& value3,
86                                  const MultiType& value4,
87                                  const MultiType& value5,
88                                  const MultiType& value6)
89{
90  const MultiType* value[5];
91  value[0] = &value0;
92  value[1] = &value1;
93  value[2] = &value2;
94  value[3] = &value3;
95  value[4] = &value4;
96  value[5] = &value5;
97  value[6] = &value6;
98  for (unsigned int i = 0; i < this->paramCount; i++)
99  {
100    if (*value[i] != MT_NULL)
101    {
102      this->defaultValue[i].setValueOf(*value[i]);
103    }
104  }
105}
106
107/**
108 * @brief prints out nice information about the Executor
109 */
110void ExecutorBase::debug()
111{
112}
Note: See TracBrowser for help on using the repository browser.