2 * Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
4 * This component and the accompanying materials are made available
5 * under the terms of "Eclipse Public License v1.0"
6 * which accompanies this distribution, and is available
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
9 * Initial Contributors:
10 * Nokia Corporation - initial contribution.
14 * Description: Channel condition set object
19 #ifndef SENSRVCHANNELCONDITIONSET_H
20 #define SENSRVCHANNELCONDITIONSET_H
23 #include <sensrvchannelcondition.h>
25 // FORWARD DECLARATIONS
27 class CSensrvChannelConditionSet;
32 * RPointerArray based channel condition set list
34 typedef RPointerArray<CSensrvChannelConditionSet> RSensrvChannelConditionSetList;
37 * Logical operator to be used in a condition set.
39 * @see CSensrvChannelConditionSet
41 enum TSensrvConditionSetType
43 /** OR-operator for a channel condition set */
44 ESensrvOrConditionSet = 0,
45 /** AND-operator for a channel condtion set */
46 ESensrvAndConditionSet
51 * CSensrvChannelConditionSet represents a set of conditions. A condition set is a container for one
54 * The data type of the value contained in each Condition, in a Condition Set, must have the same data type
55 * as the data for the channel to which it is added. By default this should be a packaged data object of
56 * the channel. See the channel specific headers in \epoc32\include\sensors\channels. If the channel type
57 * requires a different type of value, that must be indicated clearly in the channel specific header
58 * defining the channel.
60 * The channel condition set combines channel conditions with either an AND-operator or an OR-operator. In
61 * an AND-set, all conditions need to be met by single data item before a condition set is met. In an
62 * OR-set, a single condition in the set needs to be met before a condition set is met. Certain condition
63 * types (range conditions) require two condition objects (upper and lower limit) in a condition set for
64 * the set to be valid.
66 * The pair of conditions must both have the same index in the condition set and they are considered a
67 * single channel condition.
69 * @see CSensrvChannelCondition
73 NONSHARABLE_CLASS( CSensrvChannelConditionSet ): public CBase
77 * Two-phase constructor
80 * @param aConditionSetType Defines logical operator to be used for the condition set.
81 * @return Pointer to created object
83 * @leave One of the system-wide error codes
85 IMPORT_C static CSensrvChannelConditionSet* NewL
86 ( TSensrvConditionSetType aConditionSetType );
89 * Two-phase constructor
92 * @param aConditionSetType Defines logical operator to be used for the condition set.
93 * @return Pointer to created object
95 * @leave One of the system-wide error codes
97 IMPORT_C static CSensrvChannelConditionSet* NewLC
98 ( TSensrvConditionSetType aConditionSetType );
103 * Get condition set type.
105 * @return Type of the condition set
107 virtual TSensrvConditionSetType ConditionSetType() const = 0;
110 * Adds a channel condition to the condition set. Ownership of the CSensrvChannelCondition
111 * is transferred to the CSensrvChannelConditionSet. The channel condition is deleted when
112 * this condition set is destroyed.
114 * Single conditions added to the Condition Set using this operation must each have a
115 * different item index. Range conditions must have the same item index and they must also
116 * have complimentary parts. When the second part of a range condition is added, i.e. the
117 * condition has the same item index as a condition already in the set, it is checked to
118 * ensure it is the complimentary partner of the already added part. If it is not
119 * complimentary then the operation will leave with KErrArgument. The conditions at each
120 * different index whether single or range is considered an individua condition.
122 * Individual conditions do not need to have contiguous index values.
125 * @param aChannelCondition Channel condition to be added
126 * @leave KErrArgument If the condition is NULL, there is already a condition for the same index
127 * in this set and the new condition is not a complementary part of range condition for that
128 * existing condition.
129 * @leave One of the system-wide error codes
130 * @see CSensrvChannelCondition
132 virtual void AddChannelConditionL
133 ( CSensrvChannelCondition* aChannelCondition ) = 0;
136 * Get all channel conditions in this condition set. Conditions with the same index (range conditions)
137 * are always in sequential slots in the returned array. Otherwise, conditions are in the order they
141 * @return Reference to a list of condition pointers
143 virtual const RSensrvChannelConditionList& AllConditions() const = 0;
147 * Default constructor.
149 CSensrvChannelConditionSet();
153 #endif //SENSRVCHANNELCONDITIONSET_H