mirror of https://github.com/Icinga/icinga2.git
Fixed building with --disable-shared.
This commit is contained in:
parent
a4451abad3
commit
e967d931fd
|
@ -27,10 +27,6 @@ using namespace icinga;
|
|||
* performance (see http://gcc.gnu.org/onlinedocs/libstdc++/manual/bk01pt11ch25s02.html).
|
||||
*/
|
||||
|
||||
const String CompatComponent::DefaultStatusPath = Application::GetLocalStateDir() + "/status.dat";
|
||||
const String CompatComponent::DefaultObjectsPath = Application::GetLocalStateDir() + "/objects.cache";
|
||||
const String CompatComponent::DefaultCommandPath = Application::GetLocalStateDir() + "/icinga.cmd";
|
||||
|
||||
/**
|
||||
* Retrieves the status.dat path.
|
||||
*
|
||||
|
@ -40,7 +36,7 @@ String CompatComponent::GetStatusPath(void) const
|
|||
{
|
||||
Value statusPath = GetConfig()->Get("status_path");
|
||||
if (statusPath.IsEmpty())
|
||||
return DefaultStatusPath;
|
||||
return Application::GetLocalStateDir() + "/status.dat";
|
||||
else
|
||||
return statusPath;
|
||||
}
|
||||
|
@ -54,7 +50,7 @@ String CompatComponent::GetObjectsPath(void) const
|
|||
{
|
||||
Value objectsPath = GetConfig()->Get("objects_path");
|
||||
if (objectsPath.IsEmpty())
|
||||
return DefaultObjectsPath;
|
||||
return Application::GetLocalStateDir() + "/objects.cache";
|
||||
else
|
||||
return objectsPath;
|
||||
}
|
||||
|
@ -68,7 +64,7 @@ String CompatComponent::GetCommandPath(void) const
|
|||
{
|
||||
Value commandPath = GetConfig()->Get("command_path");
|
||||
if (commandPath.IsEmpty())
|
||||
return DefaultCommandPath;
|
||||
return Application::GetLocalStateDir() + "/icinga.cmd";
|
||||
else
|
||||
return commandPath;
|
||||
}
|
||||
|
|
|
@ -85,10 +85,6 @@ private:
|
|||
void DumpServiceObject(ofstream& fp, const Service::Ptr& service);
|
||||
|
||||
void StatusTimerHandler(void);
|
||||
|
||||
static const String DefaultStatusPath;
|
||||
static const String DefaultObjectsPath;
|
||||
static const String DefaultCommandPath;
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
@ -21,29 +21,27 @@
|
|||
|
||||
using namespace icinga;
|
||||
|
||||
map<String, ScriptFunction::Ptr> ScriptFunction::m_Functions;
|
||||
|
||||
ScriptFunction::ScriptFunction(const Callback& function)
|
||||
: m_Callback(function)
|
||||
{ }
|
||||
|
||||
void ScriptFunction::Register(const String& name, const ScriptFunction::Ptr& function)
|
||||
{
|
||||
m_Functions[name] = function;
|
||||
GetFunctions()[name] = function;
|
||||
}
|
||||
|
||||
void ScriptFunction::Unregister(const String& name)
|
||||
{
|
||||
m_Functions.erase(name);
|
||||
GetFunctions().erase(name);
|
||||
}
|
||||
|
||||
ScriptFunction::Ptr ScriptFunction::GetByName(const String& name)
|
||||
{
|
||||
map<String, ScriptFunction::Ptr>::iterator it;
|
||||
|
||||
it = m_Functions.find(name);
|
||||
it = GetFunctions().find(name);
|
||||
|
||||
if (it == m_Functions.end())
|
||||
if (it == GetFunctions().end())
|
||||
return ScriptFunction::Ptr();
|
||||
|
||||
return it->second;
|
||||
|
@ -53,3 +51,9 @@ void ScriptFunction::Invoke(const ScriptTask::Ptr& task, const vector<Value>& ar
|
|||
{
|
||||
m_Callback(task, arguments);
|
||||
}
|
||||
|
||||
map<String, ScriptFunction::Ptr>& ScriptFunction::GetFunctions(void)
|
||||
{
|
||||
static map<String, ScriptFunction::Ptr> functions;
|
||||
return functions;
|
||||
}
|
||||
|
|
|
@ -49,7 +49,7 @@ public:
|
|||
private:
|
||||
Callback m_Callback;
|
||||
|
||||
static map<String, ScriptFunction::Ptr> m_Functions;
|
||||
static map<String, ScriptFunction::Ptr>& GetFunctions(void);
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue