crystalspace.jbind.impl.csutil.objreg
Class csObjectRegistry

java.lang.Object
  extended bycrystalspace.jbind.impl.csNativeObject
      extended bycrystalspace.jbind.impl.csutil.scf.csBase
          extended bycrystalspace.jbind.impl.csutil.objreg.csObjectRegistry
All Implemented Interfaces:
iBase, iObjectRegistry, iPointer

public class csObjectRegistry
extends csBase
implements iObjectRegistry

Author:
qan To change the template for this generated type comment go to Window>Preferences>Java>Code Generation>Code and Comments

Field Summary
 
Fields inherited from class crystalspace.jbind.impl.csNativeObject
ImplFactory, nPointer
 
Constructor Summary
csObjectRegistry(iPointer nPointer)
           
 
Method Summary
 void clear()
          Clear the object registry and release all references.
static iPointer CS_QUERY_REGISTRY(iObjectRegistry registry, java.lang.Class interfaceToGet)
           
 iObjectRegistryIterator get()
          Get an iterator with all objects in this object registry.
 iObjectRegistryIterator get(long id, int version)
          Get an iterator with all objects implementing the given interface.
 iBase get(java.lang.String tag)
          Get the registered object corresponding with the given tag.
 iBase get(java.lang.String tag, long id, int version)
          Get the registered object corresponding with the given tag and implementing the specified interface.
static java.lang.Class getInterfaceClass()
           
static java.lang.String getInterfaceName()
           
static int getInterfaceVersion()
           
 java.lang.String getName()
          Return the name of the interface
 int getVersion()
          Return the version of the interface
static void initSCF()
           
protected  boolean isNativePointerValidSafe()
           
 boolean register(iBase base, java.lang.String tag)
          Register an object with this registry.
 void unregister(iBase base, java.lang.String tag)
          Unregister an object with this registry.
 
Methods inherited from class crystalspace.jbind.impl.csutil.scf.csBase
decRef, equals, finalize, getRefCount, incRef, nDelete, queryInterface, queryInterfaceSafe
 
Methods inherited from class crystalspace.jbind.impl.csNativeObject
changePointer, getPointer, getPointer, getPointerArray, hashCode, isMemoryOwner, isNativePointerValid, isNativePointerValidSafe, newNativeObject, setMemoryOwner, toString
 
Methods inherited from class java.lang.Object
clone, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface crystalspace.jbind.interfaces.iutil.scf.iBase
decRef, getRefCount, incRef, queryInterface, queryInterfaceSafe
 
Methods inherited from interface crystalspace.jbind.interfaces.iPointer
changePointer, getPointer, isMemoryOwner, setMemoryOwner
 

Constructor Detail

csObjectRegistry

public csObjectRegistry(iPointer nPointer)
Method Detail

getVersion

public int getVersion()
Description copied from interface: iBase
Return the version of the interface

Specified by:
getVersion in interface iBase
Specified by:
getVersion in class csBase

getName

public java.lang.String getName()
Description copied from interface: iBase
Return the name of the interface

Specified by:
getName in interface iBase
Specified by:
getName in class csBase

initSCF

public static void initSCF()

clear

public final void clear()
Description copied from interface: iObjectRegistry
Clear the object registry and release all references. Implemented in csObjectRegistry.

Specified by:
clear in interface iObjectRegistry

get

public final iObjectRegistryIterator get()
Description copied from interface: iObjectRegistry
Get an iterator with all objects in this object registry. Note that the iterator iterates over a copy of the elements in the object registry so no thread-locking on the object registry happens except at the time the iterator is created. Implemented in csObjectRegistry

Specified by:
get in interface iObjectRegistry
Returns:

get

public final iObjectRegistryIterator get(long id,
                                         int version)
Description copied from interface: iObjectRegistry
Get an iterator with all objects implementing the given interface. Note that the iterator iterates over a copy of the elements in the object registry so no thread-locking on the object registry happens except at the time the iterator is created. Implemented in csObjectRegistry

Specified by:
get in interface iObjectRegistry
Parameters:
id -
version -
Returns:

get

public final iBase get(java.lang.String tag)
Description copied from interface: iObjectRegistry
Get the registered object corresponding with the given tag. This function will increase the ref count of the returned object. Implemented in csObjectRegistry.

Specified by:
get in interface iObjectRegistry
Parameters:
tag -
Returns:

get

public final iBase get(java.lang.String tag,
                       long id,
                       int version)
Description copied from interface: iObjectRegistry
Get the registered object corresponding with the given tag and implementing the specified interface. The iBase pointers returned by the iterator will be the requested interface itself so there is no need to do further QueryInterface(). This function will increase the ref count of the returned object. Implemented in csObjectRegistry.

Specified by:
get in interface iObjectRegistry
Parameters:
tag -
id -
version -
Returns:

register

public final boolean register(iBase base,
                              java.lang.String tag)
Description copied from interface: iObjectRegistry
Register an object with this registry. The same object can be registered multiple times but in that case it is probably best to have different tags so they can be distinguished. This function will increase the ref count of the given object. Note that a given tag (if non-0) may only be registered once. This function will return false otherwise. This function will also fail if this object registry is being cleared. Implemented in csObjectRegistry.

Specified by:
register in interface iObjectRegistry
Parameters:
base -
tag -
Returns:

unregister

public final void unregister(iBase base,
                             java.lang.String tag)
Description copied from interface: iObjectRegistry
Unregister an object with this registry. If 'tag' is not given then it will unregister all occurrences of the given object in the registry (i.e. for all tags). If 'tag' is given then only the object that has that tag will be unregistered. This function will decrease the ref count of the given object. Implemented in csObjectRegistry.

Specified by:
unregister in interface iObjectRegistry
Parameters:
base -
tag -

CS_QUERY_REGISTRY

public static final iPointer CS_QUERY_REGISTRY(iObjectRegistry registry,
                                               java.lang.Class interfaceToGet)

getInterfaceVersion

public static int getInterfaceVersion()

getInterfaceName

public static java.lang.String getInterfaceName()

getInterfaceClass

public static java.lang.Class getInterfaceClass()

isNativePointerValidSafe

protected boolean isNativePointerValidSafe()