CrystalSpace

Public API Reference

Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

Shared Class Facility (SCF)


Classes

struct  iBase
 This is the basic interface: all other interfaces should be derived from this one, this will allow us to always use at least some minimal functionality given any interface pointer. More...
struct  iComponent
 This interface describes a generic component in Crystal Space. More...
struct  iFactory
 iFactory is an interface that is used to create instances of shared classes. More...
struct  iObjectRegistry
 This interface serves as a registry of other objects. More...
struct  iObjectRegistry
 This interface serves as a registry of other objects. More...
struct  iObjectRegistryIterator
 Use an instance of this class to iterate over objects in the object registry. More...
struct  iObjectRegistryIterator
 Use an instance of this class to iterate over objects in the object registry. More...
struct  iPluginIterator
 An iterator to iterate over all plugins in the plugin manager. More...
struct  iPluginIterator
 An iterator to iterate over all plugins in the plugin manager. More...
struct  iPluginManager
 This is the plugin manager. More...
struct  iPluginManager
 This is the plugin manager. More...
struct  iSCF
 iSCF is the interface that allows using SCF functions from shared classes. More...
class  scfFakeInterface< If >
 Fugly helper to resolve some bad situations. More...
class  scfImplementation< Class >
 Baseclass for the SCF implementation templates. More...
class  scfInterfaceTraits< Interface >
 Interface information query class. More...
void scfRegisterStaticClass (scfFactoryFunc, const char *iClassID, const char *Description, const char *Dependencies=0)
 Register a static class.
void scfRegisterStaticClasses (char const *xml)
 Register a static class.
void scfRegisterStaticFactoryFunc (scfFactoryFunc, const char *FactClass)
 Register a static class.

Defines

#define CS_LOAD_PLUGIN(Object, ClassID, Interface)   csLoadPlugin<Interface> (Object, ClassID)
#define CS_LOAD_PLUGIN_ALWAYS(Object, ClassID)   csLoadPluginAlways (Object, ClassID)
#define CS_QUERY_PLUGIN_CLASS(Object, ClassID, Interface)   csQueryPluginClass<Interface> (Object, ClassID)
 Compatbility macro.
#define CS_QUERY_REGISTRY_PLUGIN(obj, object_reg, scf_id, interface)
 Use this macro to query the object registry, loading a plugin if needed.
#define CS_TYPENAME(x)   0
#define SCF_CONSTRUCT_EMBEDDED_IBASE(Interface)
 The SCF_CONSTRUCT_EMBEDDED_IBASE macro should be invoked inside the constructor of a class that has an embedded interface (not inside the constructor of the embedded interface).
#define SCF_CONSTRUCT_IBASE(Parent)
 The SCF_CONSTRUCT_IBASE macro should be invoked inside the constructor of a class (not inside an embedded interface).
#define SCF_CONSTRUCT_IBASE_POOLED(Pool)
 Has to be invoked inside the class constructor instead of SCF_CONSTRUCT_IBASE.
#define SCF_CONSTRUCT_VERSION(Major, Minor, Micro)   ((Major << 24) | (Minor << 16) | Micro)
 Use this macro to construct interface version numbers.
#define SCF_CREATE_INSTANCE(ClassID, Interface)   scfCreateInstance<Interface> (ClassID)
#define SCF_DECLARE_EMBEDDED_IBASE(OuterClass)
 SCF_DECLARE_EMBEDDED_IBASE is used to declare the methods of iBase inside an embedded class that is exposed via QueryInterface.
#define SCF_DECLARE_IBASE
 This macro should be embedded into any SCF-capable class definition to declare the minimal functionality required by iBase interface.
#define SCF_DECLARE_IBASE_EXT(ParentClass)
 The following macro is used in "expansion SCF classes".
#define SCF_DECLARE_IBASE_POOLED(parentClass)   SCF_DECLARE_IBASE_POOLED_DECL(class, parentClass)
 Embed this macro instead of SCF_DECLARE_IBASE into an SCF class that is to be pooled.
#define SCF_DECLARE_IBASE_POOLED_DECL(Class, parentClass)
#define SCF_DECLARE_IBASE_POOLED_EXTERN(Extern, parentClass)   SCF_DECLARE_IBASE_POOLED_DECL(class Extern, parentClass)
 Same as SCF_DECLARE_IBASE_POOLED, use for external classes.
#define SCF_DEFINE_FACTORY_FUNC_REGISTRATION(Class)
 Define the C++ class needed to register an SCF class, but don't do any automatic registration.
#define SCF_DESTRUCT_EMBEDDED_IBASE(Interface)
 The SCF_DESTRUCT_EMBEDDED_IBASE macro should be invoked inside the destructor of a class that has an embedded interface (not inside the destructor of the embedded interface).
#define SCF_DESTRUCT_IBASE()
 The SCF_DESTRUCT_IBASE macro should be invoked inside the destructor of a class (not inside an embedded interface).
#define SCF_IMPL_N   5
#define SCF_IMPL_N   4
#define SCF_IMPL_N   3
#define SCF_IMPL_N   2
#define SCF_IMPL_N   1
#define SCF_IMPL_N   6
#define SCF_IMPL_N   5
#define SCF_IMPL_N   4
#define SCF_IMPL_N   3
#define SCF_IMPL_N   2
#define SCF_IMPL_N   1
#define SCF_IMPLEMENT_EMBEDDED_IBASE(Class)
 SCF_IMPLEMENT_EMBEDDED_IBASE should be used to implement embedded interfaces derived from iBase.
#define SCF_IMPLEMENT_EMBEDDED_IBASE_DECREF(Class)
 The SCF_IMPLEMENT_EMBEDDED_IBASE_DECREF() macro implements the DecRef() method for an embedded class in a C++ source module.
#define SCF_IMPLEMENT_EMBEDDED_IBASE_END   SCF_IMPLEMENT_EMBEDDED_IBASE_QUERY_END
 The SCF_IMPLEMENT_EMBEDDED_IBASE_END macro is used to finish an SCF_IMPLEMENT_EMBEDDED_IBASE definition.
#define SCF_IMPLEMENT_EMBEDDED_IBASE_GETREFCOUNT(Class)
 The SCF_IMPLEMENT_EMBEDDED_IBASE_GETREFCOUNT() macro implements the GetRefCount() method for an embedded class in a C++ source module.
#define SCF_IMPLEMENT_EMBEDDED_IBASE_INCREF(Class)
 The SCF_IMPLEMENT_EMBEDDED_IBASE_INCREF() macro implements the IncRef() method for an embedded class in a C++ source module.
#define SCF_IMPLEMENT_EMBEDDED_IBASE_QUERY(Class)
 The SCF_IMPLEMENT_EMBEDDED_IBASE_QUERY() macro implements the opening boilerplate for the QueryInterface() method for an embedded class in a C++ source module.
#define SCF_IMPLEMENT_EMBEDDED_IBASE_QUERY_END
 The SCF_IMPLEMENT_EMBEDDED_IBASE_QUERY_END macro implements the closing boilerplate for the QueryInterface() method for a class in an embedded C++ source module.
#define SCF_IMPLEMENT_EMBEDDED_IBASE_REFOWNER(Class)
 The SCF_IMPLEMENT_EMBEDDED_IBASE_REFOWNER() macro implements the AddRefOwner() and RemoveRefOwner() for a weak reference.
#define SCF_IMPLEMENT_FACTORY(Class)
 The SCF_IMPLEMENT_FACTORY macro is used to define a factory for one of exported classes.
#define SCF_IMPLEMENT_FACTORY_CREATE(Class)
 The SCF_IMPLEMENT_FACTORY_CREATE macro is used to define a factory for one of exported classes.
