CrystalSpace

Public API Reference

Main Page   Modules   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members   Related Pages  

iSCF Struct Reference
[Shared Class Facility (SCF)]

iSCF is the interface that allows using SCF functions from shared classes. More...

#include <scf.h>

Inheritance diagram for iSCF:

iBase List of all members.

Public Methods

virtual void RegisterClasses (iDocument *metadata, const char *context=0)=0
 Read additional class descriptions from the given iDocument.

virtual void RegisterClasses (char const *xml, const char *context=0)=0
 A convenience wrapper for RegisterClasses(iDocument).

virtual void RegisterClasses (const char *pluginPath, iDocument *metadata, const char *context=0)=0
 Read additional class descriptions from the given iDocument.

virtual bool ClassRegistered (const char *iClassID)=0
 Check whenever the class is present in SCF registry.

virtual void * CreateInstance (const char *iClassID, const char *iInterface, int iVersion)=0
 Create an instance of a class that supports given interface.

virtual const char * GetClassDescription (const char *iClassID)=0
 Query the description of a class.

virtual const char * GetClassDependencies (const char *iClassID)=0
 Query the dependency list for a class.

virtual void UnloadUnusedModules ()=0
 Unload all unused shared libraries (also called inside scfCreateInstance).

virtual bool RegisterClass (const char *iClassID, const char *iLibraryName, const char *iFactoryClass, const char *Description, const char *Dependencies=0, const char *context=0)=0
 Register a single dynamic class (implemented in a shared library).

virtual bool RegisterClass (scfFactoryFunc, const char *iClassID, const char *Description, const char *Dependencies=0, const char *context=0)=0
 Register a single dynamic class.

virtual bool RegisterFactoryFunc (scfFactoryFunc, const char *FactClass)=0
 Associate a factory function (the function which instantiates a class) with an implementation name (the value in the <implementation> node of the meta info; also the name of the iFactoryClass in RegisterClass).

virtual bool UnregisterClass (const char *iClassID)=0
 This function should be called to deregister a class at run-time.

virtual char const * GetInterfaceName (scfInterfaceID) const=0
 Return the name of an interface given an interface ID.

virtual scfInterfaceID GetInterfaceID (const char *iInterface)=0
 Return the interface ID number that belongs to the given interface.

virtual void Finish ()=0
 This function should be called to finish working with SCF.

virtual iStringArrayQueryClassList (char const *pattern)=0
 Retrieve a list of class names whose prefix matches a pattern string.

virtual void ScanPluginsPath (const char *path, bool recursive=false, const char *context=0)=0
 Scan a specified native path for plugins and auto-register them.

virtual bool RegisterPlugin (const char *path)=0
 Register a single plugin.


Static Public Attributes

iSCF * SCF
 This is the global instance of iSCF.


Detailed Description

iSCF is the interface that allows using SCF functions from shared classes.

Since there should be just one instance of SCF kernel, the shared classes should not use scfXXX functions directly; instead they should obtain a pointer to an iSCF object and work through that pointer.

Definition at line 816 of file scf.h.


Member Function Documentation

virtual bool iSCF::ClassRegistered const char *    iClassID [pure virtual]
 

Check whenever the class is present in SCF registry.

You can use this function to check whenever a class instance creation failed because the class is not present at all in the class registry, or it just doesn't support the requested interface.

virtual void* iSCF::CreateInstance const char *    iClassID,
const char *    iInterface,
int    iVersion
[pure virtual]
 

Create an instance of a class that supports given interface.

The function returns 0 either if such a class ID is not found in class registry, or a object of given class does not support given interface or supports an incompatible version of given interface. If you want to make a difference between these error conditions, you can check whenever such a class exists using scfClassRegistered() function.

If you specify 0 as iInterfaceID, you'll receive a pointer to the basic interface, no matter what it is. The reference count will be zero thus you should increment it yourself if you use this approach. You can treat the pointer returned just as an iBase*, not more. If you need more, do QueryInterface() on received pointer (this will also increment the reference counter).

virtual void iSCF::Finish   [pure virtual]
 

This function should be called to finish working with SCF.

This will not free shared objects but they should not be used anymore after calling this function since this will do a forced free of all loaded shared libraries.

virtual const char* iSCF::GetClassDependencies const char *    iClassID [pure virtual]
 

Query the dependency list for a class.

The format of dependency string is implementation-specific, SCF itself does not make any assumptions about the format of the string.

virtual const char* iSCF::GetClassDescription const char *    iClassID [pure virtual]
 

Query the description of a class.

