aboutsummaryrefslogtreecommitdiff
path: root/libcontextprovider/doc/html/class_context_provider_1_1_group.html
blob: ca7c43174919a249ce7fbebc58608767327651a0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head><meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
<title>libcontextprovider: ContextProvider::Group Class Reference</title>
<link href="tabs.css" rel="stylesheet" type="text/css">
<link href="doxygen.css" rel="stylesheet" type="text/css">
</head><body>
<!-- Generated by Doxygen 1.5.8 -->
<div class="navigation" id="top">
  <div class="tabs">
    <ul>
      <li><a href="index.html"><span>Main&nbsp;Page</span></a></li>
      <li><a href="pages.html"><span>Related&nbsp;Pages</span></a></li>
      <li><a href="namespaces.html"><span>Namespaces</span></a></li>
      <li class="current"><a href="annotated.html"><span>Classes</span></a></li>
      <li><a href="files.html"><span>Files</span></a></li>
    </ul>
  </div>
  <div class="tabs">
    <ul>
      <li><a href="annotated.html"><span>Class&nbsp;List</span></a></li>
      <li><a href="classes.html"><span>Class&nbsp;Index</span></a></li>
      <li><a href="hierarchy.html"><span>Class&nbsp;Hierarchy</span></a></li>
      <li><a href="functions.html"><span>Class&nbsp;Members</span></a></li>
    </ul>
  </div>
  <div class="navpath"><a class="el" href="namespace_context_provider.html">ContextProvider</a>::<a class="el" href="class_context_provider_1_1_group.html">Group</a>
  </div>
</div>
<div class="contents">
<h1>ContextProvider::Group Class Reference</h1><!-- doxytag: class="ContextProvider::Group" -->Groups the firstSubscriberAppeared and lastSubscriberDisappeared from multiple <a class="el" href="class_context_provider_1_1_property.html" title="A Property object represents a context property, i.e., a key-value pair.">Property</a> objects together.  
<a href="#_details">More...</a>
<p>
<code>#include &lt;<a class="el" href="group_8h-source.html">ContextProvider</a>&gt;</code>
<p>

<p>
<a href="class_context_provider_1_1_group-members.html">List of all members.</a><table border="0" cellpadding="0" cellspacing="0">
<tr><td></td></tr>
<tr><td colspan="2"><br><h2>Signals</h2></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_context_provider_1_1_group.html#b0c2fe89e51597d807597ef5b17b8d84">firstSubscriberAppeared</a> ()</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Emitted when the group of Context objects is subscribed to.  <a href="#b0c2fe89e51597d807597ef5b17b8d84"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_context_provider_1_1_group.html#494ce3334c4665e89ca651bd34fc7acb">lastSubscriberDisappeared</a> ()</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Emitted when the group of Context objects is unsubscribed from.  <a href="#494ce3334c4665e89ca651bd34fc7acb"></a><br></td></tr>
<tr><td colspan="2"><br><h2>Public Member Functions</h2></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_context_provider_1_1_group.html#dfdc508e85a6526c7e5201934b5ca9c5">Group</a> (QObject *parent=0)</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Contructs an empty <a class="el" href="class_context_provider_1_1_group.html" title="Groups the firstSubscriberAppeared and lastSubscriberDisappeared from multiple Property...">Group</a> object with the given parent.  <a href="#dfdc508e85a6526c7e5201934b5ca9c5"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_context_provider_1_1_group.html#66b1bd39a6d13e7623ea1213574a25f8">~Group</a> ()</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Destructor.  <a href="#66b1bd39a6d13e7623ea1213574a25f8"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_context_provider_1_1_group.html#a4996d5fbeb27344439a2485f0de87e4">add</a> (const <a class="el" href="class_context_provider_1_1_property.html">Property</a> &amp;prop)</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Adds a <a class="el" href="class_context_provider_1_1_property.html" title="A Property object represents a context property, i.e., a key-value pair.">Property</a> object to the <a class="el" href="class_context_provider_1_1_group.html" title="Groups the firstSubscriberAppeared and lastSubscriberDisappeared from multiple Property...">Group</a>.  <a href="#a4996d5fbeb27344439a2485f0de87e4"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">bool&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_context_provider_1_1_group.html#f6ebd9e89ea1f543d33867fad44ba15e">isSubscribedTo</a> () const </td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Returns true iff any <a class="el" href="class_context_provider_1_1_property.html" title="A Property object represents a context property, i.e., a key-value pair.">Property</a> objects in the group are subscribed to.  <a href="#f6ebd9e89ea1f543d33867fad44ba15e"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">QSet&lt; const <a class="el" href="class_context_provider_1_1_property.html">Property</a> * &gt;&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_context_provider_1_1_group.html#63bd74cceebb98ef6372b1040b971479">getProperties</a> ()</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Returns the set of properties currently belonging to the <a class="el" href="class_context_provider_1_1_group.html" title="Groups the firstSubscriberAppeared and lastSubscriberDisappeared from multiple Property...">Group</a>.  <a href="#63bd74cceebb98ef6372b1040b971479"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="el" href="class_context_provider_1_1_group.html">Group</a> &amp;&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_context_provider_1_1_group.html#076cdbd5346aecee1b944451e5d6a5b8">operator&lt;&lt;</a> (const <a class="el" href="class_context_provider_1_1_property.html">Property</a> &amp;prop)</td></tr>

