IOData.hpp
1 /*---------------------------------------------------------------------------*\
2  *
3  * mimmo
4  *
5  * Copyright (C) 2015-2021 OPTIMAD engineering Srl
6  *
7  * -------------------------------------------------------------------------
8  * License
9  * This file is part of mimmo.
10  *
11  * mimmo is free software: you can redistribute it and/or modify it
12  * under the terms of the GNU Lesser General Public License v3 (LGPL)
13  * as published by the Free Software Foundation.
14  *
15  * mimmo is distributed in the hope that it will be useful, but WITHOUT
16  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
17  * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
18  * License for more details.
19  *
20  * You should have received a copy of the GNU Lesser General Public License
21  * along with mimmo. If not, see <http://www.gnu.org/licenses/>.
22  *
23 \*---------------------------------------------------------------------------*/
24 #ifndef __IODATA_HPP__
25 #define __IODATA_HPP__
26 
27 namespace mimmo{
28 
39 class IOData{
40 
41 public:
44  IOData(){};
45 
49  virtual ~IOData(){};
50 
57  template<typename T>
58  T* getData();
59 
66  template<typename T>
67  void setData(T data);
68 
69 };
70 
78 template<typename T>
79 class IODataT: public IOData{
80 public:
81  T m_data;
83 public:
86  IODataT(){};
87 
91  IODataT(T &data){
92  m_data = data;
93  };
94 
97  ~IODataT(){};
98 
101  IODataT(const IODataT & other){
102  this->m_data = other.m_data;
103  }
104 
108  void setData(T &data){
109  m_data = data;
110  }
111 
115  T* getData(){
116  return(&m_data);
117  }
118 
119 };
120 
121 };
122 
123 
124 #endif /* __IODATA_HPP__ */
IODataT(T &data)
Definition: IOData.hpp:91
void setData(T data)
T * getData()
Definition: IOData.hpp:115
IOData is the base class of generic data stored as input or result in a Port.
Definition: IOData.hpp:39
virtual ~IOData()
Definition: IOData.hpp:49
void setData(T &data)
Definition: IOData.hpp:108
IODataT is the templated class of generic data derived from IOData base class.
Definition: IOData.hpp:79
IODataT(const IODataT &other)
Definition: IOData.hpp:101