dtUtil::LibrarySharingManager Class Reference

Singleton for controlling loading and unloading libraries shared by mulitple bodies of code. More...

#include <librarysharingmanager.h>

List of all members.

Public Member Functions

dtCore::RefPtr< LibraryHandleLoadSharedLibrary (const std::string &libName)
 Loads a library based on a system independent name.
void GetSearchPath (std::vector< std::string > &toFill) const
 This class will search a configured list of paths for a library before letting the OS use its search path.
const std::string FindLibraryInSearchPath (const std::string &libraryFileName) const
 
Parameters:
the file name of the library to find.

void AddToSearchPath (const std::string &newPath)
 Adds a new path to the search path.
void RemoveFromSearchPath (const std::string &path)
 Removes a path from the search path.
void ClearSearchPath ()
 Clears the search path completely.

Static Public Member Functions

static LibrarySharingManagerGetInstance ()
static std::string GetPlatformSpecificLibraryName (const std::string &libBase)
 Determines which platform we are running on and returns a platform dependent library name.
static 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.

Classes

class  ExceptionEnum
class  LibraryHandle
 pure virtual class abstracting a checked-out handle to a library. More...


Detailed Description

Singleton for controlling loading and unloading libraries shared by mulitple bodies of code.

Note:
This class will search a configured list of paths for a library before letting the OS use its search path. The default list may vary per OS.

Member Function Documentation

static LibrarySharingManager& dtUtil::LibrarySharingManager::GetInstance ( void   )  [inline, static]

dtCore::RefPtr<LibraryHandle> dtUtil::LibrarySharingManager::LoadSharedLibrary ( const std::string &  libName  ) 

Loads a library based on a system independent name.

The class holds onto already opened libraries, so if the library is being used already, a new handle to it will be returned and no system calls will be made.

Parameters:
libName the system-independent name of the library to load.
Returns:
a pointer to a handle representing the library.
Exceptions:
dtUtil::Exception with key dtUtil::LibrarySharingManager::ExceptionEnum::LibraryLoadingError if the library can't be loaded for some reason.

void dtUtil::LibrarySharingManager::GetSearchPath ( std::vector< std::string > &  toFill  )  const

This class will search a configured list of paths for a library before letting the OS use its search path.

This method returns the list. The default list may vary per OS.

Returns:
the list of directories this will search for libraries

const std::string dtUtil::LibrarySharingManager::FindLibraryInSearchPath ( const std::string &  libraryFileName  )  const

Parameters:
the file name of the library to find.

Note:
this will not return a path to a library is the OS search path.
Returns:
the path to the library just searching in the search path list

void dtUtil::LibrarySharingManager::AddToSearchPath ( const std::string &  newPath  ) 

Adds a new path to the search path.

It will not convert the path to an absolute path, so be careful when using relative ones. It will also not validate that the path exists so that the app won't blow up of a directory is removed that was being added to the list.

Parameters:
newPath the new path to add.

void dtUtil::LibrarySharingManager::RemoveFromSearchPath ( const std::string &  path  ) 

Removes a path from the search path.

Parameters:
path the path to remove.

void dtUtil::LibrarySharingManager::ClearSearchPath (  ) 

Clears the search path completely.

static std::string dtUtil::LibrarySharingManager::GetPlatformSpecificLibraryName ( const std::string &  libBase  )  [static]

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.

static std::string dtUtil::LibrarySharingManager::GetPlatformIndependentLibraryName ( const std::string &  libName  )  [static]

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