xoreos  0.0.5
Public Member Functions | Private Types | Private Member Functions | Private Attributes | List of all members
Aurora::TwoDARegistry Class Reference

The global 2DA registry, holding all current 2DAs. More...

#include <2dareg.h>

Inheritance diagram for Aurora::TwoDARegistry:
Inheritance graph
[legend]
Collaboration diagram for Aurora::TwoDARegistry:
Collaboration graph
[legend]

Public Member Functions

 TwoDARegistry ()
 
 ~TwoDARegistry ()
 
void clear ()
 
const TwoDAFileget2DA (const Common::UString &name)
 Get a certain 2DA, loading it if necessary. More...
 
const GDAFilegetGDA (const Common::UString &name)
 Get a certain GDA, loading it if necessary. More...
 
const GDAFilegetMGDA (const Common::UString &prefix)
 Get a certain multiple GDA, loading it if necessary. More...
 
void add2DA (const Common::UString &name)
 Add a certain 2DA to the registry, reloading it if necessary. More...
 
void remove2DA (const Common::UString &name)
 Remove a certain 2DA from the registry. More...
 
void addGDA (const Common::UString &name)
 Add a certain GDA to the registry, reloading it if necessary. More...
 
void addMGDA (const Common::UString &prefix)
 Add a certain multiple GDA to the registry, reloading it if necessary. More...
 
void removeGDA (const Common::UString &name)
 Remove a certain GDA from the registry. More...
 

Private Types

typedef Common::PtrMap< Common::UString, TwoDAFileTwoDAMap
 
typedef Common::PtrMap< Common::UString, GDAFileGDAMap
 

Private Member Functions

TwoDAFileload2DA (const Common::UString &name)
 
GDAFileloadGDA (const Common::UString &name)
 
GDAFileloadMGDA (Common::UString prefix)
 

Private Attributes

TwoDAMap _twodas
 
GDAMap _gdas
 

Additional Inherited Members

- Static Public Member Functions inherited from Common::Singleton< TwoDARegistry >
static TwoDARegistry & instance ()
 
static void destroy ()
 
- Protected Types inherited from Common::Singleton< TwoDARegistry >
typedef TwoDARegistry SingletonBaseType
 
- Protected Member Functions inherited from Common::Singleton< TwoDARegistry >
 Singleton ()
 
virtual ~Singleton ()
 

Detailed Description

The global 2DA registry, holding all current 2DAs.

TwoDARegistry is to be used by the engines to hold and cache 2DAs and GDAs relevant to the current context, so that they don't need to be parsed multiple times for successive uses.

All loaded 2DAs and GDAs will be held in memory until the clear() method is called, which should be done in a moment appropriate for the game. Most likely, this moment is the unloading of a module or campaign, when the context of the current 2DAs/GDAs expires.

TwoDARegistry can also be used to load a so-called MGDA, a concat- enation of multiple GDA files with the same prefix. This is used by the Dragon Age games to allow for multiple GDAs to be used for the same resource type, each GDA holding the information for a range of resources. These GDAs complete each other instead of overwriting each other.

All 2DA and GDA files are directly and automatically loaded from the ResourceManager.

Definition at line 58 of file 2dareg.h.

Member Typedef Documentation

◆ GDAMap

Definition at line 88 of file 2dareg.h.

◆ TwoDAMap

Definition at line 87 of file 2dareg.h.

Constructor & Destructor Documentation

◆ TwoDARegistry()

Aurora::TwoDARegistry::TwoDARegistry ( )

Definition at line 39 of file 2dareg.cpp.

◆ ~TwoDARegistry()

Aurora::TwoDARegistry::~TwoDARegistry ( )

Definition at line 42 of file 2dareg.cpp.

References clear().

Here is the call graph for this function:

Member Function Documentation

◆ add2DA()

void Aurora::TwoDARegistry::add2DA ( const Common::UString name)

Add a certain 2DA to the registry, reloading it if necessary.

Definition at line 99 of file 2dareg.cpp.

References _twodas, Common::PtrMap< Key, T, Compare, Deallocator >::erase(), and load2DA().

