rllib  1
rlplc.h
Go to the documentation of this file.
00001 /***************************************************************************
00002                           rlplc.h  -  description
00003                              -------------------
00004     begin                : Tue Dec 11 2008
00005     copyright            : (C) 2008 by Rainer Lehrig
00006     email                : lehrig@t-online.de
00007  ***************************************************************************/
00008 
00009 /***************************************************************************
00010  *                                                                         *
00011  *   This library is free software; you can redistribute it and/or modify  *
00012  *   it under the terms of the GNU LESSER GENERAL PUBLIC LICENSE as        *
00013  *   published by the Free Software Foundation                             *
00014  *                                                                         *
00015  ***************************************************************************/
00016 #ifndef _RL_PLC_H_
00017 #define _RL_PLC_H_
00018 
00019 #include "rldefine.h"
00020 
00021 class rlPlcState
00022 {
00023   public:
00024     rlPlcState(int numInt=100, int numFloat=100, int numDouble=0);
00025     virtual ~rlPlcState();
00026     int    *i, *i_old;
00027     float  *f, *f_old;
00028     double *d, *d_old;
00029     void   rememberState();
00030     int    intChanged(int index);
00031     int    floatChanged(int index);
00032     int    doubleChanged(int index);
00033     int    intHasIncreased(int index);
00034     int    floatHasIncreased(int index);
00035     int    doubleHasIncreased(int index);
00036     int    intHasDecreased(int index);
00037     int    floatHasDecreased(int index);
00038     int    doubleHasDecreased(int index);
00039     int    deltaInt(int index);
00040     float  deltaFloat(int index);
00041     double deltaDouble(int index);
00042     void   set(int index, int bit);
00043     void   clear(int index, int bit);
00044     int    isSet(int index, int bit);
00045     int    isClear(int index, int bit);
00046     int    hasBeenSet(int index, int bit);
00047     int    hasBeenCleared(int index, int bit);
00048     int    maxInt();
00049     int    maxFloat();
00050     int    maxDouble();
00051 
00052   private:
00053     int max_int, max_float, max_double;
00054 };
00055 
00056 class rlPlcMem
00057 {
00058   public:
00059     rlPlcMem();
00060     virtual ~rlPlcMem();
00061     int    i, i_old;
00062     float  f, f_old;
00063     double d, d_old;
00064     void   rememberState();
00065     int    intChanged();
00066     int    floatChanged();
00067     int    doubleChanged();
00068     int    intHasIncreased();
00069     int    floatHasIncreased();
00070     int    doubleHasIncreased();
00071     int    intHasDecreased();
00072     int    floatHasDecreased();
00073     int    doubleHasDecreased();
00074     int    deltaInt();
00075     float  deltaFloat();
00076     double deltaDouble();
00077     void   set(int bit);
00078     void   clear(int bit);
00079     int    isSet(int bit);
00080     int    isClear(int bit);
00081     int    hasBeenSet(int bit);
00082     int    hasBeenCleared(int bit);
00083 };
00084 
00085 #endif
00086