#ifndef BLUECORE_ACTIVATED_H
#define BLUECORE_ACTIVATED_H

namespace BlueCore
{
class Activated
{
  private:

    bool _Active;

  public:

    /**
     * Default constructor.
     * inital state is active
     */
    inline Activated()
    {
      _Active = true;
    }

    /**
     * Constructor.
     * @param set inital state
     */
    inline Activated(bool state) :
      _Active(state )
    {
    }

    /**
     * Destructor.
     */
    virtual inline ~Activated()
    {
    }

    /**
     * Activate the object.
     */
    inline void activate()
    {
      _Active = true;
      onActivation();
    }

    virtual void onActivation()
    {
    }

    /**
     * Deactivate the object.
     */
    inline void deactivate()
    {
      _Active = false;
      onDeactivation();
    }

    virtual void onDeactivation()
    {
    }

    /**
     * toggles the object's state
     */
    inline void toggleActive()
    {
      if (_Active )
        deactivate();
      else
        activate();
    }

    /**
     * returns the object's state
     */
    inline bool isActive()
    {
      return _Active;
    }
};

} // namespace BlueCore

#endif // BLUECORE_ACTIVATED_H
