TrinityCore
ScriptRegistryCompositum Class Reference
+ Inheritance diagram for ScriptRegistryCompositum:

Classes

class  DeleteableObject
 
class  DeleteableObjectBase
 Type erasure wrapper for objects. More...
 

Public Member Functions

void SetScriptNameInContext (std::string const &scriptname, std::string const &context)
 
std::string const & GetScriptContextOfScriptName (std::string const &scriptname) const
 
void ReleaseContext (std::string const &context) final override
 
void SwapContext (bool initialize) final override
 Injects and updates the changed script objects. More...
 
void RemoveUsedScriptsFromContainer (std::unordered_set< std::string > &scripts) final override
 
void Unload () final override
 Unloads the script registry. More...
 
void SyncScriptNames () final override
 Updates the scripts to reflect the current id. More...
 
template<typename T >
void QueueForDelayedDelete (T &&any)
 
- Public Member Functions inherited from ScriptRegistryInterface
 ScriptRegistryInterface ()
 
virtual ~ScriptRegistryInterface ()
 
 ScriptRegistryInterface (ScriptRegistryInterface const &)=delete
 
 ScriptRegistryInterface (ScriptRegistryInterface &&)=delete
 
ScriptRegistryInterfaceoperator= (ScriptRegistryInterface const &)=delete
 
ScriptRegistryInterfaceoperator= (ScriptRegistryInterface &&)=delete
 
virtual void ReleaseContext (std::string const &context)=0
 
virtual void SwapContext (bool initialize)=0
 Injects and updates the changed script objects. More...
 
virtual void RemoveUsedScriptsFromContainer (std::unordered_set< std::string > &scripts)=0
 
virtual void Unload ()=0
 Unloads the script registry. More...
 
virtual void SyncScriptNames ()=0
 Updates the scripts to reflect the current id. More...
 

Static Public Member Functions

static ScriptRegistryCompositumInstance ()
 

Private Member Functions

 ScriptRegistryCompositum ()
 
void Register (ScriptRegistryInterface *registry)
 
void DoDelayedDelete ()
 

Private Attributes

std::unordered_set< ScriptRegistryInterface * > _registries
 
std::vector< std::unique_ptr< DeleteableObjectBase > > _delayed_delete_queue
 
std::unordered_map< std::string, std::string > _scriptnames_to_context
 

Friends

template<class >
class ScriptRegistry
 

Detailed Description

Definition at line 182 of file ScriptMgr.cpp.

Constructor & Destructor Documentation

◆ ScriptRegistryCompositum()

ScriptRegistryCompositum::ScriptRegistryCompositum ( )
inlineprivate

Definition at line 185 of file ScriptMgr.cpp.

Member Function Documentation

◆ DoDelayedDelete()

void ScriptRegistryCompositum::DoDelayedDelete ( )
inlineprivate

Definition at line 293 of file ScriptMgr.cpp.

+ Here is the caller graph for this function:

◆ GetScriptContextOfScriptName()

std::string const & ScriptRegistryCompositum::GetScriptContextOfScriptName ( std::string const &  scriptname) const
inline

Definition at line 221 of file ScriptMgr.cpp.

◆ Instance()

static ScriptRegistryCompositum * ScriptRegistryCompositum::Instance ( )
inlinestatic

Definition at line 281 of file ScriptMgr.cpp.

◆ QueueForDelayedDelete()

template<typename T >
void ScriptRegistryCompositum::QueueForDelayedDelete ( T &&  any)
inline

Definition at line 272 of file ScriptMgr.cpp.

◆ Register()

void ScriptRegistryCompositum::Register ( ScriptRegistryInterface registry)
inlineprivate

Definition at line 288 of file ScriptMgr.cpp.

◆ ReleaseContext()

void ScriptRegistryCompositum::ReleaseContext ( std::string const &  context)
inlinefinaloverridevirtual

Removes all scripts associated with the given script context. Requires ScriptRegistryBase::SwapContext to be called after all transfers have finished.

Implements ScriptRegistryInterface.

Definition at line 229 of file ScriptMgr.cpp.

◆ RemoveUsedScriptsFromContainer()

void ScriptRegistryCompositum::RemoveUsedScriptsFromContainer ( std::unordered_set< std::string > &  scripts)
inlinefinaloverridevirtual

Removes the scripts used by this registry from the given container. Used to find unused script names.

Implements ScriptRegistryInterface.

Definition at line 253 of file ScriptMgr.cpp.

◆ SetScriptNameInContext()

void ScriptRegistryCompositum::SetScriptNameInContext ( std::string const &  scriptname,
std::string const &  context 
)
inline

Definition at line 214 of file ScriptMgr.cpp.

◆ SwapContext()

void ScriptRegistryCompositum::SwapContext ( bool  initialize)
inlinefinaloverridevirtual

Injects and updates the changed script objects.

Implements ScriptRegistryInterface.

Definition at line 245 of file ScriptMgr.cpp.

+ Here is the call graph for this function:

◆ SyncScriptNames()

void ScriptRegistryCompositum::SyncScriptNames ( )
inlinefinaloverridevirtual

Updates the scripts to reflect the current id.

Implements ScriptRegistryInterface.

Definition at line 265 of file ScriptMgr.cpp.

◆ Unload()

void ScriptRegistryCompositum::Unload ( )
inlinefinaloverridevirtual

Unloads the script registry.

Implements ScriptRegistryInterface.

Definition at line 259 of file ScriptMgr.cpp.

Friends And Related Function Documentation

◆ ScriptRegistry

template<class >
friend class ScriptRegistry
friend

Definition at line 188 of file ScriptMgr.cpp.

Member Data Documentation

◆ _delayed_delete_queue

std::vector<std::unique_ptr<DeleteableObjectBase> > ScriptRegistryCompositum::_delayed_delete_queue
private

Definition at line 300 of file ScriptMgr.cpp.

◆ _registries

std::unordered_set<ScriptRegistryInterface*> ScriptRegistryCompositum::_registries
private

Definition at line 298 of file ScriptMgr.cpp.

◆ _scriptnames_to_context

std::unordered_map< std::string , std::string > ScriptRegistryCompositum::_scriptnames_to_context
private

Definition at line 305 of file ScriptMgr.cpp.


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