icinga2/lib/base/configobject.ti

110 lines
3.4 KiB
Plaintext

/******************************************************************************
* Icinga 2 *
* Copyright (C) 2012-2017 Icinga Development Team (https://www.icinga.com/) *
* *
* This program is free software; you can redistribute it and/or *
* modify it under the terms of the GNU General Public License *
* as published by the Free Software Foundation; either version 2 *
* of the License, or (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the Free Software Foundation *
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. *
******************************************************************************/
#include "base/debuginfo.hpp"
#include "base/configtype.hpp"
library base;
namespace icinga
{
code {{{
enum HAMode
{
HARunOnce,
HARunEverywhere
};
class I2_BASE_API NameComposer
{
public:
virtual ~NameComposer(void);
virtual String MakeName(const String& shortName, const Object::Ptr& context) const = 0;
virtual Dictionary::Ptr ParseName(const String& name) const = 0;
};
}}}
abstract class ConfigObjectBase
{ };
code {{{
class I2_BASE_API ConfigObjectBase : public ObjectImpl<ConfigObjectBase>
{
public:
inline DebugInfo GetDebugInfo(void) const
{
return m_DebugInfo;
}
void SetDebugInfo(const DebugInfo& di)
{
m_DebugInfo = di;
}
inline virtual void Start(bool /* runtimeCreated */)
{ }
inline virtual void Stop(bool /* runtimeRemoved */)
{ }
private:
DebugInfo m_DebugInfo;
};
}}}
abstract class ConfigObject : ConfigObjectBase < ConfigType
{
[config, no_user_modify] String __name (Name);
[config, no_user_modify] String "name" (ShortName) {
get {{{
if (m_ShortName.IsEmpty())
return GetName();
else
return m_ShortName;
}}}
};
[config, no_user_modify] name(Zone) zone (ZoneName);
[config, no_user_modify] String package;
[config, get_protected, no_user_modify] Array::Ptr templates;
[config, no_storage, no_user_modify] Dictionary::Ptr source_location {
get;
};
[get_protected, no_user_modify] bool active;
[get_protected, no_user_modify] bool paused {
default {{{ return true; }}}
};
[get_protected, no_user_view, no_user_modify] bool start_called;
[get_protected, no_user_view, no_user_modify] bool stop_called;
[get_protected, no_user_view, no_user_modify] bool pause_called;
[get_protected, no_user_view, no_user_modify] bool resume_called;
[enum] HAMode ha_mode (HAMode);
[protected, no_user_view, no_user_modify] Dictionary::Ptr extensions;
[protected, no_user_view, no_user_modify] bool state_loaded;
[no_user_modify] Dictionary::Ptr original_attributes;
[state, no_user_modify] double version {
default {{{ return 0; }}}
};
};
}