rec::robotino::api2 C++ interface
Factory4Position.h
1 // Copyright (C) 2004-2015, Robotics Equipment Corporation GmbH
2 
3 //Copyright (c) ...
4 //
5 //REC Robotics Equipment Corporation GmbH, Planegg, Germany. All rights reserved.
6 //Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
7 //1) Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
8 //2) Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
9 //
10 //THIS SOFTWARE IS PROVIDED BY REC ROBOTICS EQUIPMENT CORPORATION GMBH ?AS IS? AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
11 //THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL REC ROBOTICS EQUIPMENT CORPORATION GMBH
12 //BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
13 //GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
14 //LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
15 //
16 //Copyright (c) ...
17 //
18 //REC Robotics Equipment Corporation GmbH, Planegg, Germany. Alle Rechte vorbehalten.
19 //Weiterverbreitung und Verwendung in nichtkompilierter oder kompilierter Form, mit oder ohne Ver?nderung, sind unter den folgenden Bedingungen zul?ssig:
20 //1) Weiterverbreitete nichtkompilierte Exemplare m?ssen das obige Copyright, diese Liste der Bedingungen und den folgenden Haftungsausschluss im Quelltext enthalten.
21 //2) Weiterverbreitete kompilierte Exemplare m?ssen das obige Copyright, diese Liste der Bedingungen und den folgenden Haftungsausschluss in der Dokumentation und/oder anderen Materialien, die mit dem Exemplar verbreitet werden, enthalten.
22 //
23 //DIESE SOFTWARE WIRD VON REC ROBOTICS EQUIPMENT CORPORATION GMBH OHNE JEGLICHE SPEZIELLE ODER IMPLIZIERTE GARANTIEN ZUR VERF?GUNG GESTELLT, DIE UNTER
24 //ANDEREM EINSCHLIESSEN: DIE IMPLIZIERTE GARANTIE DER VERWENDBARKEIT DER SOFTWARE F?R EINEN BESTIMMTEN ZWECK. AUF KEINEN FALL IST REC ROBOTICS EQUIPMENT CORPORATION GMBH
25 //F?R IRGENDWELCHE DIREKTEN, INDIREKTEN, ZUF?LLIGEN, SPEZIELLEN, BEISPIELHAFTEN ODER FOLGESCH?DEN (UNTER ANDEREM VERSCHAFFEN VON ERSATZG?TERN ODER -DIENSTLEISTUNGEN;
26 //EINSCHR?NKUNG DER NUTZUNGSF?HIGKEIT; VERLUST VON NUTZUNGSF?HIGKEIT; DATEN; PROFIT ODER GESCH?FTSUNTERBRECHUNG), WIE AUCH IMMER VERURSACHT UND UNTER WELCHER VERPFLICHTUNG
27 //AUCH IMMER, OB IN VERTRAG, STRIKTER VERPFLICHTUNG ODER UNERLAUBTER HANDLUNG (INKLUSIVE FAHRL?SSIGKEIT) VERANTWORTLICH, AUF WELCHEM WEG SIE AUCH IMMER DURCH DIE BENUTZUNG
28 //DIESER SOFTWARE ENTSTANDEN SIND, SOGAR, WENN SIE AUF DIE M?GLICHKEIT EINES SOLCHEN SCHADENS HINGEWIESEN WORDEN SIND.
29 
30 #ifndef FACTORY4POSITION_H
31 #define FACTORY4POSITION_H
32 
33 namespace rec
34 {
35  namespace robotino
36  {
37  namespace api2
38  {
40  {
41  public:
43  : id( -1 )
44  , x( 0.0 )
45  , y( 0.0 )
46  , phi( 0.0 )
47  , numBelts( 0 )
48  , distance( 0.0 )
49  {
50  }
51 
52  int id;
53  double x;
54  double y;
55  double phi;
56  int numBelts;
57  double distance;
58  };
59 
61  {
62  public:
64  : _size(0)
65  , _data(0)
66  {
67  }
68 
69  Factory4PositionList(const unsigned int size)
70  : _size(size)
71  , _data(0)
72  {
73  if (_size > 0)
74  {
75  _data = new Factory4Position[_size];
76  }
77  }
78 
80  : _size(other._size)
81  , _data(0)
82  {
83  if (_size > 0)
84  {
85  _data = new Factory4Position[_size];
86  for (int i = 0; i < _size; ++i)
87  {
88  _data[i] = other._data[i];
89  }
90  }
91  }
92 
94  {
95  delete[] _data;
96  }
97 
98  const unsigned int size() const
99  {
100  return _size;
101  }
102 
104  const Factory4Position& operator[](int index) const
105  {
106  return _data[index];
107  }
108 
109  Factory4Position& operator[](int index)
110  {
111  return _data[index];
112  }
113 
114  Factory4PositionList& operator=(const Factory4PositionList& other)
115  {
116  delete[] _data;
117  _data = 0;
118  _size = 0;
119  if (other._size > 0)
120  {
121  _size = other._size;
122  _data = new Factory4Position[_size];
123  for (int i = 0; i < _size; ++i)
124  {
125  _data[i] = other._data[i];
126  }
127  }
128  return *this;
129  }
130 
131  private:
132  unsigned int _size;
133  Factory4Position* _data;
134  };
135  }
136  }
137 }
138 
139 #endif // FACTORY4POSITION_H
Definition: Factory4Position.h:39
const Factory4Position & operator[](int index) const
Enables access via index.
Definition: Factory4Position.h:104
Definition: Factory4Position.h:60
Definition: AnalogInput.h:36