mirror of https://github.com/Icinga/icinga2.git
Use const references for shared ptrs.
This commit is contained in:
parent
3da08ca9b6
commit
b30284c64c
|
@ -175,7 +175,7 @@ ConfigHive::Ptr Application::GetConfigHive(void)
|
||||||
return m_ConfigHive;
|
return m_ConfigHive;
|
||||||
}
|
}
|
||||||
|
|
||||||
Component::Ptr Application::LoadComponent(string path, ConfigObject::Ptr componentConfig)
|
Component::Ptr Application::LoadComponent(const string& path, const ConfigObject::Ptr& componentConfig)
|
||||||
{
|
{
|
||||||
Component::Ptr component;
|
Component::Ptr component;
|
||||||
Component *(*pCreateComponent)();
|
Component *(*pCreateComponent)();
|
||||||
|
@ -217,7 +217,7 @@ Component::Ptr Application::LoadComponent(string path, ConfigObject::Ptr compone
|
||||||
return component;
|
return component;
|
||||||
}
|
}
|
||||||
|
|
||||||
Component::Ptr Application::GetComponent(string name)
|
Component::Ptr Application::GetComponent(const string& name)
|
||||||
{
|
{
|
||||||
map<string, Component::Ptr>::iterator ci = m_Components.find(name);
|
map<string, Component::Ptr>::iterator ci = m_Components.find(name);
|
||||||
|
|
||||||
|
@ -227,7 +227,7 @@ Component::Ptr Application::GetComponent(string name)
|
||||||
return ci->second;
|
return ci->second;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Application::UnloadComponent(string name)
|
void Application::UnloadComponent(const string& name)
|
||||||
{
|
{
|
||||||
map<string, Component::Ptr>::iterator ci = m_Components.find(name);
|
map<string, Component::Ptr>::iterator ci = m_Components.find(name);
|
||||||
|
|
||||||
|
@ -261,12 +261,12 @@ void Application::SetArguments(const vector<string>& arguments)
|
||||||
m_Arguments = arguments;
|
m_Arguments = arguments;
|
||||||
}
|
}
|
||||||
|
|
||||||
vector<string>& Application::GetArguments(void)
|
const vector<string>& Application::GetArguments(void)
|
||||||
{
|
{
|
||||||
return m_Arguments;
|
return m_Arguments;
|
||||||
}
|
}
|
||||||
|
|
||||||
string Application::GetExeDirectory(void)
|
const string& Application::GetExeDirectory(void)
|
||||||
{
|
{
|
||||||
static string ExePath;
|
static string ExePath;
|
||||||
|
|
||||||
|
@ -344,7 +344,7 @@ string Application::GetExeDirectory(void)
|
||||||
return ExePath;
|
return ExePath;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Application::AddComponentSearchDir(string componentDirectory)
|
void Application::AddComponentSearchDir(const string& componentDirectory)
|
||||||
{
|
{
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
SetDllDirectory(componentDirectory.c_str());
|
SetDllDirectory(componentDirectory.c_str());
|
||||||
|
|
|
@ -24,7 +24,7 @@ public:
|
||||||
virtual int Main(const vector<string>& args) = 0;
|
virtual int Main(const vector<string>& args) = 0;
|
||||||
|
|
||||||
void SetArguments(const vector<string>& arguments);
|
void SetArguments(const vector<string>& arguments);
|
||||||
vector<string>& GetArguments(void);
|
const vector<string>& GetArguments(void);
|
||||||
|
|
||||||
void RunEventLoop(void);
|
void RunEventLoop(void);
|
||||||
bool Daemonize(void);
|
bool Daemonize(void);
|
||||||
|
@ -34,12 +34,12 @@ public:
|
||||||
|
|
||||||
ConfigHive::Ptr GetConfigHive(void);
|
ConfigHive::Ptr GetConfigHive(void);
|
||||||
|
|
||||||
shared_ptr<Component> LoadComponent(string path, ConfigObject::Ptr componentConfig);
|
shared_ptr<Component> LoadComponent(const string& path, const ConfigObject::Ptr& componentConfig);
|
||||||
void UnloadComponent(string name);
|
void UnloadComponent(const string& name);
|
||||||
shared_ptr<Component> GetComponent(string name);
|
shared_ptr<Component> GetComponent(const string& name);
|
||||||
void AddComponentSearchDir(string componentDirectory);
|
void AddComponentSearchDir(const string& componentDirectory);
|
||||||
|
|
||||||
string GetExeDirectory(void);
|
const string& GetExeDirectory(void);
|
||||||
};
|
};
|
||||||
|
|
||||||
template<class T>
|
template<class T>
|
||||||
|
|
|
@ -12,7 +12,7 @@ Application::Ptr Component::GetApplication(void)
|
||||||
return m_Application.lock();
|
return m_Application.lock();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Component::SetConfig(ConfigObject::Ptr componentConfig)
|
void Component::SetConfig(const ConfigObject::Ptr& componentConfig)
|
||||||
{
|
{
|
||||||
m_Config = componentConfig;
|
m_Config = componentConfig;
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,7 +17,7 @@ public:
|
||||||
void SetApplication(const Application::WeakPtr& application);
|
void SetApplication(const Application::WeakPtr& application);
|
||||||
Application::Ptr GetApplication(void);
|
Application::Ptr GetApplication(void);
|
||||||
|
|
||||||
void SetConfig(ConfigObject::Ptr componentConfig);
|
void SetConfig(const ConfigObject::Ptr& componentConfig);
|
||||||
ConfigObject::Ptr GetConfig(void);
|
ConfigObject::Ptr GetConfig(void);
|
||||||
|
|
||||||
virtual string GetName(void) = 0;
|
virtual string GetName(void) = 0;
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
using namespace icinga;
|
using namespace icinga;
|
||||||
|
|
||||||
void ConfigHive::AddObject(ConfigObject::Ptr object)
|
void ConfigHive::AddObject(const ConfigObject::Ptr& object)
|
||||||
{
|
{
|
||||||
string type = object->GetType();
|
string type = object->GetType();
|
||||||
TypeIterator ti = Objects.find(type);
|
TypeIterator ti = Objects.find(type);
|
||||||
|
@ -23,7 +23,7 @@ void ConfigHive::AddObject(ConfigObject::Ptr object)
|
||||||
OnObjectCreated(ea);
|
OnObjectCreated(ea);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ConfigHive::RemoveObject(ConfigObject::Ptr object)
|
void ConfigHive::RemoveObject(const ConfigObject::Ptr& object)
|
||||||
{
|
{
|
||||||
string type = object->GetType();
|
string type = object->GetType();
|
||||||
TypeIterator ti = Objects.find(type);
|
TypeIterator ti = Objects.find(type);
|
||||||
|
|
|
@ -24,8 +24,8 @@ public:
|
||||||
typedef map<string, ConfigObject::Ptr>::iterator ObjectIterator;
|
typedef map<string, ConfigObject::Ptr>::iterator ObjectIterator;
|
||||||
map< string, map<string, ConfigObject::Ptr> > Objects;
|
map< string, map<string, ConfigObject::Ptr> > Objects;
|
||||||
|
|
||||||
void AddObject(ConfigObject::Ptr object);
|
void AddObject(const ConfigObject::Ptr& object);
|
||||||
void RemoveObject(ConfigObject::Ptr object);
|
void RemoveObject(const ConfigObject::Ptr& object);
|
||||||
ConfigObject::Ptr GetObject(const string& type, const string& name = string());
|
ConfigObject::Ptr GetObject(const string& type, const string& name = string());
|
||||||
|
|
||||||
event<ConfigHiveEventArgs::Ptr> OnObjectCreated;
|
event<ConfigHiveEventArgs::Ptr> OnObjectCreated;
|
||||||
|
|
Loading…
Reference in New Issue