Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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

Last change on this file since 9649 was 8894, checked in by patrick, 18 years ago

merged the branche single_player_map with the trunk

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