charon-core  0.3.1
AbstractData.hxx
Go to the documentation of this file.
1 /* This file is part of Charon.
2 
3  Charon is free software: you can redistribute it and/or modify
4  it under the terms of the GNU Lesser General Public License as published by
5  the Free Software Foundation, either version 3 of the License, or
6  (at your option) any later version.
7 
8  Charon is distributed in the hope that it will be useful,
9  but WITHOUT ANY WARRANTY; without even the implied warranty of
10  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11  GNU Lesser General Public License for more details.
12 
13  You should have received a copy of the GNU Lesser General Public License
14  along with Charon. If not, see <http://www.gnu.org/licenses/>.
15 */
24 #include <vector>
25 
26 #ifndef _ABSTRACT_DATA_HXX_
27 #define _ABSTRACT_DATA_HXX_
28 
30 
33 template<typename T>
35 public:
36  virtual ~AbstractROData() {}
37 
39 
40  virtual operator T() const = 0;
41 
43 
44  virtual const T& operator()() const = 0;
45 };
46 
48 
51 template<typename T>
52 class AbstractData : public AbstractROData<T> {
53 public:
54  virtual ~AbstractData() {}
55 
57 
60  virtual T& operator=(const T& B) = 0;
61 
63 
65  virtual T& operator()() = 0;
66 };
67 
70 template<typename T>
72 public:
73  virtual ~AbstractMultiROData() {}
74 
76 
79  virtual const T& operator[](std::size_t pos) const = 0;
80 
82 
85  virtual std::size_t size() const = 0;
86 };
87 
90 template<typename T>
92 public:
93  virtual ~AbstractMultiData() {}
94 
96 
99  virtual T& operator[](std::size_t pos) = 0;
100 };
101 
102 #endif // _ABSTRACT_DATA_HXX_
103 
Common interface for read-only access to multiple data members like arrays etc.
Common interface for read-write access to multiple data members like arrays etc.
virtual std::size_t size() const =0
Access to number of members.
virtual T & operator=(const T &B)=0
data assignment operator
Interface for data assignment and readout.
Interface for data acces.
virtual T & operator[](std::size_t pos)=0
Access to specific member (read-write).
virtual const T & operator[](std::size_t pos) const =0
Access to specific member (read-only).
virtual T & operator()()=0
Call operator.
virtual const T & operator()() const =0
Call operator.