FiberVISH 0.2
Fish - The Fiber Bundle API for the Vish Visualization Shell
Slice.hpp
1#ifndef __SLICE_HPP
2#define __SLICE_HPP "Created 25.08.2004"
3
4#include "GridID.hpp"
5#include "GridList.hpp"
6#include <memcore/stringlist.hpp>
7
8namespace Fiber
9{
10
16{
17public:
19 virtual ~GridIterator();
20
21
23 virtual bool apply(GridID&id, Grid&g) = 0;
24};
25
32class BUNDLE_API Slice : public OwnerOf<Grid>
33 , public Ownable<Slice>
34 , public Intercube
35 , public SaveableAttributes
36{
37public:
39
40private:
41 grids_t grids;
42
44
45public:
46 auto getNumberOfGrids() const noexcept
47 {
48 return grids.size();
49 }
50
51
56 enum LoaderPriority {HDF5, COMPUTED_GRID};
57
58
63 class BUNDLE_API Loader : public ReferenceBase<Loader>
64 {
65 public:
70
72 ~Loader();
73
77 virtual bool load(const WeakPtr<Slice>&Self) = 0;
78 };
79
80
82
91
92 // Reference to something that contains grid, which
93 // is basically the entire bundle
94 RefPtr<GridList> getIDList() const;
95
100 bool accessSlice() const;
101
102 bool isNotYetLoaded() const
103 {
104 return DeferredLoader.size() > 0;
105 }
106
107 bool isLoaded() const
108 {
109 return !isNotYetLoaded();
110 }
111
115 Slice(const OwnerOf<Slice>&SliceOwner, const RefPtr<GlobalCharts>&Atlas);
116
120 ~Slice();
121
122 void extremeUnction() override;
123
127 Grid&newGrid(const string&gridname);
128
135 Grid&newGrid(const string&gridname, const string&ParentGridName);
136
141 bool insert(const string&gridname, const RefPtr<Grid>&G);
142
151 Grid&operator[](const string&gridname);
152
154 Grid&operator[](const RefPtr<GridID>&gridname);
155
157 RefPtr<GridID> makeGridID(const string&gridname);
158
160 RefPtr<GridID> findGridID(const string&gridname);
161
165 RefPtr<Grid> operator()(const string&gridname);
166
167 grids_t::value_type getUniqueGrid();
168
170 RefPtr<Grid> operator()(const RefPtr<GridID>&gridname);
171
180 int iterate(GridIterator&GI,
181 const RefPtr<MemCore::StringList>&TheseGridsOnly = NullPtr() );
182
183 typedef GridIterator Iterator;
184
196 template <class Functor>
197 int iterate_grids(const Functor&F) const
198 {
199 int N = 0;
200 this->accessSlice();
201 for(const auto&g : grids)
202 {
203 if (!g.first) continue;
204 if (!g.second) continue;
205
206 if (F(*g.first, *g.second))
207 N++;
208 else
209 return N;
210 }
211 return N;
212 }
213
217 int getMemoryUsage(memsize_t&UsedMemory, memsize_t&WantedMemory) const;
218
219 string xml() const;
220};
221
222template <>
224{
225};
226
227
231class BUNDLE_API SlicePtr : public RefPtr<Slice>
232{
233public:
236 : RefPtr<Slice>(RS)
237 {}
238
243
247 RefPtr<Grid> operator()(const string&gridname) const
248 {
249 if (!*this) return NullPtr();
250 return (**this)(gridname);
251 }
252
255 {
256 if (!*this) return NullPtr();
257 return (**this)(gridname);
258 }
259};
260
261
262} /* namespace Fiber */
263
264#endif /* __SLICE_HPP */
size_type size() const noexcept
size_type size() const noexcept
An iterator with an optional DataCreator, which is just a class to intercept creation of data along a...
Definition CreativeIterator.hpp:34
A grid identifier.
Definition GridID.hpp:29
Iterator callback object for iteration within time slices.
Definition Slice.hpp:16
virtual bool apply(GridID &id, Grid &g)=0
Virtual callback function.
A Grid is a set of Skeleton objects, each of them accessed via some unique SkeletonID object.
Definition Grid.hpp:60
Implementation of an Iterator to a sequence of elements, which might be contiguous or a projection of...
Definition vector/Iterator.hpp:525
T & operator[](index_t i) const
Access an element of the array, writeable.
Definition vector/Iterator.hpp:712
Domain-specific class of objects that can be owned.
Definition Ownable.hpp:81
Attributes with an age that allows to keep track when the attributes had been saved last.
Definition CreativeArrayBase.hpp:32
Convenience shortcut for pointers to Slices.
Definition Slice.hpp:232
SlicePtr(const MemCore::NullPtr &)
Construct as empty pointer.
Definition Slice.hpp:240
RefPtr< Grid > operator()(const RefPtr< GridID > &gridname) const
Find a grid via a grid identifier.
Definition Slice.hpp:254
SlicePtr(const RefPtr< Slice > &RS)
Construct from slice pointer.
Definition Slice.hpp:235
RefPtr< Grid > operator()(const string &gridname) const
Find a grid for the given name.
Definition Slice.hpp:247
An loader object that may be associated with each Slice, such that data can created on access.
Definition Slice.hpp:64
Loader()
Constructor.
Definition Slice.hpp:67
virtual bool load(const WeakPtr< Slice > &Self)=0
The virtualized operation that is to be performed when creating a certain slice.
Information per time slice, mainly a set of Grid objects that are accessed via GridID objects.
Definition Slice.hpp:36
int iterate_grids(const Functor &F) const
Definition Slice.hpp:197
DeferredLoader_t DeferredLoader
An optionally associated loader map.
Definition Slice.hpp:90
LoaderPriority
Enums specifying the priority for various loaders.
Definition Slice.hpp:56
MemSizeConfig< sizeof(void *)>::memsize_t memsize_t
Given a fragmented field of curvilinear coordinates, (3D array of coordinates), build a uniform Grid ...
Definition FAQ.dox:2
typename Ownable< OwnedObjectType, ContainerBase >::Container OwnerOf
Shortcut to find the owning type.
Definition Ownable.hpp:265
std::nullptr_t NullPtr
Definition HDF5Saver.hpp:34