tbf/TBF/Rig/IOperation.cs

45 lines
1.7 KiB
C#

///
/// Copyright (c) 2013-2015 Sensus Slovensko a.s.
///
using System;
namespace TBF.Rig
{
/// <summary>
/// This interface has to be implemented by each 'operation'. 'operations' are classes
/// in TBF.Rig name space with a class name ending with 'Op' (e.g. TimerOp).
/// This class name rule is a convention, not a requirement.
/// </summary>
public interface IOperation
{
/// <summary>
/// Method is called when a state machine enters a state in which this operation
/// takes place/ will be executed.
/// Method is not called when this operation took place also in the previous state.
/// StateMachine checks whether Start() should be called depending on the previous
/// and the current state.
/// </summary>
/// <returns>true on success</returns>
void Start();
/// <summary>
/// Method is called in regular time intervals when state machine is
/// in a state in which this operation takes place.
/// During operation the IOparation derived object may issue events,
/// that means Run() method returns a value different from Event.Void (=0).
/// Examples: Timer expired
/// </summary>
/// <returns></returns>
Event Run();
/// <summary>
/// Method is called when the state machine leaves a state in which
/// this operation takes place / was executed.
/// Method is not called when this operation takes place also in the next state.
/// StateMachine checks whether Start() should be called depending on the previous
/// and the current state.
/// </summary>
void Stop();
}
}