![]() |
VR-Forces 4.0.4 Class Documentation
|
00001 /******************************************************************************* 00002 ** Copyright (c) 2010 MAK Technologies, Inc. 00003 ** All rights reserved. 00004 *******************************************************************************/ 00005 /******************************************************************************* 00006 ** $RCSfile: systemSwitcher.h,v $ $Revision: 1.1 $ $State: Exp $ 00007 ** Created: 4/29/10 MEM 00008 *******************************************************************************/ 00009 00014 00017 00018 #include "vrfobjcore/singleTaskControllerComponent.h" 00019 #include "vrfobjcore/simRadio.h" 00020 00021 class DtComponentSystem; 00022 class DtSwitchSystemComponentPSR; 00023 class DtSimComponentNetwork; 00024 00025 #include "vrfmodel/vrfmodelDefines.h" 00026 class DT_DLL_vrfmodel DtSystemSwitcherComponent : public DtControllerComponent 00027 { 00028 public: 00029 00031 DtSystemSwitcherComponent(const DtString & name, DtVrfObject* owner, 00032 DtSimManager * simManager, DtComponentDescriptor* desc = NULL, 00033 DtReaderWriterRegistry * parentRegistry = 0); 00034 00036 virtual ~DtSystemSwitcherComponent(); 00037 00039 virtual bool init(); 00040 00043 virtual DtString type() const; 00044 00045 virtual void tick(); 00046 00049 virtual void enable(); 00050 00053 virtual void disable(); 00054 00055 virtual bool transitionIsComplete() const; 00056 00057 virtual void onTransitionComplete(); 00058 00059 public: 00060 00061 static void setSwitchSystemsCallback(DtSimMessage * msg, void * usrData); 00062 00063 00065 static DtSimComponent* creator(const DtString & name, DtVrfObject* owner, 00066 DtSimManager * simManager, DtComponentDescriptor* desc, 00067 DtReaderWriterRegistry * parentRegistry); 00068 00069 protected: 00070 00072 DtSystemSwitcherComponent(const DtSystemSwitcherComponent& orig); 00073 00075 DtSystemSwitcherComponent& operator=(const DtSystemSwitcherComponent& orig); 00076 00078 virtual void setRadio(DtSimRadio * radio); 00079 00080 virtual bool createPSR(); 00081 00084 virtual void addSetDataCallbacks(); 00085 00088 void removeSetDataCallbacks(); 00089 00090 virtual void processSetSwitchSystems(DtSimMessage * msg); 00091 00094 virtual bool switchSystems(); 00095 00098 void enableComponentSystem(DtComponentSystem* activateSystem); 00099 void disableComponentSystem(DtComponentSystem* deactivateSystem); 00100 void enableSimComponent(DtSimComponent* simComponent); 00101 void disableSimComponent(DtSimComponent* simComponent); 00103 00106 virtual bool allowedToTransition() const; 00107 00108 protected: 00109 00110 DtSimComponentNetwork * myComponentNetwork; 00111 DtComponentSystem* mySystemToDeactivate; 00112 DtComponentSystem* mySystemToActivate; 00113 00114 DtSwitchSystemComponentPSR* myProcessState; 00115 00116 bool myFirstTick; 00117 bool mySwitchingSystems; 00118 }; 00119