libraries / Mitov / Mitov_BasicDisplay.hon commit Added link to project report (97a3ba0)
   1////////////////////////////////////////////////////////////////////////////////
   2//                                                                            //
   3//     This software is supplied under the terms of a license agreement or    //
   4//     nondisclosure agreement with Mitov Software and may not be copied      //
   5//     or disclosed except in accordance with the terms of that agreement.    //
   6//         Copyright(c) 2002-2016 Mitov Software. All Rights Reserved.        //
   7//                                                                            //
   8////////////////////////////////////////////////////////////////////////////////
   9
  10#ifndef _MITOV_BASIC_DISPLAY_h
  11#define _MITOV_BASIC_DISPLAY_h
  12
  13#include <Mitov.h>
  14
  15namespace Mitov
  16{
  17        template<typename T> class BasicDisplay : public Mitov::CommonSink
  18        {
  19                typedef OpenWire::Component     inherited;
  20
  21        protected:
  22                T               FValue;
  23
  24        public:
  25                bool    Enabled = true;
  26                T               InitialValue = 0;
  27
  28        protected:
  29                virtual void UpdateDisplay() = 0;
  30
  31        protected:
  32                virtual void DoReceive( void *_Data )
  33                {
  34                        FValue = *(T*)_Data;
  35                }
  36
  37        public:
  38                void SetEnabled( bool AValue )
  39                {
  40                        if( Enabled == AValue )
  41                                return;
  42
  43                        Enabled = AValue;
  44                        UpdateDisplay();
  45                }
  46
  47                void SetInitialValue( T AValue )
  48                {
  49                        if( InitialValue == AValue )
  50                                return;
  51
  52                        InitialValue = AValue;
  53                        UpdateDisplay();
  54                }
  55
  56        protected:
  57                virtual void SystemInit()
  58                {
  59                        FValue = InitialValue;
  60                        inherited::SystemInit();
  61                        UpdateDisplay();
  62                }
  63
  64        };
  65//---------------------------------------------------------------------------
  66}
  67
  68#endif