FiberVISH 0.2
Fish - The Fiber Bundle API for the Vish Visualization Shell
AsynchronCreator.hpp
1#ifndef __FISH_BONE_ASYNCHRON_CREATOR_HPP
2#define __FISH_BONE_ASYNCHRON_CREATOR_HPP
3
4#include <field/MemBase.hpp>
5#include <field/CreativeArrayBase.hpp>
6#include <memcore/AlzheimerCreator.hpp>
7#include <future>
8
9
10namespace Fiber
11{
12
13
18class [[deprecated("Use FunctionalCreator instead")]]
19 FIELD_API AsynchronCreator : public MemCore::AlzheimerCreator<MemBase, CreativeArrayBase>
20{
21protected:
23
24 volatile long NumberOfLoadingOperations { 0 };
25 std::atomic<bool> isLoading { false };
26
27 std::atomic<bool> discardCreationFlag { false };
28
29 mutable std::mutex CreationMutex;
30 mutable std::mutex LoadingFlagMutex;
31
32 std::function< DataPtr_t(const std::atomic<bool>&Stop) > myDataCreator;
33
34 DataPtr_t create_data() const;
35
36mutable std::future<bool> AsynchroneouslyComputedData;
37
38static bool createData(const MemCore::WeakPtr<AsynchronCreator>&TheCreator, const result&R);
39
40public:
41 AsynchronCreator(const std::function< DataPtr_t(const std::atomic<bool>&) >&CreationFunctor,
43
45
47
48 const type_info&getType() override;
49
50 RefPtr<MemBase> produce() override;
51
52 bool request(const result&R) override;
53
54 bool isUnderCreation() const override;
55
56 bool discardCreation() override;
57
58 Creature::ReasonForReleasal release() override;
59
60#if 0
61 Creature::ReasonForReleasal release() override;
62
63 virtual RefPtr<Fiber::MemBase> compute() const = 0;
64
66 {
69
72
74
75 void run() override;
76
77 void valueChanged(const RefPtr<VValueBase>&value,
80 const ValueMap*VP=0) override;
81 };
82
84
85 bool isRunning() const;
86
87 RefPtr<MemBase> produce() override;
88
89 CacheablePtr getCacheable() const override
90 {
91 return result;
92 }
93
94 RefPtr<MemBase> get() const override
95 {
96 return result;
97 }
98
99/*
100TODO: Implement these functions:
101
102 virtual bool isUnderCreation();
103 virtual bool discardCreation();
104*/
105#endif
106};
107
108template <class Type>
110{
111public:
113 {}
114
115 const type_info&getType()
116 {
117 return typeid(Type);
118 }
119};
120
121} // namespace Wizt
122
123#endif // ASYNCHRON_CREATOR_HPP
constexpr const _Tp && get(const pair< _Tp, _Up > &&__p) noexcept
A Creator object that generates its content on demand.
Definition AsynchronCreator.hpp:20
An iterator with an optional DataCreator, which is just a class to intercept creation of data along a...
Definition CreativeIterator.hpp:34
A class describing an n-dimensional space at runtime.
Definition field/DynamicSize.hpp:29
Definition AsynchronCreator.hpp:110
static RefPtr< Cache, CacheBase > & MemCache()
const type_info & getType(const std::string &s)
Given a fragmented field of curvilinear coordinates, (3D array of coordinates), build a uniform Grid ...
Definition FAQ.dox:2