<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="el" href="class_context_provider_1_1_group.html">Group</a> &amp;&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_context_provider_1_1_group.html#28743608278b85f0dc0170d2c5774e3e">operator&lt;&lt;</a> (const <a class="el" href="class_context_provider_1_1_property.html">Property</a> *prop)</td></tr>

</table>
<hr><a name="_details"></a><h2>Detailed Description</h2>
Groups the firstSubscriberAppeared and lastSubscriberDisappeared from multiple <a class="el" href="class_context_provider_1_1_property.html" title="A Property object represents a context property, i.e., a key-value pair.">Property</a> objects together. 
<p>
<a class="el" href="class_context_provider_1_1_group.html" title="Groups the firstSubscriberAppeared and lastSubscriberDisappeared from multiple Property...">Group</a> is useful in cases when multiple properties are provided by the same source, such as a hardware sensor. When any of these properties is subscribed to, the source needs to be turned on, and when none of these properties are subscribed to, the source needs to be turned off.<p>
For example, <div class="fragment"><pre class="fragment">    Property location(<span class="stringliteral">"Location"</span>);
    Property altitude(<span class="stringliteral">"Altitude"</span>);

    <a class="code" href="class_context_provider_1_1_group.html#dfdc508e85a6526c7e5201934b5ca9c5" title="Contructs an empty Group object with the given parent.">Group</a> gps;
    gps &lt;&lt; location &lt;&lt; altitude;

    connect(gps, SIGNAL(<a class="code" href="class_context_provider_1_1_group.html#b0c2fe89e51597d807597ef5b17b8d84" title="Emitted when the group of Context objects is subscribed to.">firstSubscriberAppeared</a>()), <span class="keyword">this</span>, SLOT(turnGpsOn()));
    connect(gps, SIGNAL(<a class="code" href="class_context_provider_1_1_group.html#494ce3334c4665e89ca651bd34fc7acb" title="Emitted when the group of Context objects is unsubscribed from.">lastSubscriberDisappeared</a>()), <span class="keyword">this</span>, SLOT(onGpsOff()));
