sl@0: // Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies). sl@0: // All rights reserved. sl@0: // This component and the accompanying materials are made available sl@0: // under the terms of the License "Eclipse Public License v1.0" sl@0: // which accompanies this distribution, and is available sl@0: // at the URL "http://www.eclipse.org/legal/epl-v10.html". sl@0: // sl@0: // Initial Contributors: sl@0: // Nokia Corporation - initial contribution. sl@0: // sl@0: // Contributors: sl@0: // sl@0: // Description: sl@0: // sl@0: sl@0: #ifndef __CSTATEMACHINE_H__ sl@0: #define __CSTATEMACHINE_H__ sl@0: sl@0: #include sl@0: #include sl@0: sl@0: // Forward declaration sl@0: class TState; sl@0: sl@0: /** sl@0: Implements a generic state machine sl@0: */ sl@0: class CStateMachine : public CBase sl@0: { sl@0: public: sl@0: static CStateMachine* NewL(); sl@0: ~CStateMachine(); sl@0: void MoveTo(int aState); sl@0: const TState* AddState(int aState); sl@0: const TState* FindState(int aStateId) const; sl@0: void SetInitState(int aState); sl@0: TInt CurrentStateId() const; sl@0: TInt FromStateId() const; sl@0: void SetFromStateId(TInt aStateId); sl@0: sl@0: private: sl@0: CStateMachine(); sl@0: sl@0: // Declared but not defined to disable copy and assignment sl@0: CStateMachine(const CStateMachine&); sl@0: CStateMachine& operator = (const CStateMachine&); sl@0: sl@0: const TState* iCurrentState; sl@0: TInt iFromStateId; sl@0: RPointerArray allStates; sl@0: }; sl@0: sl@0: #endif // __CSTATEMACHINE_H__ sl@0: