|
The Vish Visualization Shell 0.3
Vish
|
Database for routines that may create objects of type X. More...
#include <elementary/memcore/Loader.hpp>
Static Public Member Functions | |
| static void | getSupportedExtensions (list< string > &SupportedExtensions) |
| Extend the given list of possible extensions. | |
| static bool | isloadable (const RefPtr< LoaderParameters > &LP) |
| Check whether some loader parameters might be handable here. | |
| static RefPtr< X > | load (bool &success, const RefPtr< LoaderParameters > &LP, const RefPtr< X > &xptr=NullPtr()) |
| Actually load some object from the input source. | |
| static RefPtr< LoaderRequest > | request (const RefPtr< LoaderParameters > &LP, const RefPtr< X > &xptr=NullPtr()) |
| Actually load some object from the input source. | |
Additional Inherited Members | |
Static Protected Member Functions inherited from MemCore::LoaderRegistryBase | |
| static void | domain_append (const type_info &id, const RefPtr< LoaderBase > &ldr, const type_info &Domain) |
Database for routines that may create objects of type X.
The LoaderRegistry class allows to actually create objects of type X from a certain input source. The input source is specified through the LoaderParameters class, which may carry arbitrary additional interfaces.
Implementation of a new Loader:
Consider a type Bundle to be created from some input source.
We introduce an artificial type, here called HDF5
with no other purpose as to provide a unique typeid in C++. We implement a loader by deriving from the Loader<Bundle> base class:
The name of this class is not of relevance. We now add an instance of this loader to the LoaderRegistry for the Bundle type:
Now we have the means to iterate over all loaders which have been registered for the type Bundle. This iteration is implemented in function LoaderRegistryBase::domain_load() as a static function, or easier as LoaderRegistry<Bundle>::load();