</pre></div><p>
This way, the provider doesn't need to store the subscription statuses of the related keys.<p>
Initially, none of the <a class="el" href="class_context_provider_1_1_property.html" title="A Property object represents a context property, i.e., a key-value pair.">Property</a> objects related to a <a class="el" href="class_context_provider_1_1_group.html" title="Groups the firstSubscriberAppeared and lastSubscriberDisappeared from multiple Property...">Group</a> are subscribed to. When some of them are subscribed to, <a class="el" href="class_context_provider_1_1_group.html" title="Groups the firstSubscriberAppeared and lastSubscriberDisappeared from multiple Property...">Group</a> emits the firstSubscriberAppeared signal. When all of them are again unsubscribed, <a class="el" href="class_context_provider_1_1_group.html" title="Groups the firstSubscriberAppeared and lastSubscriberDisappeared from multiple Property...">Group</a> emits the lastSubscriberDisappeared signal. <hr><h2>Constructor &amp; Destructor Documentation</h2>
<a class="anchor" name="dfdc508e85a6526c7e5201934b5ca9c5"></a><!-- doxytag: member="ContextProvider::Group::Group" ref="dfdc508e85a6526c7e5201934b5ca9c5" args="(QObject *parent=0)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">ContextProvider::Group::Group           </td>
          <td>(</td>
          <td class="paramtype">QObject *&nbsp;</td>
          <td class="paramname"> <em>parent</em> = <code>0</code>          </td>
          <td>&nbsp;)&nbsp;</td>
          <td><code> [explicit]</code></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
Contructs an empty <a class="el" href="class_context_provider_1_1_group.html" title="Groups the firstSubscriberAppeared and lastSubscriberDisappeared from multiple Property...">Group</a> object with the given parent. 
<p>

</div>
</div><p>
<a class="anchor" name="66b1bd39a6d13e7623ea1213574a25f8"></a><!-- doxytag: member="ContextProvider::Group::~Group" ref="66b1bd39a6d13e7623ea1213574a25f8" args="()" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">ContextProvider::Group::~Group           </td>
          <td>(</td>
          <td class="paramname">          </td>
          <td>&nbsp;)&nbsp;</td>
          <td></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
Destructor. 
<p>

</div>
</div><p>
<hr><h2>Member Function Documentation</h2>
<a class="anchor" name="a4996d5fbeb27344439a2485f0de87e4"></a><!-- doxytag: member="ContextProvider::Group::add" ref="a4996d5fbeb27344439a2485f0de87e4" args="(const Property &amp;prop)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void ContextProvider::Group::add           </td>
          <td>(</td>
          <td class="paramtype">const <a class="el" href="class_context_provider_1_1_property.html">Property</a> &amp;&nbsp;</td>
          <td class="paramname"> <em>property</em>          </td>
          <td>&nbsp;)&nbsp;</td>
          <td></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
Adds a <a class="el" href="class_context_provider_1_1_property.html" title="A Property object represents a context property, i.e., a key-value pair.">Property</a> object to the <a class="el" href="class_context_provider_1_1_group.html" title="Groups the firstSubscriberAppeared and lastSubscriberDisappeared from multiple Property...">Group</a>. 
<p>
The <a class="el" href="class_context_provider_1_1_property.html" title="A Property object represents a context property, i.e., a key-value pair.">Property</a> object needs to exist as long as the <a class="el" href="class_context_provider_1_1_group.html" title="Groups the firstSubscriberAppeared and lastSubscriberDisappeared from multiple Property...">Group</a> object is in use. 
</div>
</div><p>
<a class="anchor" name="b0c2fe89e51597d807597ef5b17b8d84"></a><!-- doxytag: member="ContextProvider::Group::firstSubscriberAppeared" ref="b0c2fe89e51597d807597ef5b17b8d84" args="()" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void ContextProvider::Group::firstSubscriberAppeared           </td>
          <td>(</td>
          <td class="paramname">          </td>
          <td>&nbsp;)&nbsp;</td>
          <td><code> [signal]</code></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
