The Vish Visualization Shell 0.3
Vish
Wizt::VCreator< DerivedVObject, AcceptedTypes > Class Template Reference

Given some VObject, this is the accompanying Creator object that may be used to create VObject's on request. More...

#include <ocean/plankton/VCreator.hpp>

Inheritance diagram for Wizt::VCreator< DerivedVObject, AcceptedTypes >:

Public Member Functions

VAcceptInfoList_t accept (const RefPtr< VObject > &vobj) const override
 Implementation of the acception function.
RefPtr< VObjectcreate (const VCreatorBase::CreationInfo &name, const Intercube &CreationContext, const RefPtr< VCreationPreferences > &AdditionalPreferences) const override
 Actually create the associated VObject on request from the base class.
string createChildname (const string &parent_name) const override
 Implementation of the child name creation functionality.
 VCreator (const VCreatorProperties &CreatorProperties, int quality, const RefPtr< VCreationPreferences > &prop=nullptr, const char *const CreatorReleaseIdentifier=VISH_CREATOR_RELEASE_IDENTIFIER)
 Construct a creator object with full properties specified.
template<unsigned ID>
 VCreator (const VCreatorProperty< ID > &CreatorProperties, int quality, const RefPtr< VCreationPreferences > &prop=nullptr, const char *const ReleaseIdentifier=VISH_CREATOR_RELEASE_IDENTIFIER)
 Construct a creator object with full properties specified.

(Note that these are not member symbols.)

template<unsigned ID1, unsigned ID2>
VCreatorProperty< ID1+ID2 > operator+ (const VCreatorProperty< ID1 > &l, const VCreatorProperty< ID2 > &r)
 Merge two properties via the + operator.
template<unsigned ID1, unsigned ID2>
VCreatorProperty< ID1+ID2 > operator/ (const VCreatorProperty< ID1 > &l, const VCreatorProperty< ID2 > &r)
 Merge two properties via the / operator, same as using the + operator (just another syntax).

Detailed Description

template<VObjectType DerivedVObject, class AcceptedTypes = typename DerivedVObject::AcceptableInputTypes>
class Wizt::VCreator< DerivedVObject, AcceptedTypes >

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 RefPtr<VAcceptInfo> accept(const RefPtr<VObject>&vobj) override
{
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;
Accepting arbitrary types directly as second argument of VCreator or VObject::AcceptableInputTypes .
Definition VCreator.hpp:54
An intermediate class that holds information about what kind of input objects a certain VObject accep...
Definition VAcceptInfo.hpp:32
StrongPtr< Object, ObjectBase > RefPtr
Convenience template typedef to use RefPtr instead of StrongPtr.
Definition RefPtr.hpp:776
std::nullptr_t NullPtr
A type indicating an invalid pointer, similar to the NULL pointer in C, but type-safe.
Definition DynPtr.hpp:368
The Vish namespace.
Definition Anemone.cpp:17
virtual VAcceptInfoList_t accept(const RefPtr< VObject > &) const =0
Virtual query function to check whether this creator may provide an VObject that uses the given objec...

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.

See also
Panthalassa syntax for improved object construction.

Constructor & Destructor Documentation

◆ VCreator() [1/2]

template<VObjectType DerivedVObject, class AcceptedTypes = typename DerivedVObject::AcceptableInputTypes>
Wizt::VCreator< DerivedVObject, AcceptedTypes >::VCreator ( const VCreatorProperties & CreatorProperties,
int quality,
const RefPtr< VCreationPreferences > & prop = nullptr,
const char *const CreatorReleaseIdentifier = VISH_CREATOR_RELEASE_IDENTIFIER )
inline

Construct a creator object with full properties specified.

Parameters
CreatorPropertiesThe properties of this creator, it is recommendable to make use of namespace Panthalassia or ProtoOcean.
qualityThe object's matureness, according to ObjectQuality

References Wizt::VCreatorPropertyBase::keyname(), Wizt::VCreatorBase(), and Wizt::Vprintf().

◆ VCreator() [2/2]

template<VObjectType DerivedVObject, class AcceptedTypes = typename DerivedVObject::AcceptableInputTypes>
template<unsigned ID>
Wizt::VCreator< DerivedVObject, AcceptedTypes >::VCreator ( const VCreatorProperty< ID > & CreatorProperties,
int quality,
const RefPtr< VCreationPreferences > & prop = nullptr,
const char *const ReleaseIdentifier = VISH_CREATOR_RELEASE_IDENTIFIER )
inline

Construct a creator object with full properties specified.

Parameters
CreatorPropertiesThe properties of this creator, it is recommendable to make use of namespace Panthalassia or ProtoOcean.
qualityThe object's matureness, according to ObjectQuality

Allows to create objects via Panthalassia syntax:

using namespace Panthalassa;
MyCreator(
Category("Display")
+ Identifier("ScalarValues")
+ Help("Display the values of a scalar field at the location of each vertex")
The Panthalassa namespace allows to conveniently specify the properties of a VCreator object during c...
Definition VCreatorProperties.hpp:385
Wizt::VCreatorProperty< Wizt::VCreatorProperties::TEXTIDENTIFIER > Identifier
Easy textual description, usable as identifier in scripts.
Definition VCreatorProperties.hpp:387
Wizt::VCreatorProperty< Wizt::VCreatorProperties::SHORTHELP > Help
Short help text, to be used for GUI tooltips, for instance.
Definition VCreatorProperties.hpp:393
Wizt::VCreatorProperty< Wizt::VCreatorProperties::CATEGORY > Category
Classification, such as Display or Computer or Demo.
Definition VCreatorProperties.hpp:390
Omega Pointer to a refcountable object which automatically destroys the object pointed to no matter h...
Definition OmegaPtr.hpp:84
@ MATURE
This object is mature enough to be used, use it if you like.
Definition ObjectQuality.hpp:32

References Wizt::getProperties(), Wizt::VCreatorBase(), and Wizt::Vprintf().

Member Function Documentation

◆ accept()

template<VObjectType DerivedVObject, class AcceptedTypes = typename DerivedVObject::AcceptableInputTypes>
VAcceptInfoList_t Wizt::VCreator< DerivedVObject, AcceptedTypes >::accept ( const RefPtr< VObject > & vobj) const
inlineoverride

Implementation of the acception function.

Calls the static accept() function of the DerivedVObject.

◆ create()

template<VObjectType DerivedVObject, class AcceptedTypes = typename DerivedVObject::AcceptableInputTypes>
RefPtr< VObject > Wizt::VCreator< DerivedVObject, AcceptedTypes >::create ( const VCreatorBase::CreationInfo & name,
const Intercube & CreationContext,
const RefPtr< VCreationPreferences > & AdditionalPreferences ) const
inlineoverride

Actually create the associated VObject on request from the base class.

Parameters
CreationContextAn Intercube that allows specifying additional parameters for the circumstances of creation. It is passed to the VActionNotifier::VObjectCreation() call.
Note
The VCreator object must be refcounted already since a strong pointer is used internally here when passing the creator object to all VActionNotifiers.

References Wizt::VActionNotifier::VObjectCreation(), and Wizt::Vprintf().

◆ createChildname()

template<VObjectType DerivedVObject, class AcceptedTypes = typename DerivedVObject::AcceptableInputTypes>
string Wizt::VCreator< DerivedVObject, AcceptedTypes >::createChildname ( const string & parent_name) const
inlineoverride

Implementation of the child name creation functionality.

By default, calls a static member function of the derived object on which this VCreator is instantiated.