kerneltest/f32test/smassstorage/inc/cstatemachine.h
changeset 0 a41df078684a
equal deleted inserted replaced
-1:000000000000 0:a41df078684a
       
     1 // Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     2 // All rights reserved.
       
     3 // This component and the accompanying materials are made available
       
     4 // under the terms of the License "Eclipse Public License v1.0"
       
     5 // which accompanies this distribution, and is available
       
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     7 //
       
     8 // Initial Contributors:
       
     9 // Nokia Corporation - initial contribution.
       
    10 //
       
    11 // Contributors:
       
    12 //
       
    13 // Description:
       
    14 //
       
    15 
       
    16 #ifndef __CSTATEMACHINE_H__
       
    17 #define __CSTATEMACHINE_H__
       
    18 
       
    19 #include <e32base.h>
       
    20 #include <e32cmn.h>
       
    21 
       
    22 // Forward declaration
       
    23 class TState;
       
    24 
       
    25 /**
       
    26  Implements a generic state machine
       
    27  */
       
    28 class CStateMachine : public CBase
       
    29 {
       
    30 public:
       
    31     static CStateMachine* NewL(); 
       
    32     ~CStateMachine();
       
    33     void MoveTo(int aState);
       
    34     const TState* AddState(int aState);
       
    35     const TState* FindState(int aStateId) const;
       
    36     void SetInitState(int aState);
       
    37     TInt CurrentStateId() const; 
       
    38     TInt FromStateId() const;
       
    39     void SetFromStateId(TInt aStateId);
       
    40     
       
    41 private:
       
    42     CStateMachine();
       
    43 
       
    44     // Declared but not defined to disable copy and assignment
       
    45     CStateMachine(const CStateMachine&);
       
    46     CStateMachine& operator = (const CStateMachine&);
       
    47     
       
    48     const TState* iCurrentState;
       
    49     TInt iFromStateId;
       
    50     RPointerArray<const TState> allStates;
       
    51 };
       
    52 
       
    53 #endif // __CSTATEMACHINE_H__
       
    54