NOTE: At least one instance of this class should exist, or the class should be a static class. Otherwise the function will return 0

virtual scfInterfaceID iSCF::GetInterfaceID const char *    iInterface [pure virtual]
 

Return the interface ID number that belongs to the given interface.

If the interface is unknown, a new ID is allocated. This number can be used to quickly determine whether two interfaces are equal.

virtual char const* iSCF::GetInterfaceName scfInterfaceID    const [pure virtual]
 

Return the name of an interface given an interface ID.

If the ID is unknown, null is returned.

virtual iStringArray* iSCF::QueryClassList char const *    pattern [pure virtual]
 

Retrieve a list of class names whose prefix matches a pattern string.

For example, QueryClassList("crystalspace.sound.loader.") will return a list of class names which begin with the string "crystalspace.sound.loader.". If pattern is zero length or the null pointer, then all registered class names are returned. If any class names match the pattern, then the return value is a list strings. If no class names match the pattern string, then the returned list is empty. It is the caller's responsibility to invoke DecRef() on the returned list when the list is no longer needed.

virtual bool iSCF::RegisterClass scfFactoryFunc   ,
const char *    iClassID,
const char *    Description,
const char *    Dependencies = 0,
const char *    context = 0
[pure virtual]
 

Register a single dynamic class.

This function tells SCF kernel that a specific class is implemented within a specific module (typically a static library, as opposed to a plugin module). You also can provide an application-specific dependency list.

virtual bool iSCF::RegisterClass const char *    iClassID,
const char *    iLibraryName,
const char *    iFactoryClass,
const char *    Description,
const char *    Dependencies = 0,
const char *    context = 0
[pure virtual]
 

Register a single dynamic class (implemented in a shared library).

This function tells SCF kernel that a specific class is implemented within a specific shared library. There can be multiple classes within a single shared library. You also can provide an application-specific dependency list. 'context' is an information about the source of the plugin. It primarily affects whether a class conflict is reported. If the same class already exists in the same context, a warning is emitted; if it's in a different context, only there is a notification only in debug mode.

virtual void iSCF::RegisterClasses const char *    pluginPath,
iDocument   metadata,
const char *    context = 0
[pure virtual]
 

Read additional class descriptions from the given iDocument.

virtual void iSCF::RegisterClasses char const *    xml,
const char *    context = 0
[pure virtual]
 

A convenience wrapper for RegisterClasses(iDocument).

Assumes that the string input argument is XML, which it wraps in an iDocument and then passes to RegisterClasses(iDocument).

virtual void iSCF::RegisterClasses iDocument   metadata,
const char *    context = 0
[pure virtual]
 

Read additional class descriptions from the given iDocument.

virtual bool iSCF::RegisterFactoryFunc scfFactoryFunc   ,
const char *    FactClass
[pure virtual]
 

Associate a factory function (the function which instantiates a class) with an implementation name (the value in the <implementation> node of the meta info; also the name of the iFactoryClass in RegisterClass).

Returns true upon sucess, or false if the class does not exist or already has an associated creation function.

virtual bool iSCF::RegisterPlugin const char *    path [pure virtual]
 

Register a single plugin.

Parameters:
path  (Almost) fully qualified native path to the plugin binary. 'Almost' because it doesn't have to be the actual binary - it is sufficient if the file name suffix is ".csplugin", no matter what the real extension for binaries on a platform is or whether there actually is an external .csplugin file.
Returns:
Whether loading of the plugin was successful.

virtual void iSCF::ScanPluginsPath const char *    path,
bool    recursive = false,
const char *    context = 0
[pure virtual]
 

Scan a specified native path for plugins and auto-register them.

virtual void iSCF::UnloadUnusedModules   [pure virtual]
 

Unload all unused shared libraries (also called inside scfCreateInstance).

If you want to be sure that all unused shared libraries are unloaded, call this function. It is automatically invoked inside scfCreateInstance(), thus it is called from time to time if you constantly create new objects.

virtual bool iSCF::UnregisterClass const char *    iClassID [pure virtual]
 

This function should be called to deregister a class at run-time.

By calling this function you will remove the description of a class, no matter whenever it is statically or dynamically linked, from the SCF registry.


Member Data Documentation

iSCF* iSCF::SCF [static]
 

This is the global instance of iSCF.

On most platforms, this instance is module-global (for instance, the application has an iSCF::SCF variable, and each plugin module has an iSCF::SCF variable).

Definition at line 823 of file scf.h.


The documentation for this struct was generated from the following file:
Generated for Crystal Space by doxygen 1.2.18