#define SCF_IMPLEMENT_FACTORY_FINIS(Class)
 The SCF_IMPLEMENT_FACTORY_FINIS macro defines finalization code for a plugin module.
#define SCF_IMPLEMENT_FACTORY_INIT(Class)
 The SCF_IMPLEMENT_FACTORY_INIT macro defines initialization code for a plugin module.
#define SCF_IMPLEMENT_IBASE(Class)
 The SCF_IMPLEMENT_IBASE() macro should be used within the C++ source module that implements a interface derived from iBase.
#define SCF_IMPLEMENT_IBASE_DECREF(Class)
 The SCF_IMPLEMENT_IBASE_DECREF() macro implements the DecRef() method for a class in a C++ source module.
#define SCF_IMPLEMENT_IBASE_DECREF_POOLED(Class)
 Implement DecRef() for a pooled class.
#define SCF_IMPLEMENT_IBASE_END   SCF_IMPLEMENT_IBASE_QUERY_END
 The SCF_IMPLEMENT_IBASE_END macro is used to finish an SCF_IMPLEMENT_IBASE definition.
#define SCF_IMPLEMENT_IBASE_EXT(Class)
 This macro implements same functionality as SCF_IMPLEMENT_IBASE except that it should be used for expansion SCF classes.
#define SCF_IMPLEMENT_IBASE_EXT_DECREF(Class)
 The SCF_IMPLEMENT_IBASE_EXT_DECREF() macro implements the DecRef() method for a class extending another SCF class in a C++ source module.
#define SCF_IMPLEMENT_IBASE_EXT_END   SCF_IMPLEMENT_IBASE_EXT_QUERY_END
 This macro implements same functionality as SCF_IMPLEMENT_IBASE_END except that it is used for expansion SCF classes.
#define SCF_IMPLEMENT_IBASE_EXT_GETREFCOUNT(Class)
 The SCF_IMPLEMENT_IBASE_EXT_GETREFCOUNT() macro implements the GetRefCount() method for a class extending another SCF class in a C++ source module.
#define SCF_IMPLEMENT_IBASE_EXT_INCREF(Class)
 The SCF_IMPLEMENT_IBASE_EXT_INCREF() macro implements the IncRef() method for a class extending another SCF class in a C++ source module.
#define SCF_IMPLEMENT_IBASE_EXT_QUERY(Class)
 The SCF_IMPLEMENT_IBASE_EXT_QUERY() macro implements the opening boilerplate for the QueryInterface() method for a class extending another SCF class in a C++ source module.
#define SCF_IMPLEMENT_IBASE_EXT_QUERY_END
 The SCF_IMPLEMENT_IBASE_EXT_QUERY_END macro implements the closing boilerplate for the QueryInterface() method for a class extending another SCF class in a C++ source module.
#define SCF_IMPLEMENT_IBASE_EXT_REFOWNER(Class)
 The SCF_IMPLEMENT_IBASE_EXT_REFOWNER() macro implements the AddRefOwner() and RemoveRefOwner() for a weak reference.
#define SCF_IMPLEMENT_IBASE_GETREFCOUNT(Class)
 The SCF_IMPLEMENT_IBASE_GETREFCOUNT() macro implements GetRefCount() for a class in a C++ source module.
#define SCF_IMPLEMENT_IBASE_INCREF(Class)
 The SCF_IMPLEMENT_IBASE_INCREF() macro implements the IncRef() method for a class in a C++ source module.
#define SCF_IMPLEMENT_IBASE_INCREF_POOLED(Class)
 Implement IncRef() for a pooled class.
#define SCF_IMPLEMENT_IBASE_POOL(Class)
 Implement pool manager for Class.
#define SCF_IMPLEMENT_IBASE_POOL_ALLOC(Class)
 Implement Alloc() for the pool manager of Class.
#define SCF_IMPLEMENT_IBASE_POOL_CTOR(Class)
 Implement the constructor for the pool manager of Class.
#define SCF_IMPLEMENT_IBASE_POOL_DTOR(Class)
 Implement the destructor for the pool manager of Class.
#define SCF_IMPLEMENT_IBASE_POOL_HELPERS(parentClass)
#define SCF_IMPLEMENT_IBASE_POOL_RECYCLE(Class)
 Implement Recycle() for the pool manager of Class.
#define SCF_IMPLEMENT_IBASE_POOLED(Class)
 Use this in the source module instead of SCF_IMPLEMENT_IBASE.
#define SCF_IMPLEMENT_IBASE_QUERY(Class)
 The SCF_IMPLEMENT_IBASE_QUERY() macro implements the opening boilerplate for the QueryInterface() method for a class in a C++ source module.
#define SCF_IMPLEMENT_IBASE_QUERY_END
 The SCF_IMPLEMENT_IBASE_QUERY_END macro implements the closing boilerplate for the QueryInterface() method for a class in a C++ source module.
#define SCF_IMPLEMENT_IBASE_REFOWNER(Class)
 The SCF_IMPLEMENT_IBASE_REFOWNER() macro implements the AddRefOwner() and RemoveRefOwner() for a weak reference.
#define SCF_IMPLEMENT_IBASE_REMOVE_REF_OWNERS(Class)
 The SCF_IMPLEMENT_IBASE_REMOVE_REF_OWNERS() macro implements the scfRemoveRefOwners() method for a class in a C++ source module.
#define SCF_IMPLEMENTS_EMBEDDED_INTERFACE(Interface)   SCF_IMPLEMENTS_INTERFACE_COMMON (Interface, (&scf##Interface))
 IMPLEMENT_EMBEDDED_INTERFACE is same as IMPLEMENT_INTERFACE but is used when class implements the interface as an embedded member.
#define SCF_IMPLEMENTS_INTERFACE(Interface)
 The IMPLEMENT_INTERFACE macro is used inside QueryInterface function to check if user requested a specific interface, whenever requested version of the interface correspond to the version we have and to return a pointer to that interface if everything is correct.
#define SCF_IMPLEMENTS_INTERFACE_COMMON(Interface, Object)
 This is a common macro used in all IMPLEMENTS_XXX_INTERFACE macros.
#define SCF_IN_IMPLEMENTATION_H   1
#define SCF_INIT_TRACKER_ALIASES
#define SCF_INTERFACE(Name, Major, Minor, Micro)
 SCF_INTERFACE can be used to define an interface's version number; you should specify interface name and major, minor and micro version components.
#define SCF_PRINT_CALL_ADDRESS
 Macro for getting the address we were called from (stack backtracing).
#define SCF_QUERY_INTERFACE(Object, Interface)   scfQueryInterface<Interface> (Object)
#define SCF_QUERY_INTERFACE_SAFE(Object, Interface)   scfQueryInterfaceSafe<Interface> (Object)
#define SCF_REGISTER_FACTORY_FUNC(Class)
 Used in conjunction with SCF_REGISTER_STATIC_LIBRARY to ensure that a reference to the class(es) registered via SCF_REGISTER_STATIC_LIBRARY are actually linked into the application.
#define SCF_REGISTER_STATIC_CLASS(Class, Ident, Desc, Dep)
 Automatically register a built-in class with SCF during startup.
#define SCF_REGISTER_STATIC_LIBRARY(Module, MetaInfo)
 Automatically register a static library with SCF during startup.
#define SCF_STATIC_CLASS_CONTEXT   "*static*"
#define SCF_TRACE(x)
 Macro for typing debug strings: Add #define SCF_DEBUG at the top of modules you want to track miscelaneous SCF activity and recompile.
#define SCF_USE_STATIC_PLUGIN(Module)
 Register a statically linked plugin.
#define SCF_VERSION(Name, Major, Minor, Micro)
 FOR COMPATIBILITY! SCF_VERSION can be used to define an interface's version number; you should specify interface name and major, minor and micro version components.

Typedefs

typedef iBase *(* scfFactoryFunc )(iBase *)
 Type of factory function which creates an instance of an SCF class.
typedef unsigned long scfInterfaceID
 Type of registered interface handle used by iBase::QueryInterface().
typedef int scfInterfaceVersion
 Type of interface version used by iBase::QueryInterface().

Enumerations

enum  {
  SCF_VERBOSE_NONE = 0, SCF_VERBOSE_PLUGIN_SCAN = 1 << 0, SCF_VERBOSE_PLUGIN_LOAD = 1 << 1, SCF_VERBOSE_PLUGIN_REGISTER = 1 << 2,
  SCF_VERBOSE_CLASS_REGISTER = 1 << 3, SCF_VERBOSE_ALL = ~0
}
 SCF verbosity flags. More...

Functions

template<class Interface>
csPtr< Interface > csLoadPlugin (iPluginManager *mgr, const char *ClassID)
 Tell plugin manager to load a plugin.
csPtr< iBasecsLoadPluginAlways (iPluginManager *mgr, const char *ClassID)
 Same as csLoadPlugin() but does not bother asking for a interface.
template<class Interface>
csPtr< Interface > csQueryPluginClass (iPluginManager *mgr, const char *ClassID)
 Find a plugin by its class ID.
static CS_FORCEINLINE bool scfCompatibleVersion (scfInterfaceVersion iVersion, scfInterfaceVersion iItfVersion)
 This function checks whenever an interface is compatible with given version.
template<class Interface>
csPtr< Interface > scfCreateInstance (char const *const ClassID)
 Handy function to create an instance of a shared class.
void scfInitialize (int argc, const char *const argv[])
 This function should be called to initialize client SCF library.
void scfInitialize (csPathsList const *pluginPaths, unsigned int verbose=SCF_VERBOSE_NONE)
 This function should be called to initialize client SCF library.
template<class Interface, class ClassPtr>
csPtr< Interface > scfQueryInterface (ClassPtr object)
 Helper function around iBase::QueryInterface.
template<class Interface, class ClassPtr>
csPtr< Interface > scfQueryInterfaceSafe (ClassPtr object)
 Helper function around iBase::QueryInterface which also does null-check of object.

Define Documentation

#define CS_LOAD_PLUGIN Object,
ClassID,
Interface   )     csLoadPlugin<Interface> (Object, ClassID)
 

Deprecated:
Compatibility macro.
See also:
csLoadPlugin<Interface> (mgr, ClassID);

Definition at line 222 of file plugin.h.

#define CS_LOAD_PLUGIN_ALWAYS Object,
ClassID   )     csLoadPluginAlways (Object, ClassID)
 

Deprecated:
Compatibility macro.
See also:
csLoadPluginAlways (mgr, ClassID);

Definition at line 240 of file plugin.h.

#define CS_QUERY_PLUGIN_CLASS Object,
ClassID,
Interface   )     csQueryPluginClass<Interface> (Object, ClassID)
 

Compatbility macro.

See also:
csQueryPluginClass<Interface> (Object, ClassID);

Definition at line 192 of file plugin.h.

#define CS_QUERY_REGISTRY_PLUGIN obj,
object_reg,
scf_id,
interface   ) 
 

Value:

