dtDAL::LibraryManager Class Reference

This class is the main class in the dynamic actor library portion of the DAL (Dynamic Actor Layer). More...

#include <librarymanager.h>

List of all members.

Public Types

typedef std::map
< dtCore::RefPtr< const
ActorType >,
ActorPluginRegistry *,
ActorType::RefPtrComp
ActorTypeMap
typedef ActorTypeMap::iterator ActorTypeMapItor
typedef std::map< std::string,
RegistryEntry
RegistryMap
typedef RegistryMap::iterator RegistryMapItor

Public Member Functions

void LoadActorRegistry (const std::string &libName)
 Loads an actor registry by loading a dynamic library containing the actor registry implementation.
bool AddRegistryEntry (const std::string &libName, const RegistryEntry &entry)
 Inserts the pair of parameters into the container.
void UnloadActorRegistry (const std::string &libName)
 Unloads an actor registry.
void GetActorTypes (std::vector< const ActorType * > &actorTypes)
 Returns a list of all the actor types the library manager knows how to create.
const ActorTypeFindActorType (const std::string &category, const std::string &name)
 Gets a single actor type that matches the name and category specified.
dtCore::RefPtr< ActorProxyCreateActorProxy (const ActorType &actorType)
 Creates a new actor proxy.
dtCore::RefPtr< ActorProxyCreateActorProxy (const std::string &category, const std::string &name)
 Creates a new actor proxy.
ActorPluginRegistryGetRegistry (const std::string &name)
 Gets a registry currently loaded by the library manager.
ActorPluginRegistryGetRegistryForType (const ActorType &actorType)
 
Parameters:
actorType the actor type to get the registry for.

std::string GetPlatformSpecificLibraryName (const std::string &libBase)
 Determines which platform we are running on and returns a platform dependent library name.
std::string GetPlatformIndependentLibraryName (const std::string &libName)
 Strips off the path and platform specific library prefixs and extensions and returns a system independent file name.

Static Public Member Functions

static LibraryManagerGetInstance ()
 Gets the singleton instance of the LibraryManager.

Classes

struct  RegistryEntry
 Simple structure for grouping the data corresponding to a registry entry. More...


Detailed Description

This class is the main class in the dynamic actor library portion of the DAL (Dynamic Actor Layer).

It has a list of the dynamic libraries that are registered with the Manager as well as a list of the ActorTypes that each library can create. It is also the main vehicle for creating a new ActorProxy.

Note:
The LibraryManager follows the Singleton design pattern.
See also:
ActorType

ActorProxy


Member Typedef Documentation

typedef std::map<dtCore::RefPtr<const ActorType>, ActorPluginRegistry*, ActorType::RefPtrComp> dtDAL::LibraryManager::ActorTypeMap

typedef ActorTypeMap::iterator dtDAL::LibraryManager::ActorTypeMapItor

typedef std::map<std::string, RegistryEntry> dtDAL::LibraryManager::RegistryMap

typedef RegistryMap::iterator dtDAL::LibraryManager::RegistryMapItor


Member Function Documentation

LibraryManager & dtDAL::LibraryManager::GetInstance ( void   )  [static]

Gets the singleton instance of the LibraryManager.

void dtDAL::LibraryManager::LoadActorRegistry ( const std::string &  libName  ) 

Loads an actor registry by loading a dynamic library containing the actor registry implementation.

Parameters:
libName The system independent name of the library to load.
Exceptions:
ProjectResourceError Throws an exception if the library cannot be found or the create and destroy functions are not found in the library.

bool dtDAL::LibraryManager::AddRegistryEntry ( const std::string &  libName,
const RegistryEntry entry 
)

Inserts the pair of parameters into the container.

Also, registers the supported Actor types with the manager.

Parameters:
libName The system independent name of the library that was loaded
entry The RegistryEntry mapped to the library name.
Returns:
true if successully added, false if not

void dtDAL::LibraryManager::UnloadActorRegistry ( const std::string &  libName  ) 

Unloads an actor registry.

This unloads the dynamic library containing the actor registry implementation and also removes all the actor types that the registry supported.

Parameters:
libName The system independent name of the library to load.

void dtDAL::LibraryManager::GetActorTypes ( std::vector< const ActorType * > &  actorTypes  ) 

Returns a list of all the actor types the library manager knows how to create.

const ActorType * dtDAL::LibraryManager::FindActorType ( const std::string &  category,
const std::string &  name 
)

Gets a single actor type that matches the name and category specified.

Parameters:
category Category of the actor type to find.
name Name of the actor type.
Returns:
A pointer if the actor type was found or NULL if not.

dtCore::RefPtr< ActorProxy > dtDAL::LibraryManager::CreateActorProxy ( const ActorType actorType  ) 

Creates a new actor proxy.

The actor type is used by the library manager to determine which type of actor proxy to create.

Returns:
Returns a pointer to the base actor proxy which can be safely typecast'd to the appropriate derived type.
Exceptions:
Throws a ObjectFactoryUnknownType exception if the type is unknown.

dtCore::RefPtr< ActorProxy > dtDAL::LibraryManager::CreateActorProxy ( const std::string &  category,
const std::string &  name 
)

Creates a new actor proxy.

The actor type is used by the library manager to determine which type of actor proxy to create.

Returns:
Returns a pointer to the base actor proxy which can be safely typecast'd to the appropriate derived type.
Exceptions:
Throws a ObjectFactoryUnknownType exception if the type
Parameters:
category The category corresponding to the actor type
name The name corresponding to the actor type is unknown.

ActorPluginRegistry * dtDAL::LibraryManager::GetRegistry ( const std::string &  name  ) 

Gets a registry currently loaded by the library manager.

Parameters:
name The name of the library. Note, this name is the system independent name.
Returns:
A handle to the registry or NULL if it is not currently loaded.

ActorPluginRegistry * dtDAL::LibraryManager::GetRegistryForType ( const ActorType actorType  ) 

Parameters:
actorType the actor type to get the registry for.

std::string dtDAL::LibraryManager::GetPlatformSpecificLibraryName ( const std::string &  libBase  ) 

Determines which platform we are running on and returns a platform dependent library name.

Parameters:
libBase Platform independent library name.
Returns:
A platform dependent library name.
Note:
For example. If the platform independent library name is ExampleActors then on Windows platforms the resulting dependent library name would be ExampleActors.dll, however, on Unix based platforms, the resulting name would be libExampleActors.so.

std::string dtDAL::LibraryManager::GetPlatformIndependentLibraryName ( const std::string &  libName  ) 

Strips off the path and platform specific library prefixs and extensions and returns a system independent file name.

Parameters:
libName The platform specific library name.
Returns:
A platform independent library name.


http://www.delta3d.org
2.0.0 generated 14 Feb 2008