FiberVISH 0.2
Fish - The Fiber Bundle API for the Vish Visualization Shell
FunctionalCreator.hpp
1#ifndef __FIBER_FIELD_FUNCTIONALCREATOR_HPP
2#define __FIBER_FIELD_FUNCTIONALCREATOR_HPP "Created 08.06.2015 13:12:27 by werner"
3
4#ifndef DONT_USE_PRAGMA_ONCE
5#pragma once
6#endif
7
8#include "CreativeArrayBase.hpp"
9#include <memcore/AlzheimerCreator.hpp>
10
11#include <future>
12#include <functional>
13
14namespace Fiber
15{
16
19class FIELD_API FunctionalCreatorBase : public MemCore::AlzheimerCreator<Fiber::MemBase, CreativeArrayBase>
20{
21protected:
22 std::future< RefPtr<MemBase> > AsynchroneouslyComputedData;
23
24 std::mutex production_mutex;
25
26 RefPtr<MemBase> produce() override;
27
28public:
30
31 bool DataProductionIsCheaperThanFunctor = true;
32
36 , DataProductionIsCheaperThanFunctor( DataReProductionIsCheaperThanFunctor )
37 {}
38
40
41 virtual RefPtr<MemBase> compute() const = 0;
42
43 bool isUnderCreation() const override;
44
45 bool request(const result&R) override;
46};
47
48
52{
53public:
54
55 using Functor = std::function< RefPtr<MemBase>() >;
56
58
59 Functor myFunctor;
60
61 FunctionalCreator(const Functor&theFunctor,
64
66
67 RefPtr<MemBase> compute() const override;
68};
69
70/*
71template <class Functor>
72RefPtr<FunctionalCreator<Functor>> newFunctionalCreator(const Functor&F)
73{
74 return new FunctionalCreator<Functor>(F);
75}
76*/
77
78template <class Functor>
79RefPtr<FunctionalCreator> newFunctionalCreator(const Functor&F)
80{
81 return new FunctionalCreator(F);
82}
83
84
85}
86
87#endif // __FIBER_FIELD_FUNCTIONALCREATOR_HPP
An iterator with an optional DataCreator, which is just a class to intercept creation of data along a...
Definition CreativeIterator.hpp:34
Definition FunctionalCreator.hpp:20
Definition FunctionalCreator.hpp:52
static RefPtr< Cache, CacheBase > & MemCache()
Given a fragmented field of curvilinear coordinates, (3D array of coordinates), build a uniform Grid ...
Definition FAQ.dox:2