2012-06-06 14:38:28 +02:00
|
|
|
/******************************************************************************
|
|
|
|
* Icinga 2 *
|
|
|
|
* Copyright (C) 2012 Icinga Development Team (http://www.icinga.org/) *
|
|
|
|
* *
|
|
|
|
* 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. *
|
|
|
|
******************************************************************************/
|
|
|
|
|
|
|
|
#ifndef CONFIGITEM_H
|
|
|
|
#define CONFIGITEM_H
|
2012-06-01 16:49:33 +02:00
|
|
|
|
|
|
|
namespace icinga
|
|
|
|
{
|
|
|
|
|
2012-07-07 13:17:50 +02:00
|
|
|
class I2_DYN_API ConfigItem : public Object {
|
2012-06-01 16:49:33 +02:00
|
|
|
public:
|
2012-06-06 14:38:28 +02:00
|
|
|
typedef shared_ptr<ConfigItem> Ptr;
|
|
|
|
typedef weak_ptr<ConfigItem> WeakPtr;
|
|
|
|
|
2012-07-06 11:22:38 +02:00
|
|
|
typedef ObjectSet<ConfigItem::Ptr> Set;
|
|
|
|
|
2012-06-06 14:38:28 +02:00
|
|
|
typedef ObjectMap<pair<string, string>, ConfigItem::Ptr> TNMap;
|
2012-06-01 16:49:33 +02:00
|
|
|
|
2012-07-06 14:33:10 +02:00
|
|
|
ConfigItem(const string& type, const string& name,
|
|
|
|
const ExpressionList::Ptr& exprl, const vector<string>& parents,
|
|
|
|
const DebugInfo& debuginfo);
|
2012-06-05 15:05:15 +02:00
|
|
|
|
|
|
|
string GetType(void) const;
|
|
|
|
string GetName(void) const;
|
|
|
|
|
2012-06-01 16:49:33 +02:00
|
|
|
vector<string> GetParents(void) const;
|
|
|
|
|
|
|
|
ExpressionList::Ptr GetExpressionList(void) const;
|
|
|
|
|
2012-06-06 20:33:25 +02:00
|
|
|
void CalculateProperties(Dictionary::Ptr dictionary) const;
|
2012-06-05 15:05:15 +02:00
|
|
|
|
2012-07-06 11:22:38 +02:00
|
|
|
ConfigObject::Ptr Commit(void);
|
2012-06-06 14:38:28 +02:00
|
|
|
void Unregister(void);
|
|
|
|
|
2012-07-06 11:22:38 +02:00
|
|
|
ConfigObject::Ptr GetConfigObject(void) const;
|
|
|
|
|
|
|
|
DebugInfo GetDebugInfo(void) const;
|
|
|
|
|
|
|
|
static Set::Ptr GetAllObjects(void);
|
2012-06-06 14:38:28 +02:00
|
|
|
static TNMap::Ptr GetObjectsByTypeAndName(void);
|
2012-06-11 08:21:47 +02:00
|
|
|
static ConfigItem::Ptr GetObject(const string& type, const string& name);
|
2012-06-05 15:05:15 +02:00
|
|
|
|
2012-06-01 16:49:33 +02:00
|
|
|
private:
|
|
|
|
string m_Type;
|
|
|
|
string m_Name;
|
2012-07-06 14:33:10 +02:00
|
|
|
|
2012-06-01 16:49:33 +02:00
|
|
|
ExpressionList::Ptr m_ExpressionList;
|
2012-07-06 14:33:10 +02:00
|
|
|
vector<string> m_Parents;
|
|
|
|
DebugInfo m_DebugInfo;
|
2012-06-01 16:49:33 +02:00
|
|
|
|
2012-06-12 09:36:18 +02:00
|
|
|
ConfigObject::WeakPtr m_ConfigObject;
|
2012-06-06 14:38:28 +02:00
|
|
|
|
|
|
|
static bool GetTypeAndName(const ConfigItem::Ptr& object, pair<string, string> *key);
|
2012-06-01 16:49:33 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2012-06-06 14:38:28 +02:00
|
|
|
#endif /* CONFIGITEM_H */
|