Add MessageOrigin to OnVarsChanged.

Refs #6187
Refs #5219
This commit is contained in:
Michael Friedrich 2014-05-19 18:17:47 +02:00
parent 601e10cb46
commit af951819bc
6 changed files with 13 additions and 15 deletions

View File

@ -34,8 +34,7 @@ namespace icinga
class DynamicType;
/**
* A dynamic object that can be instantiated from the configuration file
* and that supports attribute replication to remote application instances.
* A dynamic object that can be instantiated from the configuration file.
*
* @ingroup base
*/

View File

@ -255,6 +255,6 @@ void Checkable::SetModifiedAttributes(int flags, const MessageOrigin& origin)
if ((flags & ModAttrCustomVariable) == 0) {
SetOverrideVars(Empty);
OnVarsChanged(GetSelf());
OnVarsChanged(GetSelf(), origin);
}
}

View File

@ -37,6 +37,6 @@ void Command::SetModifiedAttributes(int flags, const MessageOrigin& origin)
{
if ((flags & ModAttrCustomVariable) == 0) {
SetOverrideVars(Empty);
OnVarsChanged(GetSelf());
OnVarsChanged(GetSelf(), origin);
}
}

View File

@ -24,7 +24,7 @@ using namespace icinga;
REGISTER_TYPE(CustomVarObject);
boost::signals2::signal<void (const CustomVarObject::Ptr&)> CustomVarObject::OnVarsChanged;
boost::signals2::signal<void (const CustomVarObject::Ptr&, const MessageOrigin&)> CustomVarObject::OnVarsChanged;
Dictionary::Ptr CustomVarObject::GetVars(void) const
{
@ -34,13 +34,13 @@ Dictionary::Ptr CustomVarObject::GetVars(void) const
return GetVarsRaw();
}
void CustomVarObject::SetVars(const Dictionary::Ptr& vars)
void CustomVarObject::SetVars(const Dictionary::Ptr& vars, const MessageOrigin& origin)
{
SetOverrideVars(vars);
Log(LogDebug, "icinga", "Setting vars for object '" + GetName() + "'");
OnVarsChanged(GetSelf());
OnVarsChanged(GetSelf(), origin);
}
int CustomVarObject::GetModifiedAttributes(void) const
@ -54,7 +54,7 @@ void CustomVarObject::SetModifiedAttributes(int, const MessageOrigin&)
/* does nothing by default */
}
bool CustomVarObject::IsVarOverridden(const String& name)
bool CustomVarObject::IsVarOverridden(const String& name) const
{
Dictionary::Ptr vars_override = GetOverrideVars();

View File

@ -49,25 +49,24 @@ enum ModifiedAttributeType
};
/**
* A dynamic object that can be instantiated from the configuration file
* and that supports attribute replication to remote application instances.
* An object with custom variable attribute.
*
* @ingroup base
* @ingroup icinga
*/
class I2_BASE_API CustomVarObject : public ObjectImpl<CustomVarObject>
{
public:
DECLARE_PTR_TYPEDEFS(CustomVarObject);
static boost::signals2::signal<void (const CustomVarObject::Ptr&)> OnVarsChanged;
static boost::signals2::signal<void (const CustomVarObject::Ptr&, const MessageOrigin&)> OnVarsChanged;
Dictionary::Ptr GetVars(void) const;
void SetVars(const Dictionary::Ptr& vars);
void SetVars(const Dictionary::Ptr& vars, const MessageOrigin& origin = MessageOrigin());
virtual int GetModifiedAttributes(void) const;
virtual void SetModifiedAttributes(int flags, const MessageOrigin& origin = MessageOrigin());
bool IsVarOverridden(const String& name);
bool IsVarOverridden(const String& name) const;
};
}

View File

@ -121,6 +121,6 @@ void User::SetModifiedAttributes(int flags, const MessageOrigin& origin)
{
if ((flags & ModAttrCustomVariable) == 0) {
SetOverrideVars(Empty);
OnVarsChanged(GetSelf());
OnVarsChanged(GetSelf(), origin);
}
}