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 *(*pCreateComponent)();
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);
return ci->second;
}
-void Application::UnloadComponent(string name)
+void Application::UnloadComponent(const string& name)
{
map<string, Component::Ptr>::iterator ci = m_Components.find(name);
m_Arguments = arguments;
}
-vector<string>& Application::GetArguments(void)
+const vector<string>& Application::GetArguments(void)
{
return m_Arguments;
}
-string Application::GetExeDirectory(void)
+const string& Application::GetExeDirectory(void)
{
static string ExePath;
return ExePath;
}
-void Application::AddComponentSearchDir(string componentDirectory)
+void Application::AddComponentSearchDir(const string& componentDirectory)
{
#ifdef _WIN32
SetDllDirectory(componentDirectory.c_str());
virtual int Main(const vector<string>& args) = 0;
void SetArguments(const vector<string>& arguments);
- vector<string>& GetArguments(void);
+ const vector<string>& GetArguments(void);
void RunEventLoop(void);
bool Daemonize(void);
ConfigHive::Ptr GetConfigHive(void);
- shared_ptr<Component> LoadComponent(string path, ConfigObject::Ptr componentConfig);
- void UnloadComponent(string name);
- shared_ptr<Component> GetComponent(string name);
- void AddComponentSearchDir(string componentDirectory);
+ shared_ptr<Component> LoadComponent(const string& path, const ConfigObject::Ptr& componentConfig);
+ void UnloadComponent(const string& name);
+ shared_ptr<Component> GetComponent(const string& name);
+ void AddComponentSearchDir(const string& componentDirectory);
- string GetExeDirectory(void);
+ const string& GetExeDirectory(void);
};
template<class T>
return m_Application.lock();
}
-void Component::SetConfig(ConfigObject::Ptr componentConfig)
+void Component::SetConfig(const ConfigObject::Ptr& componentConfig)
{
m_Config = componentConfig;
}
void SetApplication(const Application::WeakPtr& application);
Application::Ptr GetApplication(void);
- void SetConfig(ConfigObject::Ptr componentConfig);
+ void SetConfig(const ConfigObject::Ptr& componentConfig);
ConfigObject::Ptr GetConfig(void);
virtual string GetName(void) = 0;
using namespace icinga;
-void ConfigHive::AddObject(ConfigObject::Ptr object)
+void ConfigHive::AddObject(const ConfigObject::Ptr& object)
{
string type = object->GetType();
TypeIterator ti = Objects.find(type);
OnObjectCreated(ea);
}
-void ConfigHive::RemoveObject(ConfigObject::Ptr object)
+void ConfigHive::RemoveObject(const ConfigObject::Ptr& object)
{
string type = object->GetType();
TypeIterator ti = Objects.find(type);
typedef map<string, ConfigObject::Ptr>::iterator ObjectIterator;
map< string, map<string, ConfigObject::Ptr> > Objects;
- void AddObject(ConfigObject::Ptr object);
- void RemoveObject(ConfigObject::Ptr object);
+ void AddObject(const ConfigObject::Ptr& object);
+ void RemoveObject(const ConfigObject::Ptr& object);
ConfigObject::Ptr GetObject(const string& type, const string& name = string());
event<ConfigHiveEventArgs::Ptr> OnObjectCreated;