OPAL (Object Oriented Parallel Accelerator Library)  2021.1.99
OPAL
Channel.h
Go to the documentation of this file.
1 #ifndef CLASSIC_Channel_HH
2 #define CLASSIC_Channel_HH
3 
4 // ------------------------------------------------------------------------
5 // $RCSfile: Channel.h,v $
6 // ------------------------------------------------------------------------
7 // $Revision: 1.1.1.1 $
8 // ------------------------------------------------------------------------
9 // Copyright: see Copyright.readme
10 // ------------------------------------------------------------------------
11 //
12 // Class: Channel
13 //
14 // ------------------------------------------------------------------------
15 // Class category: Channels
16 // ------------------------------------------------------------------------
17 //
18 // $Date: 2000/03/27 09:32:35 $
19 // $Author: fci $
20 //
21 // ------------------------------------------------------------------------
22 
23 #include "Channels/ConstChannel.h"
24 
25 
26 // Class Channel
27 // ------------------------------------------------------------------------
29 // Class Channel allows access to an arbitrary [b]double[/b] value.
30 
31 
32 class Channel: public ConstChannel {
33 
34 public:
35 
36  Channel();
37  virtual ~Channel();
38 
40  virtual Channel *clone() const = 0;
41 
43  double operator=(double value)
44  { set(value); return value; }
45 
47  double operator+=(double value)
48  { double temp; get(temp); temp += value; set(temp); return temp; }
49 
51  double operator-=(double value)
52  { double temp; get(temp); temp -= value; set(temp); return temp; }
53 
55  // If the channel can be written,
56  // store [b]value[/b] into it and return true,
57  // otherwise return false.
58  virtual bool set(double value) = 0;
59 
61  // Return true, if the channel can receive values.
62  virtual bool isSettable() const;
63 
64 private:
65 
66  // Not implemented.
67  Channel(const Channel &);
68  const Channel &operator=(const Channel &);
69 };
70 
71 #endif // CLASSIC_Channel_HH
Abstract interface for read/write access to variable.
Definition: Channel.h:32
virtual Channel * clone() const =0
Duplicate the channel.
double operator=(double value)
Assign [b]value[/b] to channel.
Definition: Channel.h:43
virtual ~Channel()
Definition: Channel.cpp:32
const Channel & operator=(const Channel &)
virtual bool set(double value)=0
Store [b]value[/b] into channel.
virtual bool isSettable() const
Test if settable.
Definition: Channel.cpp:36
double operator-=(double value)
Subtract and assign [b]value[/b] to channel.
Definition: Channel.h:51
Channel(const Channel &)
Channel()
Definition: Channel.cpp:27
double operator+=(double value)
Add and assign [b]value[/b] to channel.
Definition: Channel.h:47
Abstract interface for read-only access to variable.
Definition: ConstChannel.h:29
virtual bool get(double &value) const =0
Read channel.