First public contribution.
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".
8 // Initial Contributors:
9 // Nokia Corporation - initial contribution.
16 #ifndef __CSTATEMACHINE_H__
17 #define __CSTATEMACHINE_H__
22 // Forward declaration
26 Implements a generic state machine
28 class CStateMachine : public CBase
31 static CStateMachine* NewL();
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);
44 // Declared but not defined to disable copy and assignment
45 CStateMachine(const CStateMachine&);
46 CStateMachine& operator = (const CStateMachine&);
48 const TState* iCurrentState;
50 RPointerArray<const TState> allStates;
53 #endif // __CSTATEMACHINE_H__