VR-Forces 4.0.4 Class Documentation
include/vrfmodel/pathMoveController.h
Go to the documentation of this file.
00001 /*******************************************************************************
00002 ** Copyright (c) 2004 MAK Technologies, Inc.
00003 ** All rights reserved.
00004 *******************************************************************************/
00005 /*******************************************************************************
00006 ** $RCSfile: pathMoveController.h,v $ $Revision: 1.21 $ $State: Exp $
00007 *******************************************************************************/
00008 
00011 
00014 
00015 
00016 #ifndef pathMoveController_H_
00017 #define pathMoveController_H_
00018 
00019 #include "vrfobjcore/singleTaskControllerComponent.h"
00020 #include <matrix/vlVector.h>
00021 #ifdef WIN32
00022 #include "winsock2.h"
00023 #include "windows.h"
00024 #else
00025 #include <pthread.h>
00026 #endif
00027 
00028 class DtPathPlanner;
00029 class DtPathMetric;
00030 class DtPathMovementControllerPSR;
00031 class DtPathMovementControllerDescriptor;
00032 
00062 #include "vrfmodel/vrfmodelDefines.h"
00063 class DT_DLL_vrfmodel DtPathMovementController : public DtSingleTaskControllerComponent
00064 {
00065 private:
00067    DtPathMovementController();
00069    DtPathMovementController(const DtPathMovementController& orig);
00071    DtPathMovementController& operator=(const DtPathMovementController& orig);
00072 
00073 public:
00074 
00077    DtPathMovementController(const DtString& name, 
00078       DtVrfObject* owner,
00079       DtSimManager* simManager, 
00080       DtComponentDescriptor* desc = NULL,
00081       DtReaderWriterRegistry* parentRegistry = NULL);
00082 
00083    virtual ~DtPathMovementController();
00084 
00086    virtual bool init();
00087 
00093    virtual bool createPSR();
00094 
00097    virtual DtString type() const;
00098 
00100    virtual void registerTaskMsgCallbacks();
00101 
00102    static void plannedMoveToCallback(DtSimMessage * msg, void * usr);
00103 
00104    virtual void processPlannedMoveToTask(DtSimMessage * msg);
00105 
00106    static void taskCompleteReportCallback(DtSimMessage* msg, void* usr);
00107 
00108    virtual void processTaskCompleteReport(DtSimMessage* msg);
00109 
00110    static void destinationChangedCallback(DtVrfObject* obj, void* usrData);
00111 
00116    virtual void processDestinationChanged();
00117 
00120 
00121    static void objectAboutToBeRemovedCallback(DtVrfObject* obj, void* usr);
00122    virtual void processObjectAboutToBeRemoved(DtVrfObject* obj);
00124 
00126    static void setLocationCallback(DtSimMessage* msg, void* usr);
00127 
00132    virtual void processSetLocation(DtSimMessage* msg);
00133 
00135    virtual void tick();
00136 
00137 protected:
00140    virtual void startPlannedMoveTo(const DtString& objectName);
00141 
00144    virtual void startPlannedMoveTo(const DtVector& localDestination);
00145 
00149    virtual void registerDestinationChangedCallback();
00150 
00153    virtual void unregisterDestinationChangedCallback();
00154 
00157    void abort();
00158 
00161    virtual bool pathDone();
00162 
00165    virtual DtVrfObject* publishPath();
00166 
00169    virtual void removePublishedPath();
00170 
00172    virtual bool makePath(const DtVector& start, const DtVector& end);
00173 
00177    virtual void clearTask();
00178 
00181    static void* staticThreadMain(void* data);
00182 
00184    virtual void threadMain();
00185 
00187    virtual DtPathMetric* createPathMetric();
00188 
00189 public:
00190 
00194    static DtSimComponent * creator(const DtString& name, 
00195       DtVrfObject* owner,
00196       DtSimManager* simManager, 
00197       DtComponentDescriptor* desc = 0,
00198       DtReaderWriterRegistry* parentRegistry = 0);
00199 
00200 protected:
00201    DtPathPlanner* myPathPlanner;
00202 
00205    DtPathMovementControllerPSR* myProcessState;
00206 
00207    const DtPathMovementControllerDescriptor* myPathDescriptor;
00208    bool myDestinationChangedCallbackRegistered; 
00209    bool myDone;
00211    volatile bool myProcessing;
00212 #ifdef WIN32
00213    HANDLE myThread;
00214 #else
00215    pthread_t myThread;
00216 #endif
00217    DtVector myStartPoint;
00218    DtVector myEndPoint;
00219    DtPathMetric* myPathMetric;
00220 
00222    double myLastMessageTime;
00223    double myTotalElapsedTime;
00224 };
00225 
00226 #endif

Document ID: Generated on Fri Jun 29 16:33:32 EDT 2012 from SVN revision 116588
Copyright © 2005-2012 VT MÄK Inc. All Rights Reserved (www.mak.com)