rllib  1
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros
rlplc.h
Go to the documentation of this file.
1 /***************************************************************************
2  rlplc.h - description
3  -------------------
4  begin : Tue Dec 11 2008
5  copyright : (C) 2008 by R. Lehrig
6  email : lehrig@t-online.de
7  ***************************************************************************/
8 
9 /***************************************************************************
10  * *
11  * This library is free software; you can redistribute it and/or modify *
12  * it under the terms of the GNU LESSER GENERAL PUBLIC LICENSE as *
13  * published by the Free Software Foundation *
14  * *
15  ***************************************************************************/
16 #ifndef _RL_PLC_H_
17 #define _RL_PLC_H_
18 
19 #include "rldefine.h"
20 #include "rlsharedmemory.h"
21 
23 {
24  public:
25  rlPlcState(int numInt=100, int numFloat=100, int numDouble=0, const char *shared_memory=NULL);
26  virtual ~rlPlcState();
27  int *i, *i_old;
28  float *f, *f_old;
29  double *d, *d_old;
30  void clear();
31  void rememberState();
32  int intChanged(int index);
33  int floatChanged(int index);
34  int doubleChanged(int index);
35  int intHasIncreased(int index);
36  int floatHasIncreased(int index);
37  int doubleHasIncreased(int index);
38  int intHasDecreased(int index);
39  int floatHasDecreased(int index);
40  int doubleHasDecreased(int index);
41  int deltaInt(int index);
42  float deltaFloat(int index);
43  double deltaDouble(int index);
44  void set(int index, int bit);
45  void clear(int index, int bit);
46  int isSet(int index, int bit);
47  int isClear(int index, int bit);
48  int hasBeenSet(int index, int bit);
49  int hasBeenCleared(int index, int bit);
50  int maxInt();
51  int maxFloat();
52  int maxDouble();
54 
55  private:
57 };
58 
59 class rlPlcMem
60 {
61  public:
62  rlPlcMem();
63  virtual ~rlPlcMem();
64  int i, i_old;
65  float f, f_old;
66  double d, d_old;
67  void rememberState();
68  int intChanged();
69  int floatChanged();
70  int doubleChanged();
71  int intHasIncreased();
72  int floatHasIncreased();
73  int doubleHasIncreased();
74  int intHasDecreased();
75  int floatHasDecreased();
76  int doubleHasDecreased();
77  int deltaInt();
78  float deltaFloat();
79  double deltaDouble();
80  void set(int bit);
81  void clear(int bit);
82  int isSet(int bit);
83  int isClear(int bit);
84  int hasBeenSet(int bit);
85  int hasBeenCleared(int bit);
86 };
87 
88 #endif
89