camerauis/cameraxui/cxengine/inc/cxestate.h
branchRCL_3
changeset 24 bac7acad7cb3
parent 23 61bc0f252b2b
child 25 2c87b2808fd7
equal deleted inserted replaced
23:61bc0f252b2b 24:bac7acad7cb3
     1 /*
       
     2 * Copyright (c) 2009 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:
       
    15 *
       
    16 */
       
    17 
       
    18 #ifndef CXESTATE_H
       
    19 #define CXESTATE_H
       
    20 
       
    21 #include <QString>
       
    22 
       
    23 /**
       
    24 * CxeState represents one unique state in a finite state machine.
       
    25 * @sa CxeStateMachine
       
    26 */
       
    27 class CxeState
       
    28 {
       
    29 public:
       
    30     /**
       
    31      * Constructor.
       
    32      *
       
    33      * @param stateId            Integer ID for this state. Note that this must be unique
       
    34      *                           and a power of two. This is needed so we can combine
       
    35      *                           state IDs using bitwise or.
       
    36      * @param stateName          Name for this state (used for debug prints)
       
    37      * @param allowedNextStates  Bitmask of allowed next states.
       
    38      */
       
    39     CxeState(int stateId, const char* stateName, int allowedNextStates);
       
    40 
       
    41     virtual ~CxeState();
       
    42 
       
    43     /**
       
    44      * Get the state ID of the state.
       
    45      * @return State ID
       
    46      */
       
    47     int stateId() const;
       
    48 
       
    49     /**
       
    50      * Get the allowed state transitions
       
    51      * @return A bitmask of state IDs which are considered valid next states after this state.
       
    52      */
       
    53     int allowedNextStates() const;
       
    54 
       
    55     /**
       
    56      * Get the name of this state
       
    57      * @return Name of this state.
       
    58      */
       
    59     QString name() const;
       
    60 
       
    61 private:
       
    62     //! State name (for debug prints)
       
    63     QString mName;
       
    64 
       
    65     //! ID of this state
       
    66     int mId;
       
    67 
       
    68     //! Bitmask of allowed states
       
    69     int mAllowedNextStates;
       
    70 };
       
    71 
       
    72 #endif // CXESTATE_H