openETCS
case study for the European Train Control System developed for the authors dissertation
Storage.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2010-2012
3  Johannes Feuser <feuser@uni-bremen.de>
4  This file is part of the openETCS library.
5 
6  The openETCS library 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 3 of the License, or
9  any later version.
10 
11  The openETCS library is distributed in the hope that it will be useful,
12  but WITHOUT ANY WARRANTY; without even the implied warranty of
13  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  GNU General Public License for more details.
15 
16  You should have received a copy of the GNU General Public License
17  along with the openETCS library. If not, see <http://www.gnu.org/licenses/>.
18 */
19 
20 /*!
21  * \author Johannes Feuser <feuser@uni-bremen.de>
22  * \brief storage class
23  */
24 
25 #ifndef __OETCS_DF_STORAGE_H__
26 #define __OETCS_DF_STORAGE_H__
27 
28 
29 #include <sstream>
30 
31 #include <string>
32 #include "Error/ExceptionTypes.h"
33 #include <vector>
34 #include "Configuration.h"
35 #include "EVCStateMachine.h"
36 
37 
38 
39 
40 namespace oETCS { namespace DF { class CEVCStateMachine; } }
41 namespace oETCS { namespace DF { class CBitFlow; } }
42 
43 
44 namespace oETCS {
45 
46 namespace DF {
47 
48 
49 /*!
50  * \brief storage class for holding any available meta model data type
51  */
53 {
54  public:
55  /*!
56  * \brief general constructor
57  *
58  * \param[in] pStateMachine pointer to the parent EVC state machine object
59  * \param[in] bDebug optinal flag for using debug ouput of value
60  * \param[in] DebugName optional name for the debug output
61  */
62  explicit CStorage(oETCS::DF::CEVCStateMachine * const pStateMachine, const bool & bDebug = false, const std::string & DebugName = "") throw();
63 
64 
65 
66  /*!
67  * \brief destructor
68  */
69  virtual ~CStorage() throw();
70 
71 
72 
73  /*!
74  * \brief virtual method for computing all outputs and setting the all referenced outputs
75  *
76  * \remark must be implemented by any inheriting class
77  */
78  virtual void Calculate() throw(::oETCS::DF::Error::CException);
79 
80 
81 
82  /*!
83  * \brief gets a bit vector corresponding to the value
84  *
85  * If the required size is smaller than the calculated needed size,
86  * the vector is truncated. In case of an array, the vector is truncated+
87  * element-wise.
88  *
89  * \param[in] lSize required size of the bit vector
90  * \return vector of boolean holding the bit raw data in little endian format
91  */
92  ::std::vector< bool > GetBitVector(const unsigned long& lSize) const throw();
93 
94 
95 
96  /*!
97  * \brief gets the type of the last used input during Calculate()
98  *
99  * \return type of the input
100  */
101  oETCS::DF::DATA_T GetLastInputType() const throw();
102 
103 
104 
105  /*!
106  * \brief container of the boolean input
107  */
109 
110 
111 
112  /*!
113  * \brief container of the double input
114  */
116 
117 
118 
119  /*!
120  * \brief container of the double array input
121  */
123 
124 
125 
126  /*!
127  * \brief container of the integer input
128  */
130 
131 
132 
133  /*!
134  * \brief container of the string input
135  */
137 
138 
139 
140  /*!
141  * \brief pointers to boolean storages
142  */
143  ::std::vector< oETCS::DF::BOOL_OUTPUT_T > m_BoolValue;
144 
145 
146 
147  /*!
148  * \brief pointers to double storages
149  */
150  ::std::vector< oETCS::DF::DOUBLE_OUTPUT_T > m_DoubleValue;
151 
152 
153 
154  /*!
155  * \brief pointers to double array storages
156  */
157  ::std::vector< oETCS::DF::DOUBLE_ARRAY_OUTPUT_T > m_DoubleArrayValue;
158 
159 
160 
161  /*!
162  * \brief pointers to interger storages
163  */
164  ::std::vector< oETCS::DF::INT_OUTPUT_T > m_IntValue;
165 
166 
167 
168  /*!
169  * \brief pointers to string storages
170  */
171  ::std::vector< oETCS::DF::STRING_OUTPUT_T > m_StringValue;
172 
173 
174 
175  /*!
176  * \brief vector of pointers to bit flows
177  */
178  ::std::vector< oETCS::DF::CBitFlow* > m_BitValue;
179 
180 
181 
182 
183  private:
184  /*!
185  * \brief type of the input within the last cycle (call of Calculate())
186  */
188 
189 
190 
191  /*!
192  * \brief flag for debug output
193  */
194  const bool m_bDebug;
195 
196 
197 
198  /*!
199  * \brief name of instance for debug output
200  */
201  const std::string m_DebugName;
202 
203 
204 
205 
206 }; // class CStorage : public oETCS::DF::CFunctionBlock
207 
208 
209 
210 
211 
212 } // namespace oETCS::DF
213 
214 } // namespace oETCS
215 
216 #endif // __ OETCS_DF_STORAGE_H__

Copyright (C) 2010-2012 Johannes Feuser (feuser@uni-bremen.de)
The openETCS library is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or any later version.
The openETCS library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with the openETCS library. If not, see "http://www.gnu.org/licenses/.