The Vish Visualization Shell 0.3
Vish
Public Member Functions | Static Public Member Functions | List of all members
Wizt::TypedSlotCreator Class Referenceabstract

A registry for the runtime-creation of typed slots, allowing creation of type-specific VObject input parameters without knowing their types explicitly. More...

#include <ocean/plankton/VSlot.hpp>

Inheritance diagram for Wizt::TypedSlotCreator:
MemCore::ReferenceBase< TypedSlotCreator > Wizt::TypedSlot< T >::SlotCreator

Public Member Functions

virtual RefPtr< VSlotnewSlot (VSlotContainer *that, const string &name, const string &InitialValue, bool &Initialized, const RefPtr< VCreationPreferences > &VP, int ExpertLevel) const =0
 The virtual slot creation function.
 
 TypedSlotCreator ()
 default constructor
 
 ~TypedSlotCreator ()
 Destructor, cleans up registry.
 
- Public Member Functions inherited from MemCore::ReferenceBase< TypedSlotCreator >
auto getObjectCountID () const noexcept
 Get a unique ID for this object in the given domain.
 
bool isIdentical (const WeakPtr< TypedSlotCreator, TypedSlotCreator > &PossibleSelf) const noexcept
 Check if this object is identical to the one used by the given pointer.
 
void mkAutoDestructive ()
 Marks this object as being automatically destructed, e.g.
 
refcount_t refcount () const noexcept
 The strong reference count.
 
 ReferenceBase (TypedSlotCreator *that) noexcept
 Constructor, initializes reference counter to zero.
 
const auto & self () const
 Return weak pointer to the object self.
 
refcount_t wrefcount () const noexcept
 The weak reference count.
 

Static Public Member Functions

static WeakPtr< TypedSlotCreator, TypedSlotCreatorgetTypedSlotCreator (const string &Typename)
 Lookup a slot creator by name of the type.
 
static WeakPtr< TypedSlotCreator, TypedSlotCreatorgetTypedSlotCreator (const type_info &theTypeID)
 Lookup a slot creator by type ID.
 
static void registerTypedSlotCreator (const type_info &theType, const WeakPtr< TypedSlotCreator, TypedSlotCreator > &who, const string &name)
 Add an instance of a type-specific SlotCreator to the registry.
 

Additional Inherited Members

- Public Types inherited from MemCore::ReferenceBase< TypedSlotCreator >
using reference_domain_t = TypedSlotCreator
 The type of the base class.
 
using SelfPtr_t = WeakPtr< TypedSlotCreator, TypedSlotCreator >
 Type for a pointer to this object itself.
 
- Protected Member Functions inherited from MemCore::ReferenceBase< TypedSlotCreator >
virtual void extremeUnction ()
 A virtual function that will be called just before the object is destroyed.
 
ReferenceBaseoperator= (const ReferenceBase &R)
 Protected assignment operator (should not be called).
 
void suicide ()
 Delete this.
 
virtual ~ReferenceBase ()
 Virtual destructor.
 

Detailed Description

A registry for the runtime-creation of typed slots, allowing creation of type-specific VObject input parameters without knowing their types explicitly.

Usage:

{
RefPtr<VSlot> mySlot = TC->newSlot( ... );
}
A reference counting pointer class which keeps objects alive as long as strong pointers to these obje...
Definition RefPtr.hpp:405
static WeakPtr< TypedSlotCreator, TypedSlotCreator > getTypedSlotCreator(const string &Typename)
Lookup a slot creator by name of the type.
Definition VSlot.cpp:334

Constructor & Destructor Documentation

◆ ~TypedSlotCreator()

Wizt::TypedSlotCreator::~TypedSlotCreator ( )

Destructor, cleans up registry.

It will be called when a type is defined in a plugin and the plugin is unloaded.

Member Function Documentation

◆ newSlot()

virtual RefPtr< VSlot > Wizt::TypedSlotCreator::newSlot ( VSlotContainer that,
const string &  name,
const string &  InitialValue,
bool &  Initialized,
const RefPtr< VCreationPreferences > &  VP,
int  ExpertLevel 
) const
pure virtual

The virtual slot creation function.

Parameters
InitialValueAn initial value encoded as string, utilizing the VValueTrait<> template to convert into the actual type.
InitializedFlag telling wether the slot could be initialized successfully from the given initial value. If that one is invalid, for instance it could not be parsed correctly for the final type, then the Slot will be initialized with the default constructor of the given type.

Implemented in Wizt::TypedSlot< T >::SlotCreator.

◆ registerTypedSlotCreator()

void Wizt::TypedSlotCreator::registerTypedSlotCreator ( const type_info &  theType,
const WeakPtr< TypedSlotCreator, TypedSlotCreator > &  who,
const string &  name 
)
static

Add an instance of a type-specific SlotCreator to the registry.

Parameters
theTypeThe typeid of the value that are operated on
whoA static SlotCreator as provided by TypedSlotCreator<>::getCreator();

Referenced by Wizt::TypedSlot< T >::SlotCreator::SlotCreator().