VISH
0.2
|
Given some VObject, this is the accompanying Creator object that may be used to create VObject's on request. More...
#include </home/werner/origo/vish/ocean/plankton/VCreator.hpp>
(Note that these are not member functions.)
Given some VObject, this is the accompanying Creator object that may be used to create VObject's on request.
The VObject must provide a constructor taking the new object's name and its priority number, which is forwarded from the creator's priority.
VCreator objects come with a property that tells whether the object it might create is suitable as output for a certain, existing VObject. A such, the existing VObject is to be checked for its properties to see if this VCreator is suitable for bearing a child object. This check is done through the virtual accept() member function. A specific VCreator may always overload this function to implement any operation.
The default VCreator utilizes a list of properties managed through the AcceptListIterator<> template. This one allows to specify a list of types. If any of these types is managed in the existing VObject, then the accept() function will return true. It is an OR of all properties.
The AcceptListIterator may also be used to implement operations on user defined types. For this, it needs to be specialized for a certain type and implement an accept() function such as in this following code snippet:
struct MyInspector {}; namespace Wizt { template <> class AcceptListIterator<MyInspector> { public: static override RefPtr<VAcceptInfo> accept(const RefPtr<VObject>&vobj) { puts("AcceptListIterator<SurfaceInspector>"); if (!vobj) return NullPtr(); if (vobj->implements( typeid(Fiber::BundlePtr) ) ) { // Vprintf(6, " AcceptListIterator: yep, accepted!\n" ); // printf(" AcceptListIterator: yep, accepted!\n" ); return new VAcceptInfo( typeid(Fiber::BundlePtr) ); } return NullPtr(); } }; } static VCreator<MyObject, AcceptList<MyInspector> >::global MyObjectCreator;
The accept() function may of course be arbitrarily complex. By default, there are accept list iterators implemented for native types (which are provided via output parameters of VObjects), and interfaces, that are attached to VObjects.
DemoSphere.cpp, exocoetida.cpp, MultiplyInt.cpp, PointSprite.cpp, and stockvish.cpp.
Wizt::VCreator::VCreator | ( | const VCreatorPropertyBase & | CreatorProperties, |
int | quality, | ||
const RefPtr< VCreationPreferences > & | prop = NullPtr() |
||
) | [inline] |
Construct a creator object with full properties specified.
CreatorProperties | The properties of this creator, it is recommendable to make use of namespace Panthalassia or ProtoOcean. |
quality | The object's matureness, according to ObjectQuality |
Wizt::VCreator::VCreator | ( | const VCreatorProperty< ID > & | CreatorProperties, |
int | quality, | ||
const RefPtr< VCreationPreferences > & | prop = NullPtr() |
||
) | [inline] |
Construct a creator object with full properties specified.
CreatorProperties | The properties of this creator, it is recommendable to make use of namespace Panthalassia or ProtoOcean. |
quality | The object's matureness, according to ObjectQuality |
Allows to create objects via Panthalassia syntax:
using namespace Panthalassa; static Ref<VCreator<myObject> > MyCreator( Category("Display") + Identifier("ScalarValues") + Help("Display the values of a scalar field at the location of each vertex") , ObjectQuality::MATURE);
override VAcceptInfoList_t Wizt::VCreator::accept | ( | const RefPtr< VObject > & | vobj | ) | const [inline, virtual] |
Implementation of the acception function.
Calls the static accept() function of the DerivedVObject.
Implements Wizt::VCreatorBase.
override RefPtr<VObject> Wizt::VCreator::create | ( | const string & | s, |
const Intercube & | CreationContext | ||
) | const [inline, virtual] |
Actually create the associated VObject on request from the base class.
CreationContext | An Intercube that allows specifying additional parameters for the circumstances of creation. It is passed to the VActionNotifier::VObjectCreation() call. |
Implements Wizt::VCreatorBase.
override string Wizt::VCreator::createChildname | ( | const string & | parent_name | ) | const [inline, virtual] |
Implementation of the child name creation functionality.
By default, calls a static member function of the derived object on which this VCreator is instantiated.
Reimplemented from Wizt::VCreatorBase.