FiberVISH 0.2
Fish - The Fiber Bundle API for the Vish Visualization Shell
UnaryFieldOperatorObject.hpp
1#ifndef __FISH_UNARYFIELDOPERATOROBJECT_HPP
2#define __FISH_UNARYFIELDOPERATOROBJECT_HPP
3
4#include "FieldOperatorObject.hpp"
5#include <field/UnaryOperator.hpp>
6
7namespace Wizt
8{
9
45 template <class TheUnaryOperator,
46 class ResultType = typename TheUnaryOperator::InputType>
48{
50
51 using InputTypes = typename TheUnaryOperator::InputType;
52
53 VOutput<Fiber::Field> ResultField;
54
55 UnaryFieldOperatorObject(const string&name, int p = 0, const RefPtr<VCreationPreferences>&VP = NullPtr() )
56 : FieldOperatorObject(name, "inputfield", p, VP)
57 , ResultField(self(), "result")
58 {}
59
60 bool postFieldOperation(VRequest&Context, int NFields) override
61 {
63 if (NFields>0)
64 {
65 string NewFieldname = TheUnaryOperator::ResultFieldname( Fieldname(Context) );
67
69 OutputFieldSelection.selectTypedField<ResultType>( NewFieldname );
70
71 ResultField << Context << OutputFieldSelection;
72 }
73 else
74 {
75 ResultField << Context << FieldSelection;
76 }
77 return true;
78 }
79
81 Fiber::Representation&FieldRep//, Fiber::Representation&FieldIDSource
82 ) override
83 {
85 string NewFieldname = TheUnaryOperator::ResultFieldname( Fieldname(Context) );
86
87 Fiber::UnaryOperator<TheUnaryOperator,
88 typename TheUnaryOperator::InputType,
90
91 RefPtr<Fiber::FieldID> NewFieldID = FieldRep.createSharedFieldID(FieldIDSource, NewFieldname);
93 // check timing and parameters, possibly
95 {
96 if (RefPtr<Fiber::Field> ResultField = newComputationalField( MyOp, InputField) )
97 {
98 FieldRep[ NewFieldID] = ResultField;
99 }
100 }
101
102 return true;
103 }
104
105static string createChildname(const string&parent_name)
106 {
107 return TheUnaryOperator::ResultObjectname( parent_name );
108 }
109};
110
111}
112
113#endif // __FISH_UNARYFIELDOPERATOROBJECT_HPP
An iterator with an optional DataCreator, which is just a class to intercept creation of data along a...
Definition CreativeIterator.hpp:34
An abstract selection of fields, that is given by names of fields and possible types for each field.
Definition FieldSelection.hpp:23
An internal class that stores a couple of textual names.
Definition FieldSelector.hpp:18
A Field is a collection of CreativeArrayBase reference pointers which are accessed via FragmentID obj...
Definition Field.hpp:245
A Representation is a set of Field objects, each of them accessed via some FieldID identifier.
Definition Representation.hpp:101
bool isNewerThan(const Ageable &a) const noexcept
Base class for objects that operate on Field objects and create new fields.
Definition FieldOperatorObject.hpp:44
ComputationalField< FieldOperator > * newComputationalField(const FieldOperator &FO, const RefPtr< Field > &InputField, const MemCore::RefPtr< MemCore::Cache > &theCache=MemCore::Cache::MemCache())
A convenience template function to construct a computational field (class ComputationalField) from an...
Definition ComputationalField.hpp:266
std::nullptr_t NullPtr
note: cannot derive from FloatingSkeletonRenderer as long as independent base class TriangleRenderer ...
Implementing an unary operation on a fields with on-demand computation per fragment and discarding da...
Definition UnaryOperator.hpp:49
string Fieldname(const RefPtr< ValuePool > &VP) const
Get the name of the selected field.
Definition FishField.cpp:250
A Fish object implementing an unary operation on a field.
Definition UnaryFieldOperatorObject.hpp:48
bool FieldOperation(VRequest &Context, Fiber::Field &InputField, Fiber::Representation &FieldRep) override
The operation to be performed on the given field, to be overloaded in a subclass.
Definition UnaryFieldOperatorObject.hpp:80