1 |
|
2 |
/* $Id$ */ |
3 |
|
4 |
/******************************************************* |
5 |
* |
6 |
* Copyright 2003-2007 by ACceSS MNRF |
7 |
* Copyright 2007 by University of Queensland |
8 |
* |
9 |
* http://esscc.uq.edu.au |
10 |
* Primary Business: Queensland, Australia |
11 |
* Licensed under the Open Software License version 3.0 |
12 |
* http://www.opensource.org/licenses/osl-3.0.php |
13 |
* |
14 |
*******************************************************/ |
15 |
|
16 |
#if !defined escript_DataEmpty_20040726_H |
17 |
#define escript_DataEmpty_20040726_H |
18 |
#include "system_dep.h" |
19 |
|
20 |
#include "DataAbstract.h" |
21 |
|
22 |
namespace escript { |
23 |
|
24 |
/** |
25 |
\brief |
26 |
Implements the DataAbstract interface for an empty Data object. |
27 |
|
28 |
Description: |
29 |
Implements the DataAbstract interface for an empty Data object. |
30 |
*/ |
31 |
|
32 |
class DataEmpty : public DataAbstract { |
33 |
|
34 |
public: |
35 |
|
36 |
/** |
37 |
\brief |
38 |
Default constructor for DataEmpty. |
39 |
|
40 |
Description: |
41 |
Default constructor for DataEmpty. |
42 |
|
43 |
*/ |
44 |
ESCRIPT_DLL_API |
45 |
DataEmpty(); |
46 |
|
47 |
/** |
48 |
\brief |
49 |
Destructor for DataEmpty. |
50 |
*/ |
51 |
ESCRIPT_DLL_API |
52 |
virtual |
53 |
~DataEmpty(); |
54 |
|
55 |
/** |
56 |
\brief |
57 |
Return a textual representation of the Data object. |
58 |
*/ |
59 |
ESCRIPT_DLL_API |
60 |
virtual |
61 |
std::string |
62 |
toString() const; |
63 |
|
64 |
/** |
65 |
\brief |
66 |
Return the offset for the given sample. |
67 |
NB: This will throw an exception as obviously an empty Data object contains no |
68 |
samples. An implementation is required by parent DataAbstract class. |
69 |
\param sampleNo - Input - Sample number. |
70 |
\param dataPointNo - Input - data-point number. |
71 |
*/ |
72 |
ESCRIPT_DLL_API |
73 |
virtual |
74 |
DataArrayView::ValueType::size_type |
75 |
getPointOffset(int sampleNo, |
76 |
int dataPointNo) const; |
77 |
|
78 |
/** |
79 |
\brief |
80 |
Return a view into the data for the data point specified. |
81 |
NB: This will throw an exception as obviously an empty Data object contains no |
82 |
data points. An implementation is required by parent DataAbstract class. |
83 |
\param sampleNo - Input - Sample number. |
84 |
\param dataPointNo - Input - data-point number. |
85 |
*/ |
86 |
ESCRIPT_DLL_API |
87 |
virtual |
88 |
DataArrayView |
89 |
getDataPoint(int sampleNo, |
90 |
int dataPointNo); |
91 |
|
92 |
/** |
93 |
\brief |
94 |
Return the number of doubles stored for the Data object. |
95 |
As this is an empty Data object, this method will always return 0. |
96 |
*/ |
97 |
ESCRIPT_DLL_API |
98 |
virtual |
99 |
ValueType::size_type |
100 |
getLength() const; |
101 |
|
102 |
/** |
103 |
\brief |
104 |
Factory method that returns a newly created DataEmpty sliced from the |
105 |
current Data object according to the specified region. |
106 |
NB: This will throw an exception as obviously an empty Data object contains no |
107 |
data to slice from. An implementation is required by parent DataAbstract class. |
108 |
*/ |
109 |
ESCRIPT_DLL_API |
110 |
virtual |
111 |
DataAbstract* |
112 |
getSlice(const DataArrayView::RegionType& region) const; |
113 |
|
114 |
/** |
115 |
\brief |
116 |
Set the current Data object according to the specified slice from the |
117 |
given input value. |
118 |
NB: This will throw an exception as obviously an empty Data object contains no |
119 |
data to slice to. An implementation is required by parent DataAbstract class. |
120 |
\param value Input - Data to copy from |
121 |
\param region Input - Region to copy. |
122 |
*/ |
123 |
ESCRIPT_DLL_API |
124 |
virtual |
125 |
void |
126 |
setSlice(const DataAbstract* value, |
127 |
const DataArrayView::RegionType& region); |
128 |
|
129 |
protected: |
130 |
|
131 |
private: |
132 |
|
133 |
/** |
134 |
\brief |
135 |
Throw a standard exception. This function is called if an attempt |
136 |
is made to use functions of DataEmpty that are not valid. |
137 |
*/ |
138 |
void |
139 |
throwStandardException(const std::string& functionName) const; |
140 |
|
141 |
}; |
142 |
|
143 |
} // end of namespace |
144 |
|
145 |
#endif |