ArnLib  4.0.x
Active Registry Network
ArnDepend.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 ARNDEPEND_HPP
33 #define ARNDEPEND_HPP
34 
35 #include "ArnLib_global.hpp"
36 #include "ArnError.hpp"
37 #include <QString>
38 #include <QObject>
39 
40 class ArnDependOfferPrivate;
41 class ArnDependPrivate;
42 struct ArnDependSlot;
43 
45 
59 class ARNLIBSHARED_EXPORT ArnDependOffer : public QObject
60 {
61  Q_OBJECT
62  Q_DECLARE_PRIVATE(ArnDependOffer)
63 
64 public:
65  explicit ArnDependOffer( QObject* parent = arnNullptr);
66  ~ArnDependOffer();
67 
69 
71  void advertise( const QString& serviceName);
72 
74 
77  void setStateName( const QString& name);
78 
82  QString stateName() const;
83 
85 
88  void setStateId( int id);
89 
93  int stateId() const;
94 
96 protected:
97  ArnDependOffer( ArnDependOfferPrivate& dd, QObject* parent);
98  ArnDependOfferPrivate* const d_ptr;
100 
101 private slots:
102  void requestReceived( QByteArray req);
103 
104 private:
105 };
106 
107 
109 
132 class ARNLIBSHARED_EXPORT ArnDepend : public QObject
133 {
134  Q_OBJECT
135  Q_DECLARE_PRIVATE(ArnDepend)
136 
137 public:
138  typedef ArnDependSlot DepSlot;
139 
140  explicit ArnDepend( QObject* parent = arnNullptr);
141  ~ArnDepend();
142 
144 
147  void add( const QString& serviceName, int stateId = -1);
148 
150 
153  void add( const QString& serviceName, const QString& stateName);
154 
156 
158  void setMonitorName( const QString& name);
159 
161  void startMonitor();
162 
163 signals:
165  void completed();
166 
168 protected:
169  ArnDepend( ArnDependPrivate& dd, QObject* parent);
170  ArnDependPrivate* const d_ptr;
172 
173 private slots:
174  void echoRefresh();
175  void echoCheck( const QByteArray& echo, DepSlot* slot = arnNullptr);
176  void stateCheck( DepSlot* slot = arnNullptr);
177  void deleteSlot( void* slot = arnNullptr);
178 
179 private:
180  void init();
181  DepSlot* setupDepSlot( const QString& name);
182  void doDepOk( DepSlot* slot);
183 };
184 
185 #endif // ARNDEPEND_HPP
Class for advertising that a service is available.
Definition: ArnDepend.hpp:59
Class for setting up dependencis to needed services.
Definition: ArnDepend.hpp:132
ArnDependSlot DepSlot
Definition: ArnDepend.hpp:138
#define ARNLIBSHARED_EXPORT