do { \
  obj = CS_QUERY_REGISTRY(object_reg, interface); \
  if (!obj.IsValid()) \
  { \
    csRef<iPluginManager> mgr = CS_QUERY_REGISTRY(object_reg,iPluginManager); \
    if (!mgr.IsValid()) \
    { \
      csReport(object_reg, CS_REPORTER_SEVERITY_ERROR, \
        "crystalspace.plugin.query", "Plugin manager missing from " \
        "object-registry when attempting to query/load class: %s", scf_id); \
    } \
    obj = CS_LOAD_PLUGIN(mgr, scf_id, interface); \
    if (!obj.IsValid()) \
    { \
      csReport(object_reg, CS_REPORTER_SEVERITY_WARNING, \
        "crystalspace.plugin.query", "Failed to load class \"%s\" with " \
        "interface \"" #interface "\"", scf_id); \
    } \
    if (!object_reg->Register(obj, #interface)) \
    { \
      csReport(object_reg, CS_REPORTER_SEVERITY_WARNING, \
        "crystalspace.plugin.query", "Failed to register class \"%s\" with " \
        "tag \"" #interface "\" in the object-registry.", scf_id); \
    } \
  } \
} while (0)
Use this macro to query the object registry, loading a plugin if needed.

If an object with a given interface exists in an object registry, get that object from the registry. If the registry query fails, try to load a plugin and get the interface from there. If that succeeds, the interface is added to the registry for future use and given a tag the same name as the requested interface. Example use:

 csRef<iDynamics> dynamic_system;
 CS_QUERY_REGISTRY_PLUGIN(dynamic_system, object_reg, 
   "crystalspace.dynamics.ode", iDynamics);

Parameters:
obj csRef to hold the discovered or created/loaded object.
object_reg The object registry (of type iObjectRegistry).
scf_id The requested SCF class name (ex. "crystalspace.dynamice.ode")
interface The interface to requested from class scf_id (ex. iDynamics). This argument is also stringified and used as the objects tag in the registry.
Todo:
This probably ought to be made more thread-safe by locking the object registry if possible.

Definition at line 59 of file plugin.h.

#define SCF_CONSTRUCT_EMBEDDED_IBASE Interface   ) 
 

Value:

Interface.scfParent = this;                                             \
  csRefTrackerAccess::AddAlias (&Interface, this);
The SCF_CONSTRUCT_EMBEDDED_IBASE macro should be invoked inside the constructor of a class that has an embedded interface (not inside the constructor of the embedded interface).

The macro will initialize the pointer to the parent object (to the object this one is embedded into). The argument to this macro is the name of the parent's instance variable by which the embedded object is known (typically something like `scfiFooBar').

Definition at line 142 of file scf.h.

#define SCF_CONSTRUCT_IBASE Parent   ) 
 

Value:

csRefTrackerAccess::TrackConstruction (this);                           \
  csRefTrackerAccess::SetDescription (this, CS_TYPENAME(*this));        \
  scfRefCount = 1;                                                      \
  scfWeakRefOwners = 0;                                                 \
  scfParent = Parent; if (scfParent) scfParent->IncRef();               \
  SCF_INIT_TRACKER_ALIASES
The SCF_CONSTRUCT_IBASE macro should be invoked inside the constructor of a class (not inside an embedded interface).

Normally each constructor should accept an iBase* parameter (that is passed by scfCreateInstance function) which should be passed to this macro. The macro will zero the reference count and initialize the pointer to the parent object. If the object is unparented (a common case), it is okay to use null as the argument to this macro.

Definition at line 125 of file scf.h.

Referenced by csDataBuffer::csDataBuffer(), csEventAttributeIterator::csEventAttributeIterator(), csParasiticDataBuffer::csParasiticDataBuffer(), csScfStringSet::csScfStringSet(), csVerbosityManager::csVerbosityManager(), scfString::scfString(), and scfStringArray::scfStringArray().

#define SCF_CONSTRUCT_IBASE_POOLED Pool   ) 
 

Value:

SCF_CONSTRUCT_IBASE(0);                               \
  scfPool = (Pool)
Has to be invoked inside the class constructor instead of SCF_CONSTRUCT_IBASE.

Definition at line 88 of file pooledscfclass.h.

Referenced by csParasiticDataBufferPooled::csParasiticDataBufferPooled().

#define SCF_CONSTRUCT_VERSION Major,
Minor,
Micro   )     ((Major << 24) | (Minor << 16) | Micro)
 

Use this macro to construct interface version numbers.

Definition at line 80 of file scf_interface.h.

#define SCF_DECLARE_EMBEDDED_IBASE OuterClass   ) 
 

Value:

public:                                                                 \
  OuterClass *scfParent;        /* The parent object */                 \
  virtual void IncRef ();                                               \
  virtual void DecRef ();                                               \
  virtual int GetRefCount ();                                           \
  virtual void AddRefOwner (iBase** ref_owner);                         \
  virtual void RemoveRefOwner (iBase** ref_owner);                      \
  virtual void *QueryInterface (scfInterfaceID iInterfaceID, int iVersion)
SCF_DECLARE_EMBEDDED_IBASE is used to declare the methods of iBase inside an embedded class that is exposed via QueryInterface.

..

Definition at line 106 of file scf.h.

#define SCF_DECLARE_IBASE
 

Value:

int scfRefCount;                /* Reference counter */                 \
  csArray<iBase**>* scfWeakRefOwners;                                   \
  void scfRemoveRefOwners ();                                           \
  SCF_DECLARE_EMBEDDED_IBASE (iBase)
This macro should be embedded into any SCF-capable class definition to declare the minimal functionality required by iBase interface.

Definition at line 96 of file scf.h.

#define SCF_DECLARE_IBASE_EXT ParentClass   ) 
 

Value:

typedef ParentClass __scf_superclass;                                   \
  virtual void IncRef ();                                               \
  virtual void DecRef ();                                               \
  virtual int GetRefCount ();                                           \
  virtual void AddRefOwner (iBase** ref_owner);                         \
  virtual void RemoveRefOwner (iBase** ref_owner);                      \
  virtual void *QueryInterface (scfInterfaceID iInterfaceID, int iVersion)
The following macro is used in "expansion SCF classes".

An expansion class is a class that extends the functionality of another SCF class. For example, suppose a class TheWolf that implements the iWolf interface. Separately it is a useful class per se, but if you want to implement an additional class TheDog that is a subclass of TheWolf and which implements an additional interface iDog in theory you should just override the QueryInterface method and return the corresponding pointer when asked. The following macro makes such overrides simpler to write.

Definition at line 427 of file scf.h.

#define SCF_DECLARE_IBASE_POOLED parentClass   )     SCF_DECLARE_IBASE_POOLED_DECL(class, parentClass)
 

Embed this macro instead of SCF_DECLARE_IBASE into an SCF class that is to be pooled.

Remarks:
To obtain an instance of Class, create an instance of Class::Pool and use it's Alloc() method, e.g.:
  csFoo::Pool fooPool;
  ...
  csRef<csFoo> foo; foo.AttachNew (fooPool.Alloc ());

A pooled class Class must implement a constructor with the following prototype:

   Class (Pool* pool);

Inside the constructor, SCF_CONSTRUCT_IBASE_POOLED needs to be called.

If you need to set instance-specific data, you need to provide a custom method for that.

Definition at line 75 of file pooledscfclass.h.

#define SCF_DECLARE_IBASE_POOLED_EXTERN Extern,
parentClass   )     SCF_DECLARE_IBASE_POOLED_DECL(class Extern, parentClass)
 

Same as SCF_DECLARE_IBASE_POOLED, use for external classes.

Definition at line 81 of file pooledscfclass.h.

#define SCF_DEFINE_FACTORY_FUNC_REGISTRATION Class   ) 
 

Value:

CS_EXPORTED_FUNCTION iBase* CS_EXPORTED_NAME(Class,_Create)(iBase*);    \
  class Class##_StaticInit                                              \
  {                                                                     \
  public:                                                               \
    Class##_StaticInit()                                                \
    {                                                                   \
      scfRegisterStaticFactoryFunc (CS_EXPORTED_NAME(Class,_Create),    \
        #Class);                                                        \
    }                                                                   \
  };
Define the C++ class needed to register an SCF class, but don't do any automatic registration.

Definition at line 639 of file scf.h.

#define SCF_DESTRUCT_EMBEDDED_IBASE Interface   ) 
 

Value:

csRefTrackerAccess::RemoveAlias (&Interface, this);                     \
  Interface.scfParent = 0;
The SCF_DESTRUCT_EMBEDDED_IBASE macro should be invoked inside the destructor of a class that has an embedded interface (not inside the destructor of the embedded interface).

It reverses the initialization performed by the SCF_CONSTRUCT_EMBEDDED_IBASE() macro.

Definition at line 161 of file scf.h.

 
#define SCF_DESTRUCT_IBASE  ) 
 

Value:

csRefTrackerAccess::TrackDestruction (this, scfRefCount);               \
  scfRemoveRefOwners ();
The SCF_DESTRUCT_IBASE macro should be invoked inside the destructor of a class (not inside an embedded interface).

It reverses the initialization performed by the SCF_CONSTRUCT_IBASE() macro.

Definition at line 151 of file scf.h.

Referenced by csDataBuffer::~csDataBuffer(), csEventAttributeIterator::~csEventAttributeIterator(), csParasiticDataBuffer::~csParasiticDataBuffer(), csParasiticDataBufferPooled::~csParasiticDataBufferPooled(), csScfStringSet::~csScfStringSet(), csVerbosityManager::~csVerbosityManager(), scfString::~scfString(), and scfStringArray::~scfStringArray().

#define SCF_IMPLEMENT_EMBEDDED_IBASE Class   ) 
 

Value:

SCF_IMPLEMENT_EMBEDDED_IBASE should be used to implement embedded interfaces derived from iBase.

It differs from SCF_IMPLEMENT_IBASE because embedded interface don't have reference counts themselves, but instead use the reference count of their parent object.

Definition at line 375 of file scf.h.

#define SCF_IMPLEMENT_EMBEDDED_IBASE_DECREF Class   ) 
 

Value:

void Class::DecRef ()                                                   \
{                                                                       \
  SCF_TRACE (("  (%s *)%p->DecRef (%d)\n", #Class, this,                \
              scfParent->GetRefCount ()-1));                            \
  scfParent->DecRef ();                                                 \
}
The SCF_IMPLEMENT_EMBEDDED_IBASE_DECREF() macro implements the DecRef() method for an embedded class in a C++ source module.

Typically, this macro is automatically employed by the SCF_IMPLEMENT_EMBEDDED_IBASE() convenience macro.

Definition at line 315 of file scf.h.

#define SCF_IMPLEMENT_EMBEDDED_IBASE_END   SCF_IMPLEMENT_EMBEDDED_IBASE_QUERY_END
 

The SCF_IMPLEMENT_EMBEDDED_IBASE_END macro is used to finish an SCF_IMPLEMENT_EMBEDDED_IBASE definition.

Definition at line 386 of file scf.h.

#define SCF_IMPLEMENT_EMBEDDED_IBASE_GETREFCOUNT Class   ) 
 

Value:

int Class::GetRefCount ()                                               \
{                                                                       \
  return scfParent->GetRefCount ();                                     \
}
The SCF_IMPLEMENT_EMBEDDED_IBASE_GETREFCOUNT() macro implements the GetRefCount() method for an embedded class in a C++ source module.

Definition at line 327 of file scf.h.

#define SCF_IMPLEMENT_EMBEDDED_IBASE_INCREF Class   ) 
 

Value:

void Class::IncRef ()                                                   \
{                                                                       \
  SCF_TRACE (("  (%s *)%p->IncRef (%d)\n", #Class, this,                \
    scfParent->GetRefCount () + 1));                                    \
  scfParent->IncRef ();                                                 \
}
The SCF_IMPLEMENT_EMBEDDED_IBASE_INCREF() macro implements the IncRef() method for an embedded class in a C++ source module.

Typically, this macro is automatically employed by the SCF_IMPLEMENT_EMBEDDED_IBASE() convenience macro.

Definition at line 301 of file scf.h.

#define SCF_IMPLEMENT_EMBEDDED_IBASE_QUERY Class   ) 
 

Value:

void *Class::QueryInterface (scfInterfaceID iInterfaceID, int iVersion) \
{                                                                       \
  SCF_TRACE (("  (%s *)%p->QueryInterface (%lu, %08X)\n",               \
    #Class, this, iInterfaceID, iVersion));
The SCF_IMPLEMENT_EMBEDDED_IBASE_QUERY() macro implements the opening boilerplate for the QueryInterface() method for an embedded class in a C++ source module.

Typically, this macro is automatically employed by the SCF_IMPLEMENT_EMBEDDED_IBASE() convenience macro.

Definition at line 353 of file scf.h.

#define SCF_IMPLEMENT_EMBEDDED_IBASE_QUERY_END
 

Value:

return scfParent->QueryInterface (iInterfaceID, iVersion);              \
}
The SCF_IMPLEMENT_EMBEDDED_IBASE_QUERY_END macro implements the closing boilerplate for the QueryInterface() method for a class in an embedded C++ source module.

Typically, this macro is automatically employed by the SCF_IMPLEMENT_EMBEDDED_IBASE_END convenience macro.

Definition at line 365 of file scf.h.

#define SCF_IMPLEMENT_EMBEDDED_IBASE_REFOWNER Class   ) 
 

Value:

void Class::AddRefOwner (iBase** ref_owner)                             \
{                                                                       \
  scfParent->AddRefOwner (ref_owner);                                   \
}                                                                       \
void Class::RemoveRefOwner (iBase** ref_owner)                          \
{                                                                       \
  scfParent->RemoveRefOwner (ref_owner);                                \
}
The SCF_IMPLEMENT_EMBEDDED_IBASE_REFOWNER() macro implements the AddRefOwner() and RemoveRefOwner() for a weak reference.

Definition at line 337 of file scf.h.

#define SCF_IMPLEMENT_FACTORY Class   ) 
 

Value:

The SCF_IMPLEMENT_FACTORY macro is used to define a factory for one of exported classes.

You can define the function manually, of course, if the constructor for your class has some specific constructor arguments (that is, more than one iBase* argument).

Definition at line 594 of file scf.h.

#define SCF_IMPLEMENT_FACTORY_CREATE Class   ) 
 

Value:

CS_EXPORTED_FUNCTION                                                    \
iBase* CS_EXPORTED_NAME(Class,_Create)(iBase *iParent)                  \
{                                                                       \
  iBase *ret = new Class (iParent);                                     \
  SCF_TRACE (("  %p = new %s ()\n", ret, #Class));                      \
  return ret;                                                           \
}
The SCF_IMPLEMENT_FACTORY_CREATE macro is used to define a factory for one of exported classes.

You can define the function manually, of course, if the constructor for your class has some specific constructor arguments (that is, more than one iBase* argument).

Definition at line 579 of file scf.h.

#define SCF_IMPLEMENT_FACTORY_FINIS Class   ) 
 

Value:

CS_EXPORTED_FUNCTION                                                    \
void CS_EXPORTED_NAME(Class,_scfFinalize)()                             \
{                                                                       \
CS_STATIC_VARIABLE_CLEANUP                                              \
}
The SCF_IMPLEMENT_FACTORY_FINIS macro defines finalization code for a plugin module.

As with SCF_IMPLEMENT_FACTORY_INIT, only one instance of this function will be invoked to finalize the module.

Definition at line 566 of file scf.h.

#define SCF_IMPLEMENT_FACTORY_INIT Class   ) 
 

Value:

static inline void Class ## _scfUnitInitialize(iSCF* SCF)               \
{ iSCF::SCF = SCF; }                                                    \
CS_EXPORTED_FUNCTION                                                    \
void CS_EXPORTED_NAME(Class,_scfInitialize)(iSCF* SCF)                  \
{ Class ## _scfUnitInitialize(SCF); }
The SCF_IMPLEMENT_FACTORY_INIT macro defines initialization code for a plugin module.

This function should set the plugin-global iSCF::SCF variable, and otherwise initialize the plugin module. Although a version of this function will be created for each SCF factory exported by the plugin, SCF will call one, and only one, to perform the plugin initialization. The choice of which function will be invoked to initialize the plugin is an SCF implementation detail. You should not attempt to predict which class_scfInitialize() function will be used, nor should use try to sway SCF's choice. Implementation note: There are some rare instances where a particularly picky (and probably buggy) compiler does not allow C++ expressions within a function declared `extern "C"'. For this reason, the iSCF::SCF variable is instead initialized in the Class_scfUnitInitialize() function which is not qualified as `extern "C"'.

Definition at line 553 of file scf.h.

#define SCF_IMPLEMENT_IBASE Class   ) 
 

Value:

The SCF_IMPLEMENT_IBASE() macro should be used within the C++ source module that implements a interface derived from iBase.

Of course, you can still implement those methods manually, if you desire ...

Definition at line 280 of file scf.h.

#define SCF_IMPLEMENT_IBASE_DECREF Class   ) 
 

Value:

void Class::DecRef ()                                                   \
{                                                                       \
  csRefTrackerAccess::TrackDecRef (this, scfRefCount);                  \
  if (scfRefCount == 1)                                                 \
  {                                                                     \
    SCF_TRACE ((" delete (%s *)%p\n", #Class, this));                   \
    scfRemoveRefOwners ();                                              \
    if (scfParent)                                                      \
      scfParent->DecRef ();                                             \
    delete this;                                                        \
    return;                                                             \
  }                                                                     \
  scfRefCount--;                                                        \
}
The SCF_IMPLEMENT_IBASE_DECREF() macro implements the DecRef() method for a class in a C++ source module.

Typically, this macro is automatically employed by the SCF_IMPLEMENT_IBASE() convenience macro.

A note about the implementation: We do the "if" before the "scRefCount--" to make sure that calling Inc/DecRef doesn't result in a 2nd delete

Definition at line 186 of file scf.h.

#define SCF_IMPLEMENT_IBASE_DECREF_POOLED Class   ) 
 

Value:

void Class::DecRef ()                                   \
{                                                       \
  if (scfRefCount == 1)                                 \
  {                                                     \
    scfPool->Recycle (this);                            \
    return;                                             \
  }                                                     \
  scfRefCount--;                                        \
}
Implement DecRef() for a pooled class.

Definition at line 191 of file pooledscfclass.h.

#define SCF_IMPLEMENT_IBASE_END   SCF_IMPLEMENT_IBASE_QUERY_END
 

The SCF_IMPLEMENT_IBASE_END macro is used to finish an SCF_IMPLEMENT_IBASE definition.

Definition at line 292 of file scf.h.

#define SCF_IMPLEMENT_IBASE_EXT Class   ) 
 

Value:

This macro implements same functionality as SCF_IMPLEMENT_IBASE except that it should be used for expansion SCF classes.

Definition at line 510 of file scf.h.

#define SCF_IMPLEMENT_IBASE_EXT_DECREF Class   ) 
 

Value:

void Class::DecRef ()                                                   \
{                                                                       \
  __scf_superclass::DecRef ();                                          \
}
The SCF_IMPLEMENT_IBASE_EXT_DECREF() macro implements the DecRef() method for a class extending another SCF class in a C++ source module.

Typically, this macro is automatically employed by the SCF_IMPLEMENT_IBASE_EXT() convenience macro.

Definition at line 454 of file scf.h.

#define SCF_IMPLEMENT_IBASE_EXT_END   SCF_IMPLEMENT_IBASE_EXT_QUERY_END
 

This macro implements same functionality as SCF_IMPLEMENT_IBASE_END except that it is used for expansion SCF classes.

Definition at line 521 of file scf.h.

#define SCF_IMPLEMENT_IBASE_EXT_GETREFCOUNT Class   ) 
 

Value:

int Class::GetRefCount ()                                               \
{                                                                       \
  return __scf_superclass::GetRefCount ();                              \
}
The SCF_IMPLEMENT_IBASE_EXT_GETREFCOUNT() macro implements the GetRefCount() method for a class extending another SCF class in a C++ source module.

Typically, this macro is automatically employed by the SCF_IMPLEMENT_IBASE_EXT() convenience macro.

Definition at line 466 of file scf.h.

#define SCF_IMPLEMENT_IBASE_EXT_INCREF Class   ) 
 

Value:

void Class::IncRef ()                                                   \
{                                                                       \
  __scf_superclass::IncRef ();                                          \
}
The SCF_IMPLEMENT_IBASE_EXT_INCREF() macro implements the IncRef() method for a class extending another SCF class in a C++ source module.

Typically, this macro is automatically employed by the SCF_IMPLEMENT_IBASE_EXT() convenience macro.

Definition at line 442 of file scf.h.

#define SCF_IMPLEMENT_IBASE_EXT_QUERY Class   ) 
 

Value:

void *Class::QueryInterface (scfInterfaceID iInterfaceID, int iVersion) \
{
The SCF_IMPLEMENT_IBASE_EXT_QUERY() macro implements the opening boilerplate for the QueryInterface() method for a class extending another SCF class in a C++ source module.

Typically, this macro is automatically employed by the SCF_IMPLEMENT_IBASE_EXT() convenience macro.

Definition at line 492 of file scf.h.

#define SCF_IMPLEMENT_IBASE_EXT_QUERY_END
 

Value:

return __scf_superclass::QueryInterface (iInterfaceID, iVersion);       \
}
The SCF_IMPLEMENT_IBASE_EXT_QUERY_END macro implements the closing boilerplate for the QueryInterface() method for a class extending another SCF class in a C++ source module.

Typically, this macro is automatically employed by the SCF_IMPLEMENT_IBASE_EXT_END convenience macro.

Definition at line 502 of file scf.h.

#define SCF_IMPLEMENT_IBASE_EXT_REFOWNER Class   ) 
 

Value:

void Class::AddRefOwner (iBase** ref_owner)                             \
{                                                                       \
  __scf_superclass::AddRefOwner (ref_owner);                            \
}                                                                       \
void Class::RemoveRefOwner (iBase** ref_owner)                          \
{                                                                       \
  __scf_superclass::RemoveRefOwner (ref_owner);                         \
}
The SCF_IMPLEMENT_IBASE_EXT_REFOWNER() macro implements the AddRefOwner() and RemoveRefOwner() for a weak reference.

Definition at line 476 of file scf.h.

#define SCF_IMPLEMENT_IBASE_GETREFCOUNT Class   ) 
 

Value:

int Class::GetRefCount ()                                               \
{                                                                       \
  return scfRefCount;                                                   \
}
The SCF_IMPLEMENT_IBASE_GETREFCOUNT() macro implements GetRefCount() for a class in a C++ source module.

Definition at line 246 of file scf.h.

#define SCF_IMPLEMENT_IBASE_INCREF Class   ) 
 

Value:

void Class::IncRef ()                                                   \
{                                                                       \
  SCF_TRACE (("  (%s *)%p->IncRef (%d)\n", #Class, this, scfRefCount + 1));\
  csRefTrackerAccess::TrackIncRef (this, scfRefCount);                  \
  scfRefCount++;                                                        \
}
The SCF_IMPLEMENT_IBASE_INCREF() macro implements the IncRef() method for a class in a C++ source module.

Typically, this macro is automatically employed by the SCF_IMPLEMENT_IBASE() convenience macro.

Definition at line 170 of file scf.h.

#define SCF_IMPLEMENT_IBASE_INCREF_POOLED Class   ) 
 

Value:

void Class::IncRef ()                                   \
{                                                       \
  scfRefCount++;                                        \
}
Implement IncRef() for a pooled class.

Definition at line 182 of file pooledscfclass.h.

#define SCF_IMPLEMENT_IBASE_POOL Class   ) 
 

Value:

Implement pool manager for Class.

Definition at line 173 of file pooledscfclass.h.

#define SCF_IMPLEMENT_IBASE_POOL_ALLOC Class   ) 
 

Value:

Class* Class::Pool::Alloc ()                            \
{                                                       \
  PoolEntry* newEntry;                                  \
  if (pool != 0)                                        \
  {                                                     \
    newEntry = pool;                                    \
    pool = pool->next;                                  \
  }                                                     \
  else                                                  \
  {                                                     \
    newEntry = (PoolEntry*)malloc (sizeof (PoolEntry)); \
  }                                                     \
  Class* newInst = &newEntry->instance;                 \
  new (newInst) Class (this);                           \
  newEntry->next = allocedEntries;                      \
  allocedEntries = newEntry;                            \
  return newInst;                                       \
}
Implement Alloc() for the pool manager of Class.

Definition at line 128 of file pooledscfclass.h.

#define SCF_IMPLEMENT_IBASE_POOL_CTOR Class   ) 
 

Value:

Class::Pool::Pool ()                                    \
{                                                       \
  pool = 0;                                             \
  allocedEntries = 0;                                   \
}
Implement the constructor for the pool manager of Class.

Definition at line 102 of file pooledscfclass.h.

#define SCF_IMPLEMENT_IBASE_POOL_DTOR Class   ) 
 

Value:

Class::Pool::~Pool ()                                   \
{                                                       \
  while (pool != 0)                                     \
  {                                                     \
    PoolEntry* n = pool->next;                          \
    free (pool);                                        \
    pool = n;                                           \
  }                                                     \
  CS_ASSERT_MSG ("not all SCF-pooled instances released",\
    allocedEntries == 0);                               \
}
Implement the destructor for the pool manager of Class.

Definition at line 112 of file pooledscfclass.h.

#define SCF_IMPLEMENT_IBASE_POOL_RECYCLE Class   ) 
 

Value:

void Class::Pool::Recycle (Class* instance)             \
{                                                       \
  PoolEntry* prev = 0;                                  \
  PoolEntry* entry = allocedEntries;                    \
  while (&entry->instance != instance)                  \
  {                                                     \
    prev = entry;                                       \
    entry = entry->next;                                \
  }                                                     \
  if (prev != 0)                                        \
    prev->next = entry->next;                           \
  else                                                  \
    allocedEntries = entry->next;                       \
  instance->~Class();                                   \
  entry->next = pool;                                   \
  pool = entry;                                         \
}
Implement Recycle() for the pool manager of Class.

Definition at line 151 of file pooledscfclass.h.

#define SCF_IMPLEMENT_IBASE_POOLED Class   ) 
 

Value:

Use this in the source module instead of SCF_IMPLEMENT_IBASE.

Definition at line 205 of file pooledscfclass.h.

#define SCF_IMPLEMENT_IBASE_QUERY Class   ) 
 

Value:

void *Class::QueryInterface (scfInterfaceID iInterfaceID, int iVersion) \
{                                                                       \
  SCF_TRACE (("  (%s *)%p->QueryInterface (%lu, %08X)\n",               \
    #Class, this, iInterfaceID, iVersion));
The SCF_IMPLEMENT_IBASE_QUERY() macro implements the opening boilerplate for the QueryInterface() method for a class in a C++ source module.

Typically, this macro is automatically employed by the SCF_IMPLEMENT_IBASE() convenience macro.

Definition at line 258 of file scf.h.

#define SCF_IMPLEMENT_IBASE_QUERY_END
 

Value:

return scfParent ?                                                      \
    scfParent->QueryInterface (iInterfaceID, iVersion) : 0;             \
}
The SCF_IMPLEMENT_IBASE_QUERY_END macro implements the closing boilerplate for the QueryInterface() method for a class in a C++ source module.

Typically, this macro is automatically employed by the SCF_IMPLEMENT_IBASE_END convenience macro.

Definition at line 270 of file scf.h.

#define SCF_IMPLEMENT_IBASE_REFOWNER Class   ) 
 

Value:

void Class::AddRefOwner (iBase** ref_owner)                             \
{                                                                       \
  if (!scfWeakRefOwners)                                                \
    scfWeakRefOwners = new csArray<iBase**> (0, 4);                     \
  scfWeakRefOwners->InsertSorted (ref_owner);                           \
}                                                                       \
void Class::RemoveRefOwner (iBase** ref_owner)                          \
{                                                                       \
  if (!scfWeakRefOwners)                                                \
    return;                                                             \
  size_t index = scfWeakRefOwners->FindSortedKey (                      \
    csArrayCmp<iBase**, iBase**> (ref_owner));                          \
  if (index != csArrayItemNotFound) scfWeakRefOwners->DeleteIndex (     \
    index);                                                             \
}
The SCF_IMPLEMENT_IBASE_REFOWNER() macro implements the AddRefOwner() and RemoveRefOwner() for a weak reference.

Definition at line 225 of file scf.h.

#define SCF_IMPLEMENT_IBASE_REMOVE_REF_OWNERS Class   ) 
 

Value:

void Class::scfRemoveRefOwners ()                                       \
{                                                                       \
  if (!scfWeakRefOwners) return;                                        \
  for (size_t i = 0 ; i < scfWeakRefOwners->Length () ; i++)            \
  {                                                                     \
    iBase** p = (*scfWeakRefOwners)[i];                                 \
    *p = 0;                                                             \
  }                                                                     \
  delete scfWeakRefOwners;                                              \
  scfWeakRefOwners = 0;                                                 \
}
The SCF_IMPLEMENT_IBASE_REMOVE_REF_OWNERS() macro implements the scfRemoveRefOwners() method for a class in a C++ source module.

Typically, this macro is automatically employed by the SCF_IMPLEMENT_IBASE() convenience macro.

Definition at line 208 of file scf.h.

#define SCF_IMPLEMENTS_EMBEDDED_INTERFACE Interface   )     SCF_IMPLEMENTS_INTERFACE_COMMON (Interface, (&scf##Interface))
 

IMPLEMENT_EMBEDDED_INTERFACE is same as IMPLEMENT_INTERFACE but is used when class implements the interface as an embedded member.

Definition at line 403 of file scf.h.

#define SCF_IMPLEMENTS_INTERFACE Interface   ) 
 

Value:

csRefTrackerAccess::AddAlias (CS_STATIC_CAST(Interface*, this), this);\
  SCF_IMPLEMENTS_INTERFACE_COMMON (Interface, this)
The IMPLEMENT_INTERFACE macro is used inside QueryInterface function to check if user requested a specific interface, whenever requested version of the interface correspond to the version we have and to return a pointer to that interface if everything is correct.

Definition at line 395 of file scf.h.

#define SCF_IMPLEMENTS_INTERFACE_COMMON Interface,
Object   ) 
 

Value:

if (iInterfaceID == scfInterfaceTraits<Interface>::GetID() &&           \
    scfCompatibleVersion (iVersion, scfInterfaceTraits<Interface>::GetVersion())) \
  {                                                                     \
    (Object)->IncRef ();                                                \
    return CS_STATIC_CAST(Interface*, Object);                          \
  }
This is a common macro used in all IMPLEMENTS_XXX_INTERFACE macros.

Definition at line 409 of file scf.h.

#define SCF_INTERFACE Name,
Major,
Minor,
Micro   ) 
 

Value:

struct InterfaceTraits {                                  \
  static CS_FORCEINLINE scfInterfaceVersion GetVersion()          \
  { return SCF_CONSTRUCT_VERSION(Major, Minor, Micro); }  \
  static CS_FORCEINLINE char const * GetName() { return #Name; }  \
}
SCF_INTERFACE can be used to define an interface's version number; you should specify interface name and major, minor and micro version components.

This way:

 struct iSomething : public iBase
 {
 public:
   SCF_INTERFACE(iSomething, 0, 0, 1);
   ...
 };
 

Definition at line 71 of file scf_interface.h.

#define SCF_PRINT_CALL_ADDRESS
 

Macro for getting the address we were called from (stack backtracing).

This works ONLY For GCC >= 2.8.0

Definition at line 71 of file scf.h.

#define SCF_REGISTER_FACTORY_FUNC Class   ) 
 

Value:

SCF_DEFINE_FACTORY_FUNC_REGISTRATION(Class)                             \
  Class##_StaticInit Class##_static_init__;
Used in conjunction with SCF_REGISTER_STATIC_LIBRARY to ensure that a reference to the class(es) registered via SCF_REGISTER_STATIC_LIBRARY are actually linked into the application.

Invoke this macro once for each <implementation> node mentioned in the MetaInfo registered with SCF_REGISTER_STATIC_LIBRARY. Invocations of this macro must appear after the the invocation of SCF_REGISTER_STATIC_LIBRARY.

Definition at line 670 of file scf.h.

#define SCF_REGISTER_STATIC_CLASS Class,
Ident,
Desc,
Dep   ) 
 

Value:

CS_EXPORTED_FUNCTION iBase* CS_EXPORTED_NAME(Class,_Create)(iBase*);    \
  class Class##_StaticInit__                                            \
  {                                                                     \
  public:                                                               \
    Class##_StaticInit__()                                              \
    {                                                                   \
      scfRegisterStaticClass(                                           \
        CS_EXPORTED_NAME(Class,_Create), Ident, Desc, Dep);             \
    }                                                                   \
  } Class##_static_init__;
Automatically register a built-in class with SCF during startup.

When SCF classes are statically linked (vs dynamic linking) they should be referenced from somewhere inside your program, otherwise the static libraries won't be linked into the static executable. This macro defines a dummy variable that registers the class during initialization and ensures that it gets linked into the program

Definition at line 609 of file scf.h.

#define SCF_REGISTER_STATIC_LIBRARY Module,
MetaInfo   ) 
 

Value:

class Module##_StaticInit                                               \
  {                                                                     \
  public:                                                               \
    Module##_StaticInit()                                               \
    {                                                                   \
      scfRegisterStaticClasses (MetaInfo);                              \
    }                                                                   \
  } Module##_static_init__;
Automatically register a static library with SCF during startup.

Employ this macro along with one or more invocations of SCF_REGISTER_FACTORY_FUNC.

Definition at line 625 of file scf.h.

#define SCF_TRACE  ) 
 

Macro for typing debug strings: Add #define SCF_DEBUG at the top of modules you want to track miscelaneous SCF activity and recompile.

Definition at line 60 of file scf.h.

#define SCF_USE_STATIC_PLUGIN Module   ) 
 

Value:

namespace csStaticPluginInit                                            \
  {                                                                     \
    class Module { public: Module(); };                                 \
    Module Module##_StaticInit;                                         \
  }
Register a statically linked plugin.

The _static version of the plugin needs to be linked in, too.

Definition at line 655 of file scf.h.

#define SCF_VERSION Name,
Major,
Minor,
Micro   ) 
 

Value:

struct Name;                                               \
CS_SPECIALIZE_TEMPLATE                                     \
class scfInterfaceTraits<Name>                             \
{                                                          \
public:                                                    \
  static scfInterfaceVersion GetVersion()                  \
  { return SCF_CONSTRUCT_VERSION(Major, Minor, Micro); }   \
  static char const* GetName ()                            \
  { return #Name; }                                        \
  static scfInterfaceID GetID ()                           \
  { scfInterfaceID& ID = GetMyID ();                       \
    if (ID == (scfInterfaceID)(-1))                        \
    { ID = iSCF::SCF->GetInterfaceID (GetName ());         \
      csStaticVarCleanup (CleanupID);    }                 \
    return ID;                                             \
  }                                                        \
private:                                                   \
  static scfInterfaceID& GetMyID ()                        \
  { static scfInterfaceID ID = (scfInterfaceID)-1; return ID; } \
  static void CleanupID ()                                 \
  { GetMyID () = (scfInterfaceID)-1; }                     \
}
FOR COMPATIBILITY! SCF_VERSION can be used to define an interface's version number; you should specify interface name and major, minor and micro version components.

This way:

 SCF_VERSION (iSomething, 0, 0, 1);
 struct iSomething : public iBase
   ...
 };
 
Notice that SCF_VERSION cannot be used on interfaces in namespaces

Definition at line 428 of file scf_interface.h.


Typedef Documentation

typedef iBase*(* scfFactoryFunc)(iBase *)
 

Type of factory function which creates an instance of an SCF class.

Definition at line 134 of file scf_interface.h.

typedef unsigned long scfInterfaceID
 

Type of registered interface handle used by iBase::QueryInterface().

Definition at line 50 of file scf_interface.h.

typedef int scfInterfaceVersion
 

Type of interface version used by iBase::QueryInterface().

Definition at line 55 of file scf_interface.h.


Enumeration Type Documentation

anonymous enum
 

SCF verbosity flags.

For use with scfInitialize(). Combine with bitwise-or to select more than one.

Enumerator:
SCF_VERBOSE_NONE  No diagnostic information.
SCF_VERBOSE_PLUGIN_SCAN  Directories scanned for plugins.
SCF_VERBOSE_PLUGIN_LOAD  Plugins loaded and unloaded.
SCF_VERBOSE_PLUGIN_REGISTER  Plugins discovered and registered.
SCF_VERBOSE_CLASS_REGISTER  Classes registered within plugins.
SCF_VERBOSE_ALL  All diagnostic information.

Definition at line 711 of file scf.h.


Function Documentation

template<class Interface>
csPtr<Interface> csLoadPlugin iPluginManager mgr,
const char *  ClassID
[inline]
 

Tell plugin manager to load a plugin.

Interface: Desired interface type (ex. iGraphics2D, iVFS, etc.).

Parameters:
mgr An object that implements iPluginManager.
ClassID The SCF class name (ex. crystalspace.graphics3d.software).

Definition at line 202 of file plugin.h.

References iBase::DecRef(), iPluginManager::LoadPlugin(), and iBase::QueryInterface().

csPtr<iBase> csLoadPluginAlways iPluginManager mgr,
const char *  ClassID
[inline]
 

Same as csLoadPlugin() but does not bother asking for a interface.

This is useful for unconditionally loading plugins.

Definition at line 229 of file plugin.h.

References iPluginManager::LoadPlugin().

template<class Interface>
csPtr<Interface> csQueryPluginClass iPluginManager mgr,
const char *  ClassID
[inline]
 

Find a plugin by its class ID.

First the plugin with requested class identifier is found, and after this it is queried for the respective interface; if it does not implement the requested interface, 0 is returned. Interface: Desired interface type (ex. iGraphics2D, iVFS, etc.).

Parameters:
mgr An object that implements iPluginManager.
ClassID The SCF class name (ex. crystalspace.graphics3d.software).

Definition at line 170 of file plugin.h.

References iBase::DecRef(), iBase::QueryInterface(), and iPluginManager::QueryPlugin().

static CS_FORCEINLINE bool scfCompatibleVersion scfInterfaceVersion  iVersion,
scfInterfaceVersion  iItfVersion
[static]
 

This function checks whenever an interface is compatible with given version.

SCF uses the following comparison criteria: if the major version numbers are equal and required minor and micro version is less or equal than target version minor and micro numbers, the versions are considered compatible.

Definition at line 90 of file scf_interface.h.

Referenced by scfImplementation< Class >::GetInterface(), and scfImplementation< Class >::QueryInterface().

template<class Interface>
csPtr<Interface> scfCreateInstance char const *const   ClassID  )  [inline]
 

Handy function to create an instance of a shared class.

Definition at line 802 of file scf.h.

References iSCF::CreateInstance(), iBase::DecRef(), iBase::QueryInterface(), and iSCF::SCF.

void scfInitialize int  argc,
const char *const   argv[]
 

This function should be called to initialize client SCF library.

It uses the default plugin paths provided by csGetPluginPaths().

void scfInitialize csPathsList const *  pluginPaths,
unsigned int  verbose = SCF_VERBOSE_NONE
 

This function should be called to initialize client SCF library.

If a number of plugin paths are provided, the directories will be scanned for plugins and their SCF-related registry data will be retrieved. The root node within the registry data document should be named "plugin", and the SCF-related information should be in a child node of the root named "scf". It is legal to call scfInitialize more than once (possibly providing a different set of directories each time).

Parameters:
pluginPaths Directories that will be scanned for plugins. If this parameter is 0, the paths returned by csGetPluginPaths() will be scanned.
verbose One or more of the SCF_VERBOSE_FOO flags combined with bitwise-or which control SCF verbosity.
Remarks:
The path list is ignored for static builds.

template<class Interface, class ClassPtr>
csPtr<Interface> scfQueryInterface ClassPtr  object  )  [inline]
 

Helper function around iBase::QueryInterface.

Definition at line 768 of file scf.h.

template<class Interface, class ClassPtr>
csPtr<Interface> scfQueryInterfaceSafe ClassPtr  object  )  [inline]
 

Helper function around iBase::QueryInterface which also does null-check of object.

Definition at line 785 of file scf.h.

void scfRegisterStaticClass scfFactoryFunc  ,
const char *  iClassID,
const char *  Description,
const char *  Dependencies = 0
 

Register a static class.

This needs extra handling since they require automatic registration even when SCF is initialized after it was possibly shut down previously. The static class info is stored and read out later when SCF is initialized.

void scfRegisterStaticClasses char const *  xml  ) 
 

Register a static class.

This needs extra handling since they require automatic registration even when SCF is initialized after it was possibly shut down previously. The static class info is stored and read out later when SCF is initialized.

void scfRegisterStaticFactoryFunc scfFactoryFunc  ,
const char *  FactClass
 

Register a static class.

This needs extra handling since they require automatic registration even when SCF is initialized after it was possibly shut down previously. The static class info is stored and read out later when SCF is initialized.


Generated for Crystal Space by doxygen 1.4.4