custom attr: move into DynamicObject using GetCustom()

This commit is contained in:
Michael Friedrich 2013-07-12 15:13:05 +02:00
parent cfb3c9cf9f
commit 36e9e9adbd
7 changed files with 10 additions and 17 deletions

View File

@ -624,7 +624,7 @@ void CompatComponent::DumpServiceObject(std::ostream& fp, const Service::Ptr& se
void CompatComponent::DumpCustomAttributes(std::ostream& fp, const DynamicObject::Ptr& object)
{
Dictionary::Ptr custom = object->Get("custom");
Dictionary::Ptr custom = object->GetCustom();
if (!custom)
return;

View File

@ -56,6 +56,7 @@ DynamicObject::DynamicObject(const Dictionary::Ptr& serializedObject)
RegisterAttribute("__local", Attribute_Config, &m_Local);
RegisterAttribute("__source", Attribute_Local, &m_Source);
RegisterAttribute("methods", Attribute_Config, &m_Methods);
RegisterAttribute("custom", Attribute_Config, &m_Custom);
if (!serializedObject->Contains("configTx"))
BOOST_THROW_EXCEPTION(std::invalid_argument("Serialized object must contain a config snapshot."));
@ -616,3 +617,8 @@ const DynamicObject::AttributeMap& DynamicObject::GetAttributes(void) const
return m_Attributes;
}
Dictionary::Ptr DynamicObject::GetCustom(void) const
{
return m_Custom;
}

View File

@ -101,6 +101,8 @@ public:
static double GetCurrentTx(void);
Dictionary::Ptr GetCustom(void) const;
protected:
explicit DynamicObject(const Dictionary::Ptr& serializedObject);
@ -125,6 +127,7 @@ private:
Attribute<bool> m_Local;
Attribute<String> m_Source;
Attribute<Dictionary::Ptr> m_Methods;
Attribute<Dictionary::Ptr> m_Custom;
bool m_Registered; /**< protected by the type mutex */

View File

@ -51,7 +51,6 @@ Host::Host(const Dictionary::Ptr& serializedUpdate)
RegisterAttribute("display_name", Attribute_Config, &m_DisplayName);
RegisterAttribute("hostgroups", Attribute_Config, &m_HostGroups);
RegisterAttribute("macros", Attribute_Config, &m_Macros);
RegisterAttribute("custom", Attribute_Config, &m_Custom);
RegisterAttribute("hostdependencies", Attribute_Config, &m_HostDependencies);
RegisterAttribute("servicedependencies", Attribute_Config, &m_ServiceDependencies);
RegisterAttribute("hostcheck", Attribute_Config, &m_HostCheck);
@ -105,11 +104,6 @@ Dictionary::Ptr Host::GetMacros(void) const
return m_Macros;
}
Dictionary::Ptr Host::GetCustom(void) const
{
return m_Custom;
}
Array::Ptr Host::GetHostDependencies(void) const
{
return m_HostDependencies;;

View File

@ -88,7 +88,6 @@ public:
Array::Ptr GetGroups(void) const;
Dictionary::Ptr GetMacros(void) const;
Dictionary::Ptr GetCustom(void) const;
Array::Ptr GetHostDependencies(void) const;
Array::Ptr GetServiceDependencies(void) const;
String GetHostCheck(void) const;
@ -128,7 +127,6 @@ private:
Attribute<String> m_DisplayName;
Attribute<Array::Ptr> m_HostGroups;
Attribute<Dictionary::Ptr> m_Macros;
Attribute<Dictionary::Ptr> m_Custom;
Attribute<Array::Ptr> m_HostDependencies;
Attribute<Array::Ptr> m_ServiceDependencies;
Attribute<String> m_HostCheck;

View File

@ -44,7 +44,6 @@ Service::Service(const Dictionary::Ptr& serializedObject)
RegisterAttribute("display_name", Attribute_Config, &m_DisplayName);
RegisterAttribute("macros", Attribute_Config, &m_Macros);
RegisterAttribute("custom", Attribute_Config, &m_Custom);
RegisterAttribute("hostdependencies", Attribute_Config, &m_HostDependencies);
RegisterAttribute("servicedependencies", Attribute_Config, &m_ServiceDependencies);
RegisterAttribute("servicegroups", Attribute_Config, &m_ServiceGroups);
@ -167,11 +166,6 @@ Dictionary::Ptr Service::GetMacros(void) const
return m_Macros;
}
Dictionary::Ptr Service::GetCustom(void) const
{
return m_Custom;
}
Array::Ptr Service::GetHostDependencies(void) const
{
return m_HostDependencies;

View File

@ -112,7 +112,6 @@ public:
String GetDisplayName(void) const;
Host::Ptr GetHost(void) const;
Dictionary::Ptr GetMacros(void) const;
Dictionary::Ptr GetCustom(void) const;
Array::Ptr GetHostDependencies(void) const;
Array::Ptr GetServiceDependencies(void) const;
Array::Ptr GetGroups(void) const;
@ -311,7 +310,6 @@ private:
Attribute<String> m_DisplayName;
Attribute<Dictionary::Ptr> m_Macros;
Attribute<Dictionary::Ptr> m_Custom;
Attribute<Array::Ptr> m_HostDependencies;
Attribute<Array::Ptr> m_ServiceDependencies;
Attribute<Array::Ptr> m_ServiceGroups;