Here is the call graph for this function:

◆ addGDA()

void Aurora::TwoDARegistry::addGDA ( const Common::UString name)

Add a certain GDA to the registry, reloading it if necessary.

Definition at line 118 of file 2dareg.cpp.

References _gdas, Common::PtrMap< Key, T, Compare, Deallocator >::erase(), and loadGDA().

Here is the call graph for this function:

◆ addMGDA()

void Aurora::TwoDARegistry::addMGDA ( const Common::UString prefix)

Add a certain multiple GDA to the registry, reloading it if necessary.

Definition at line 128 of file 2dareg.cpp.

References _gdas, Common::PtrMap< Key, T, Compare, Deallocator >::erase(), and loadMGDA().

Here is the call graph for this function:

◆ clear()

void Aurora::TwoDARegistry::clear ( )

Definition at line 46 of file 2dareg.cpp.

References _gdas, _twodas, and Common::PtrMap< Key, T, Compare, Deallocator >::clear().

Referenced by ~TwoDARegistry().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ get2DA()

const TwoDAFile & Aurora::TwoDARegistry::get2DA ( const Common::UString name)

Get a certain 2DA, loading it if necessary.

Definition at line 51 of file 2dareg.cpp.

References _twodas, and load2DA().

Here is the call graph for this function:

◆ getGDA()

const GDAFile & Aurora::TwoDARegistry::getGDA ( const Common::UString name)

Get a certain GDA, loading it if necessary.

Definition at line 67 of file 2dareg.cpp.

References _gdas, and loadGDA().

Here is the call graph for this function:

◆ getMGDA()

const GDAFile & Aurora::TwoDARegistry::getMGDA ( const Common::UString prefix)

Get a certain multiple GDA, loading it if necessary.

Definition at line 83 of file 2dareg.cpp.

References _gdas, and loadMGDA().

Here is the call graph for this function:

◆ load2DA()

TwoDAFile * Aurora::TwoDARegistry::load2DA ( const Common::UString name)
private

Definition at line 147 of file 2dareg.cpp.

References Common::StackException::add(), Common::UString::c_str(), Aurora::kFileType2DA, Common::ScopedPtrBase< T, Deallocator >::release(), Common::ScopedPtrBase< T, Deallocator >::reset(), and ResMan.

Referenced by add2DA(), and get2DA().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ loadGDA()

GDAFile * Aurora::TwoDARegistry::loadGDA ( const Common::UString name)
private

Definition at line 166 of file 2dareg.cpp.

References Common::StackException::add(), Common::UString::c_str(), Aurora::kFileTypeGDA, Common::ScopedPtrBase< T, Deallocator >::release(), Common::ScopedPtrBase< T, Deallocator >::reset(), and ResMan.

Referenced by addGDA(), and getGDA().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ loadMGDA()

GDAFile * Aurora::TwoDARegistry::loadMGDA ( Common::UString  prefix)
private

◆ remove2DA()

void Aurora::TwoDARegistry::remove2DA ( const Common::UString name)

Remove a certain 2DA from the registry.

Definition at line 109 of file 2dareg.cpp.

References _twodas, and Common::PtrMap< Key, T, Compare, Deallocator >::erase().

Here is the call graph for this function:

◆ removeGDA()

void Aurora::TwoDARegistry::removeGDA ( const Common::UString name)

Remove a certain GDA from the registry.

Definition at line 138 of file 2dareg.cpp.

References _gdas, and Common::PtrMap< Key, T, Compare, Deallocator >::erase().

Here is the call graph for this function:

Member Data Documentation

◆ _gdas

GDAMap Aurora::TwoDARegistry::_gdas
private

Definition at line 91 of file 2dareg.h.

Referenced by addGDA(), addMGDA(), clear(), getGDA(), getMGDA(), and removeGDA().

◆ _twodas

TwoDAMap Aurora::TwoDARegistry::_twodas
private

Definition at line 90 of file 2dareg.h.

Referenced by add2DA(), clear(), get2DA(), and remove2DA().


The documentation for this class was generated from the following files: