Add On{Event,Check}CommandChanged event

refs #5219
This commit is contained in:
Michael Friedrich 2014-08-26 13:13:12 +02:00
parent 3899601744
commit 552d0a7d18
3 changed files with 12 additions and 4 deletions

View File

@ -45,6 +45,7 @@ boost::signals2::signal<void (const Checkable::Ptr&, bool, const MessageOrigin&)
boost::signals2::signal<void (const Checkable::Ptr&, bool, const MessageOrigin&)> Checkable::OnEnableFlappingChanged; boost::signals2::signal<void (const Checkable::Ptr&, bool, const MessageOrigin&)> Checkable::OnEnableFlappingChanged;
boost::signals2::signal<void (const Checkable::Ptr&, double, const MessageOrigin&)> Checkable::OnCheckIntervalChanged; boost::signals2::signal<void (const Checkable::Ptr&, double, const MessageOrigin&)> Checkable::OnCheckIntervalChanged;
boost::signals2::signal<void (const Checkable::Ptr&, double, const MessageOrigin&)> Checkable::OnRetryIntervalChanged; boost::signals2::signal<void (const Checkable::Ptr&, double, const MessageOrigin&)> Checkable::OnRetryIntervalChanged;
boost::signals2::signal<void (const Checkable::Ptr&, const CheckCommand::Ptr&, const MessageOrigin&)> Checkable::OnCheckCommandChanged;
boost::signals2::signal<void (const Checkable::Ptr&, FlappingState)> Checkable::OnFlappingChanged; boost::signals2::signal<void (const Checkable::Ptr&, FlappingState)> Checkable::OnFlappingChanged;
CheckCommand::Ptr Checkable::GetCheckCommand(void) const CheckCommand::Ptr Checkable::GetCheckCommand(void) const
@ -59,9 +60,11 @@ CheckCommand::Ptr Checkable::GetCheckCommand(void) const
return CheckCommand::GetByName(command); return CheckCommand::GetByName(command);
} }
void Checkable::SetCheckCommand(const CheckCommand::Ptr& command) void Checkable::SetCheckCommand(const CheckCommand::Ptr& command, const MessageOrigin& origin)
{ {
SetOverrideCheckCommand(command->GetName()); SetOverrideCheckCommand(command->GetName());
OnCheckCommandChanged(GetSelf(), command, origin);
} }
TimePeriod::Ptr Checkable::GetCheckPeriod(void) const TimePeriod::Ptr Checkable::GetCheckPeriod(void) const

View File

@ -27,6 +27,7 @@ using namespace icinga;
boost::signals2::signal<void (const Checkable::Ptr&)> Checkable::OnEventCommandExecuted; boost::signals2::signal<void (const Checkable::Ptr&)> Checkable::OnEventCommandExecuted;
boost::signals2::signal<void (const Checkable::Ptr&, bool, const MessageOrigin&)> Checkable::OnEnableEventHandlerChanged; boost::signals2::signal<void (const Checkable::Ptr&, bool, const MessageOrigin&)> Checkable::OnEnableEventHandlerChanged;
boost::signals2::signal<void (const Checkable::Ptr&, const EventCommand::Ptr&, const MessageOrigin&)> Checkable::OnEventCommandChanged;
bool Checkable::GetEnableEventHandler(void) const bool Checkable::GetEnableEventHandler(void) const
{ {
@ -55,9 +56,11 @@ EventCommand::Ptr Checkable::GetEventCommand(void) const
return EventCommand::GetByName(command); return EventCommand::GetByName(command);
} }
void Checkable::SetEventCommand(const EventCommand::Ptr& command) void Checkable::SetEventCommand(const EventCommand::Ptr& command, const MessageOrigin& origin)
{ {
SetOverrideEventCommand(command->GetName()); SetOverrideEventCommand(command->GetName());
OnEventCommandChanged(GetSelf(), command, origin);
} }
void Checkable::ExecuteEventHandler(void) void Checkable::ExecuteEventHandler(void)

View File

@ -98,7 +98,7 @@ public:
/* Checks */ /* Checks */
shared_ptr<CheckCommand> GetCheckCommand(void) const; shared_ptr<CheckCommand> GetCheckCommand(void) const;
void SetCheckCommand(const shared_ptr<CheckCommand>& command); void SetCheckCommand(const shared_ptr<CheckCommand>& command, const MessageOrigin& origin = MessageOrigin());
TimePeriod::Ptr GetCheckPeriod(void) const; TimePeriod::Ptr GetCheckPeriod(void) const;
void SetCheckPeriod(const TimePeriod::Ptr& tp); void SetCheckPeriod(const TimePeriod::Ptr& tp);
@ -157,6 +157,8 @@ public:
static boost::signals2::signal<void (const Checkable::Ptr&, bool, const MessageOrigin&)> OnEnableEventHandlerChanged; static boost::signals2::signal<void (const Checkable::Ptr&, bool, const MessageOrigin&)> OnEnableEventHandlerChanged;
static boost::signals2::signal<void (const Checkable::Ptr&, double, const MessageOrigin&)> OnCheckIntervalChanged; static boost::signals2::signal<void (const Checkable::Ptr&, double, const MessageOrigin&)> OnCheckIntervalChanged;
static boost::signals2::signal<void (const Checkable::Ptr&, double, const MessageOrigin&)> OnRetryIntervalChanged; static boost::signals2::signal<void (const Checkable::Ptr&, double, const MessageOrigin&)> OnRetryIntervalChanged;
static boost::signals2::signal<void (const Checkable::Ptr&, const shared_ptr<EventCommand>&, const MessageOrigin&)> OnEventCommandChanged;
static boost::signals2::signal<void (const Checkable::Ptr&, const shared_ptr<CheckCommand>&, const MessageOrigin&)> OnCheckCommandChanged;
static boost::signals2::signal<void (const Checkable::Ptr&, const CheckResult::Ptr&, const MessageOrigin&)> OnNewCheckResult; static boost::signals2::signal<void (const Checkable::Ptr&, const CheckResult::Ptr&, const MessageOrigin&)> OnNewCheckResult;
static boost::signals2::signal<void (const Checkable::Ptr&, const CheckResult::Ptr&, StateType, const MessageOrigin&)> OnStateChange; static boost::signals2::signal<void (const Checkable::Ptr&, const CheckResult::Ptr&, StateType, const MessageOrigin&)> OnStateChange;
@ -240,7 +242,7 @@ public:
void ExecuteEventHandler(void); void ExecuteEventHandler(void);
shared_ptr<EventCommand> GetEventCommand(void) const; shared_ptr<EventCommand> GetEventCommand(void) const;
void SetEventCommand(const shared_ptr<EventCommand>& command); void SetEventCommand(const shared_ptr<EventCommand>& command, const MessageOrigin& origin = MessageOrigin());
bool GetEnableEventHandler(void) const; bool GetEnableEventHandler(void) const;
void SetEnableEventHandler(bool enabled, const MessageOrigin& origin = MessageOrigin()); void SetEnableEventHandler(bool enabled, const MessageOrigin& origin = MessageOrigin());