SheafSystem  0.0.0.0
data_type_map.h
1 
2 //
3 // Copyright (c) 2014 Limit Point Systems, Inc.
4 //
5 // Licensed under the Apache License, Version 2.0 (the "License");
6 // you may not use this file except in compliance with the License.
7 // You may obtain a copy of the License at
8 //
9 // http://www.apache.org/licenses/LICENSE-2.0
10 //
11 // Unless required by applicable law or agreed to in writing, software
12 // distributed under the License is distributed on an "AS IS" BASIS,
13 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 // See the License for the specific language governing permissions and
15 // limitations under the License.
16 //
17 
18 // Interface for class data_type_map
19 
20 #ifndef DATA_TYPE_MAP_H
21 #define DATA_TYPE_MAP_H
22 
23 #ifndef SHEAF_DLL_SPEC_H
24 #include "SheafSystem/sheaf_dll_spec.h"
25 #endif
26 
27 #ifndef ANY_H
28 #include "SheafSystem/any.h"
29 #endif
30 
31 #ifndef PRIMITIVE_TYPE_H
32 #include "SheafSystem/primitive_type.h"
33 #endif
34 
35 #ifndef STD_HDF5_H
36 #include "SheafSystem/std_hdf5.h"
37 #endif
38 
39 namespace sheaf
40 {
41 
42 class data_converter;
43 class sheaf_file;
44 
49 class SHEAF_DLL_SPEC data_type_map : public any
50 {
51 
52 
53 public:
54 
55  // ===========================================================
56  // ANY FACET
57  // ===========================================================
58 
64  virtual data_type_map* clone() const;
65 
69  virtual bool invariant() const;
70 
74  virtual bool is_ancestor_of(const any* other) const;
75 
76  // ===========================================================
77  // DATA_TYPE_MAP FACET
78  // ===========================================================
79 
83  virtual ~data_type_map();
84 
88  inline hid_t file() const
89  {
90  return _file;
91  } ;
92 
96  data_converter* operator[] (int xi) const;
97 
98 
103  {
104  return _converters[xpt];
105  };
106 
110  inline size_t max_internal_size() const
111  {
112  return _max_internal_size;
113  };
114 
118  inline size_t max_external_size() const
119  {
120  return _max_external_size;
121  };
122 
126  inline size_t max_size() const
127  {
128  return _max_internal_size > _max_external_size ? _max_internal_size : _max_external_size;
129  }
130 
131 protected:
132 
133 
137  data_type_map();
138 
143  data_type_map(const data_type_map& xother);
144 
148  hid_t _file;
149 
154 
159 
163  data_converter* _converters[PRIMITIVE_TYPE_END];
164 };
165 
166 } // namespace sheaf
167 
168 #endif // ifndef DATA_TYPE_MAP_H
169 
170 
171 
172 
173 
174 
hid_t _file
The hdf file handle.
size_t max_external_size() const
The external size of the largest fixed length type.
size_t _max_external_size
The external size of the largest fixed length type.
hid_t file() const
The hdf file this type map is associated with.
Definition: data_type_map.h:88
data_converter * converter(primitive_type xpt) const
The data converter for primitive type xpt.
size_t max_internal_size() const
The internal size of the largest fixed length type.
Abstract base class with useful features for all objects.
Definition: any.h:39
primitive_type
Type ids for sheaf primitives.
size_t _max_internal_size
The internal size of the largest fixed length type.
Function object to convert between internal and external data formats.
Namespace for the sheaves component of the sheaf system.
A collection of data converters that map data types between internal and external representations...
Definition: data_type_map.h:49
size_t max_size() const
The maximum size, internal or external, of any fixed length type.