ArnLib  4.0.x
Active Registry Network
ArnItemValve.hpp
Go to the documentation of this file.
1 // Copyright (C) 2010-2022 Michael Wiklund.
2 // All rights reserved.
3 // Contact: arnlib@wiklunden.se
4 //
5 // This file is part of the ArnLib - Active Registry Network.
6 // Parts of ArnLib depend on Qt and/or other libraries that have their own
7 // licenses. Usage of these other libraries is subject to their respective
8 // license agreements.
9 //
10 // GNU Lesser General Public License Usage
11 // This file may be used under the terms of the GNU Lesser General Public
12 // License version 2.1 as published by the Free Software Foundation and
13 // appearing in the file LICENSE_LGPL.txt included in the packaging of this
14 // file. In addition, as a special exception, you may use the rights described
15 // in the Nokia Qt LGPL Exception version 1.1, included in the file
16 // LGPL_EXCEPTION.txt in this package.
17 //
18 // GNU General Public License Usage
19 // Alternatively, this file may be used under the terms of the GNU General Public
20 // License version 3.0 as published by the Free Software Foundation and appearing
21 // in the file LICENSE_GPL.txt included in the packaging of this file.
22 //
23 // Other Usage
24 // Alternatively, this file may be used in accordance with the terms and conditions
25 // contained in a signed written agreement between you and Michael Wiklund.
26 //
27 // This program is distributed in the hope that it will be useful, but WITHOUT ANY
28 // WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
29 // PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
30 //
31 
32 #ifndef ARNITEMVALVE_HPP
33 #define ARNITEMVALVE_HPP
34 
35 #include "ArnLib_global.hpp"
36 #include "ArnItemB.hpp"
37 
38 class ArnItemValvePrivate;
39 
40 
42 
78 {
79  Q_OBJECT
80  Q_DECLARE_PRIVATE(ArnItemValve)
81 
82 public:
83  struct SwitchMode {
84  enum E {
86  InStream = 0x01,
88  OutStream = 0x02,
90  InOutStream = InStream | OutStream
91  };
93  };
94 
95  explicit ArnItemValve( QObject* parent = arnNullptr);
96 
97  bool setTarget( ArnItemB* targetItem, SwitchMode mode = SwitchMode::InOutStream);
98 
99  SwitchMode switchMode() const;
100 
102 
108  {ArnItemB::setSaveMode(); return *this;}
109 
115  bool isSaveMode() const
116  {return ArnItemB::isSaveMode();}
117 
119 
124  {ArnItemB::setMaster(); return *this;}
125 
130  bool isMaster() const
131  {return ArnItemB::isMaster();}
132 
134 
138  {ArnItemB::setAutoDestroy(); return *this;}
139 
143  bool isAutoDestroy() const
144  {return ArnItemB::isAutoDestroy();}
145 
148  bool toBool() const;
149 
150  ArnItemValve& operator=( bool value);
151 
152 
153 public slots:
155 
157  void setValue( bool value);
158 
159 signals:
162  void changed( int value);
163 
165 protected:
166  virtual void itemUpdated( const ArnLinkHandle& handleData, const QByteArray* value = arnNullptr);
167 
168  ArnItemValve( ArnItemValvePrivate& dd, QObject* parent);
170 
171 private:
172  void doControl();
173 };
174 
176 
177 #endif // ARNITEMVALVE_HPP
ArnItemValve & setAutoDestroy()
Set client session sync mode as AutoDestroy for this ArnItem.
bool isSaveMode() const
void setValue(const ArnBasicItem &other, int ignoreSame=Arn::SameValue::DefaultAction)
bool isMaster() const
Valve for controlling stream to/from an ArnItemB.
bool toBool(bool *isOk=arnNullptr) const
ArnBasicItem & setSaveMode()
Set general mode as Save for this Arn Data Object
ArnItemValve & setSaveMode()
Set general mode as Save for this Arn Data Object
ArnItemValve & setMaster()
Set client session sync mode as Master for this ArnItem.
#define MQ_DECLARE_FLAGS(FEStruct)
Flags.
Definition: MQFlagsBase.hpp:49
bool isMaster() const
#define MQ_DECLARE_OPERATORS_FOR_FLAGS(FEStruct)
Definition: MQFlagsBase.hpp:65
bool isAutoDestroy() const
Base class handle for an Arn Data Object.
Definition: ArnItemB.hpp:59
ArnBasicItem & setAutoDestroy()
Set client session sync mode as AutoDestroy for this ArnItem.
bool isAutoDestroy() const
bool isSaveMode() const
#define ARNLIBSHARED_EXPORT
ArnBasicItem & setMaster()
Set client session sync mode as Master for this ArnItem.
ArnBasicItem & operator=(const ArnBasicItem &other)