From: Matthijs Kooijman Date: Mon, 11 Jun 2007 05:54:44 +0000 (+0200) Subject: * Make arguments that were previously references (see X-Git-Url: https://git.stderr.nl/gitweb?a=commitdiff_plain;h=c3e81e6b78efc4eefdf1837c894edd6022e1d58a;p=matthijs%2FABM2.git * Make arguments that were previously references (see 7e140e4a6676bed7583831251469fcee457f7654) now const references. GCC will allow temporary constructors to be converted to const references and that will do just fine. --- diff --git a/ABM2/Engine/Kernel.cpp b/ABM2/Engine/Kernel.cpp index 42e112b..12afa65 100755 --- a/ABM2/Engine/Kernel.cpp +++ b/ABM2/Engine/Kernel.cpp @@ -75,7 +75,7 @@ int CKernel::Execute() return 0; } -bool CKernel::AddTask(CMMPointer t) +bool CKernel::AddTask(const CMMPointer &t) { if(!t->Start())return false; @@ -90,7 +90,7 @@ bool CKernel::AddTask(CMMPointer t) return true; } -void CKernel::SuspendTask(CMMPointer t) +void CKernel::SuspendTask(const CMMPointer &t) { //check that this task is in our list - we don't want to suspend a task that isn't running if(std::find(taskList.begin(),taskList.end(),t)!=taskList.end()) @@ -101,7 +101,7 @@ void CKernel::SuspendTask(CMMPointer t) } } -void CKernel::ResumeTask(CMMPointer t) +void CKernel::ResumeTask(const CMMPointer &t) { if(std::find(pausedTaskList.begin(),pausedTaskList.end(),t)!=pausedTaskList.end()) { @@ -118,7 +118,7 @@ void CKernel::ResumeTask(CMMPointer t) } } -void CKernel::RemoveTask(CMMPointer t) +void CKernel::RemoveTask(const CMMPointer &t) { if(std::find(taskList.begin(),taskList.end(),t)!=taskList.end()) { diff --git a/ABM2/Engine/Kernel.h b/ABM2/Engine/Kernel.h index 60f6006..0e1c39d 100755 --- a/ABM2/Engine/Kernel.h +++ b/ABM2/Engine/Kernel.h @@ -25,10 +25,10 @@ public: int Execute(); - bool AddTask(CMMPointer t); - void SuspendTask(CMMPointer t); - void ResumeTask(CMMPointer t); - void RemoveTask(CMMPointer t); + bool AddTask(const CMMPointer &t); + void SuspendTask(const CMMPointer &t); + void ResumeTask(const CMMPointer &t); + void RemoveTask(const CMMPointer &t); void KillAllTasks(); protected: diff --git a/ABM2/Engine/Settings.cpp b/ABM2/Engine/Settings.cpp index 0d74f3c..48324c2 100755 --- a/ABM2/Engine/Settings.cpp +++ b/ABM2/Engine/Settings.cpp @@ -20,7 +20,7 @@ CSettingsManager::~CSettingsManager() DestroyStandardSettings(); } -void CSettingsManager::RegisterVariable(std::string name, CMMPointer var) +void CSettingsManager::RegisterVariable(const std::string &name, const CMMPointer &var) { settingMap[name]=var; } diff --git a/ABM2/Engine/Settings.h b/ABM2/Engine/Settings.h index 8b6daf8..cb8d3ae 100755 --- a/ABM2/Engine/Settings.h +++ b/ABM2/Engine/Settings.h @@ -18,7 +18,7 @@ public: CSettingsManager(); virtual ~CSettingsManager(); - void RegisterVariable(std::string name, CMMPointer var); + void RegisterVariable(const std::string &name, const CMMPointer &var); void SetVariable(std::string &name, std::string &value, int bias=0); void CreateStandardSettings();