2
* @file geis_subscription.h
3
* @brief internal Geis subscription modul private interface
5
* Copyright 2010, 2011 Canonical Ltd.
7
* This library is free software; you can redistribute it and/or modify it under
8
* the terms of the GNU Lesser General Public License as published by the Free
9
* Software Foundation; either version 3 of the License, or (at your option) any
12
* This library is distributed in the hope that it will be useful, but WITHOUT
13
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
14
* FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
17
* You should have received a copy of the GNU Lesser General Public License
18
* along with this program; if not, write to the Free Software Foundation, Inc.,
19
* 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
21
#ifndef GEIS_SUBSCRIPTION_H_
22
#define GEIS_SUBSCRIPTION_H_
24
#include <geis/geis.h>
25
#include "geis_filter.h"
29
* @defgroup geis_sub_container A Subscription Container
34
* A container for subscriptions.
36
typedef struct _GeisSubBag *GeisSubBag;
38
typedef GeisSubscription* GeisSubBagIterator;
41
* Creates a new Geis Subscription container.
43
* @param[in] hint A hint as to how many subscriptions to initially allocate in
46
GeisSubBag geis_subscription_bag_new(GeisSize size_hint);
49
* Destroys a Geis Subscription container.
51
* @param[in] bag The bag.
53
void geis_subscription_bag_delete(GeisSubBag bag);
56
* Tells how any entires in a Geis Subscription container.
58
* @param[in] bag The bag.
60
GeisSize geis_subscription_bag_count(GeisSubBag bag);
63
* Gets an iterator initialized to the first subscription held in a bag.
65
* @param[in] bag The bag.
67
GeisSubBagIterator geis_subscription_bag_begin(GeisSubBag bag);
70
* Increments the subscrition bag iterator.
72
* @param[in] bag The bag.
73
* @param[in] iter The iterator.
75
GeisSubBagIterator geis_subscription_bag_iterator_next(GeisSubBag bag,
76
GeisSubBagIterator iter);
79
* Gets an iterator indicating one-past-the-last sub in a bag.
81
* @param[in] bag The bag.
83
GeisSubBagIterator geis_subscription_bag_end(GeisSubBag bag);
86
* Creates a new subscription object in a subscription container.
88
* @param[in] bag The container.
89
* @param[in] sub The subscription to be added.
91
* @returns the index of the newly inserted subscription
93
GeisSize geis_subscription_bag_insert(GeisSubBag bag,
94
GeisSubscription sub);
97
* Removes a subscription from a subscription container.
99
* @param[in] bag The subscription container.
100
* @param[in] sub The subscription to be removed.
102
void geis_subscription_bag_remove(GeisSubBag bag,
103
GeisSubscription sub);
106
* Removes all subscriptions from a subscription container.
108
* @param[in] bag The subscription container.
110
void geis_subscription_bag_empty(GeisSubBag bag);
113
* Marks all subscriptions in a bag as invalid.
115
* @param[in] bag The subscription container.
117
* See geis_subscription_invalidate.
119
void geis_subscription_bag_invalidate(GeisSubBag bag);
122
* Looks for an subscription in an subscription container.
124
* @param[in] bag The bag.
126
GeisSubscription geis_subscription_bag_find(GeisSubBag bag, GeisInteger sub_id);
131
* Gets the numvber of filters in a subscirption.
133
* @param[in] sub The subscription.
135
GeisSize geis_subscription_filter_count(GeisSubscription sub);
138
* Gets an indicated filter from a subscription.
140
* @param[in] sub The subscription.
141
* @param[in] index Indicates which filter to retrieve.
143
GeisFilter geis_subscription_filter(GeisSubscription sub, GeisSize index);
146
* Gets an iterator initialized to the first filter on a subscription.
148
* @param[in] sub The subscription.
151
geis_subscription_filter_begin(GeisSubscription sub);
154
* Gets an iterator initialized to the one-past-the-last filter on a subscription.
156
* @param[in] sub The subscription.
159
geis_subscription_filter_end(GeisSubscription sub);
162
* Gets the next filter in sequence.
164
* @param[in] sub The subscription.
165
* @param[in] iter A filter iterator.
167
* @returns an interator initialized to the next filter in sequence in the
168
* subscription, or an iterator that is equal to geis_subscription_filter_end().
171
geis_subscription_filter_next(GeisSubscription sub, GeisFilterIterator iter);
174
* Invalidates a subscription.
176
* @param[in] sub The subscription.
178
* A subscription becomes invalid when its owning Geis instance has been
179
* destroyed but the GeisSubscription instance has not. This can occur because
180
* lifetime of both objects is under external control.
182
void geis_subscription_invalidate(GeisSubscription sub);
185
* Sets the operational flags for the subscription.
187
* @param[in] sub The subscription.
188
* @param[in] flags The subscription flags.
190
* Changes which flags are set during construction of the subscription instance.
191
* It is inappropriate to change the operational flags of an activated
194
* @retval GEIS_STATUS_SUCCESS Normal successful completion.
195
* @retval GEIS_STATUS_NOT_SUPPORTED Call made to an activated subcription.
197
GeisStatus geis_subscription_set_flags(GeisSubscription sub,
198
GeisSubscriptionFlags flags);
201
* Gets the operational flags for the subscription.
203
* @param[in] sub The subscription.
205
GeisSubscriptionFlags geis_subscription_flags(GeisSubscription sub);
208
* Gets an associated datum from the subscription.
210
* @param[in] sub The subscription.
212
GeisPointer geis_subscription_pdata(GeisSubscription subscription);
215
* Sets an associated datum on the subscription.
217
* @param[in] sub The subscription.
218
* @param[in] data Some data.
220
void geis_subscription_set_pdata(GeisSubscription subscription, GeisPointer data);
222
#endif /* GEIS_SUBSCRIPTION_H_ */