epoc32/include/sensrvchannelconditionset.h
author William Roberts <williamr@symbian.org>
Wed, 31 Mar 2010 12:33:34 +0100
branchSymbian3
changeset 4 837f303aceeb
parent 2 2fe1408b6811
permissions -rw-r--r--
Current Symbian^3 public API header files (from PDK 3.0.h)
This is the epoc32/include tree with the "platform" subtrees removed, and
all but a selected few mbg and rsg files removed.
     1 /*
     2 * Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). 
     3 * All rights reserved.
     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".
     8 *
     9 * Initial Contributors:
    10 * Nokia Corporation - initial contribution.
    11 *
    12 * Contributors:
    13 *
    14 * Description:  Channel condition set object
    15 *
    16 */
    17 
    18 
    19 #ifndef SENSRVCHANNELCONDITIONSET_H
    20 #define SENSRVCHANNELCONDITIONSET_H
    21 
    22 #include <e32base.h>
    23 #include <sensrvchannelcondition.h>
    24 
    25 // FORWARD DECLARATIONS
    26 
    27 class CSensrvChannelConditionSet;
    28 
    29 // DATA TYPES
    30 
    31 /**
    32 * RPointerArray based channel condition set list
    33 */
    34 typedef RPointerArray<CSensrvChannelConditionSet> RSensrvChannelConditionSetList;
    35 
    36 /**
    37 * Logical operator to be used in a condition set.
    38 * 
    39 * @see CSensrvChannelConditionSet
    40 */
    41 enum TSensrvConditionSetType
    42 {
    43     /** OR-operator for a channel condition set */
    44     ESensrvOrConditionSet = 0,
    45     /** AND-operator for a channel condtion set */
    46     ESensrvAndConditionSet 
    47 };
    48 
    49 
    50 /**
    51 * CSensrvChannelConditionSet represents a set of conditions. A condition set is a container for one
    52 * or more conditions.
    53 * 
    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.
    59 * 
    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.
    65 * 
    66 * The pair of conditions must both have the same index in the condition set and they are considered a
    67 * single channel condition.
    68 *
    69 * @see CSensrvChannelCondition
    70 * @lib sensrvutil.lib
    71 * @since S60 5.0
    72 */
    73 NONSHARABLE_CLASS( CSensrvChannelConditionSet ): public CBase
    74     {
    75 public:
    76     /**
    77     * Two-phase constructor
    78     * 
    79     * @since S60 5.0
    80     * @param  aConditionSetType Defines logical operator to be used for the condition set.
    81     * @return Pointer to created object
    82     * @leave  KErrNoMemory
    83     * @leave  One of the system-wide error codes  
    84     */  
    85     IMPORT_C static CSensrvChannelConditionSet* NewL
    86                 ( TSensrvConditionSetType aConditionSetType );
    87 
    88     /**
    89     * Two-phase constructor
    90     * 
    91     * @since S60 5.0
    92     * @param  aConditionSetType Defines logical operator to be used for the condition set.
    93     * @return Pointer to created object
    94     * @leave  KErrNoMemory
    95     * @leave  One of the system-wide error codes
    96     */  
    97     IMPORT_C static CSensrvChannelConditionSet* NewLC
    98                 ( TSensrvConditionSetType aConditionSetType );
    99     
   100 public:
   101   
   102     /**
   103     * Get condition set type.
   104     * 
   105     * @return Type of the condition set
   106     */    
   107     virtual TSensrvConditionSetType ConditionSetType() const = 0;
   108 
   109     /**
   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.
   113     * 
   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.  
   121     * 
   122     * Individual conditions do not need to have contiguous index values.  
   123     * 
   124     * @since S60 5.0
   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    
   131     */  
   132     virtual void AddChannelConditionL
   133             ( CSensrvChannelCondition* aChannelCondition ) = 0;
   134 
   135     /**
   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
   138     * were added.
   139     * 
   140     * @since S60 5.0
   141     * @return Reference to a list of condition pointers
   142     */
   143     virtual const RSensrvChannelConditionList& AllConditions() const = 0;
   144 
   145 public:
   146     /**
   147     * Default constructor. 
   148     */
   149     CSensrvChannelConditionSet();
   150     };
   151 
   152 
   153 #endif //SENSRVCHANNELCONDITIONSET_H
   154 
   155 // End of File
   156 
   157