Emitted when the group of Context objects is subscribed to. 
<p>
I.e., when none of them were subscribed to and now some of them were subscribed to. 
</div>
</div><p>
<a class="anchor" name="63bd74cceebb98ef6372b1040b971479"></a><!-- doxytag: member="ContextProvider::Group::getProperties" ref="63bd74cceebb98ef6372b1040b971479" args="()" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">QSet&lt; const <a class="el" href="class_context_provider_1_1_property.html">Property</a> * &gt; ContextProvider::Group::getProperties           </td>
          <td>(</td>
          <td class="paramname">          </td>
          <td>&nbsp;)&nbsp;</td>
          <td></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
Returns the set of properties currently belonging to the <a class="el" href="class_context_provider_1_1_group.html" title="Groups the firstSubscriberAppeared and lastSubscriberDisappeared from multiple Property...">Group</a>. 
<p>

</div>
</div><p>
<a class="anchor" name="f6ebd9e89ea1f543d33867fad44ba15e"></a><!-- doxytag: member="ContextProvider::Group::isSubscribedTo" ref="f6ebd9e89ea1f543d33867fad44ba15e" args="() const " -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">bool ContextProvider::Group::isSubscribedTo           </td>
          <td>(</td>
          <td class="paramname">          </td>
          <td>&nbsp;)&nbsp;</td>
          <td> const</td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
Returns true iff any <a class="el" href="class_context_provider_1_1_property.html" title="A Property object represents a context property, i.e., a key-value pair.">Property</a> objects in the group are subscribed to. 
<p>

</div>
</div><p>
<a class="anchor" name="494ce3334c4665e89ca651bd34fc7acb"></a><!-- doxytag: member="ContextProvider::Group::lastSubscriberDisappeared" ref="494ce3334c4665e89ca651bd34fc7acb" args="()" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void ContextProvider::Group::lastSubscriberDisappeared           </td>
          <td>(</td>
          <td class="paramname">          </td>
          <td>&nbsp;)&nbsp;</td>
          <td><code> [signal]</code></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
Emitted when the group of Context objects is unsubscribed from. 
<p>
I.e., when some of them were subscribed to and now all of them were unsubscribed from. 
</div>
</div><p>
<a class="anchor" name="28743608278b85f0dc0170d2c5774e3e"></a><!-- doxytag: member="ContextProvider::Group::operator&lt;&lt;" ref="28743608278b85f0dc0170d2c5774e3e" args="(const Property *prop)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="class_context_provider_1_1_group.html">Group</a>&amp; ContextProvider::Group::operator&lt;&lt;           </td>
          <td>(</td>
          <td class="paramtype">const <a class="el" href="class_context_provider_1_1_property.html">Property</a> *&nbsp;</td>
          <td class="paramname"> <em>prop</em>          </td>
          <td>&nbsp;)&nbsp;</td>
          <td><code> [inline]</code></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>

</div>
</div><p>
<a class="anchor" name="076cdbd5346aecee1b944451e5d6a5b8"></a><!-- doxytag: member="ContextProvider::Group::operator&lt;&lt;" ref="076cdbd5346aecee1b944451e5d6a5b8" args="(const Property &amp;prop)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="class_context_provider_1_1_group.html">Group</a>&amp; ContextProvider::Group::operator&lt;&lt;           </td>
          <td>(</td>
          <td class="paramtype">const <a class="el" href="class_context_provider_1_1_property.html">Property</a> &amp;&nbsp;</td>
          <td class="paramname"> <em>prop</em>          </td>
          <td>&nbsp;)&nbsp;</td>
          <td><code> [inline]</code></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>

</div>
</div><p>
<hr>The documentation for this class was generated from the following files:<ul>
<li><a class="el" href="group_8h-source.html">group.h</a><li><a class="el" href="group_8cpp.html">group.cpp</a></ul>
</div>
<hr size="1"><address style="text-align: right;"><small>Generated on Fri Oct 23 08:58:39 2009 for libcontextprovider by&nbsp;
<a href="http://www.doxygen.org/index.html">
<img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.5.8 </small></address>
</body>
</html>