Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: orxonox.OLD/trunk/src/lib/util/executor/executor.cc @ 7742

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

trying to fix a strange bug of the static initialisation

File size: 2.8 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////////////////////////
21// SHELL COMMAND BASE //
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 */
29Executor::Executor(const MultiType& param0,
30                   const MultiType& param1,
31                   const MultiType& param2,
32                   const MultiType& param3,
33                   const MultiType& param4)
34{
35  this->setClassID(CL_EXECUTOR, "Executor");
36
37  // What Parameters have we got
38  this->defaultValue[0] = param0;
39  this->defaultValue[1] = param1;
40  this->defaultValue[2] = param2;
41  this->defaultValue[3] = param3;
42  this->defaultValue[4] = param4;
43
44  this->paramCount = 0;
45  for (unsigned int i = 0; i <= FUNCTOR_MAX_ARGUMENTS; i++)
46  {
47    if (this->defaultValue[i] == MT_NULL || i == FUNCTOR_MAX_ARGUMENTS)
48    {
49      this->paramCount = i;
50      break;
51    }
52  }
53}
54
55/**
56 * deconstructs a Executor
57 */
58Executor::~Executor()
59{}
60
61/**
62 * clones this element into executor.
63 */
64void Executor::cloning(Executor* executor) const
65{
66  executor->functorType  = this->functorType;
67  executor->paramCount   = this->paramCount;
68  for (unsigned int i = 0; i < this->paramCount; i++)
69    executor->defaultValue[i] =  this->defaultValue[i];
70}
71
72/**
73 * @brief set the default values of the executor
74 * @param value0 the first default value
75 * @param value1 the second default value
76 * @param value2 the third default value
77 * @param value3 the fourth default value
78 * @param value4 the fifth default value
79 * @returns itself
80 */
81Executor* Executor::defaultValues(const MultiType& value0,
82                                  const MultiType& value1,
83                                  const MultiType& value2,
84                                  const MultiType& value3,
85                                  const MultiType& value4)
86{
87  if (this == NULL)
88    return NULL;
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
97  for (unsigned int i = 0; i < this->paramCount; i++)
98  {
99    if (*value[i] != MT_NULL)
100    {
101      this->defaultValue[i].setValueOf(*value[i]);
102    }
103  }
104  return this;
105}
106
107/**
108 * @brief prints out nice information about the Executor
109 */
110void Executor::debug()
111{
112
113}
Note: See TracBrowser for help on using the repository browser.