VR-Forces 4.0.4 Class Documentation
examples/radarWarnRx/simpleRadarWarnRx.h
Go to the documentation of this file.
00001 /*******************************************************************************
00002 ** Copyright (c) 2003 MAK Technologies, Inc.
00003 ** All rights reserved.
00004 *******************************************************************************/
00005 /*******************************************************************************
00006 ** $RCSfile: simpleRadarWarnRx.h,v $ $Revision: 1.9 $ $State: Exp $
00007 *******************************************************************************/
00008 
00009 #ifndef DtSimpleRadarWarningReceiver_H_
00010 #define DtSimpleRadarWarningReceiver_H_
00011 
00012 #include "vrfobjcore/simCmpnt.h"
00013 #include <vl/globalObjDes.h>
00014 
00015 //class DtSimpleRadarWarningReceiver:
00016 //
00017 //Instances of DtSimpleRadarWarningReceiver are an example of a simple radar
00018 //warning reciever.  For the purposes of example this receiver determines
00019 //that it has detected a remote radar if a given remote emitter system
00020 //is located within a given distance from the entity configured with the 
00021 //reciever.  The list of radar emitters sensed this tick is generated as 
00022 //output.
00023 
00024 class DtReflectedEmitterSystemList;
00025 class DtEntityListOutputPort;
00026 class DtRadarWarningReceiverDescriptor;
00027 
00028 class DtSimpleRadarWarningReceiver : public DtSimComponent
00029 {
00030 public:
00031    //constructor
00032    DtSimpleRadarWarningReceiver(const DtString & name, DtVrfObject* owner,
00033       DtSimManager * simManager, DtComponentDescriptor* desc = NULL,
00034       DtReaderWriterRegistry * parentRegistry = 0);
00035 
00036    //destructor
00037    virtual ~DtSimpleRadarWarningReceiver();
00038 
00039    //Calls createRelfectedEmitterList() and createEmitterListPort().
00040    virtual bool init();
00041 
00042    //Called by init().  Creates the VR-Link list of all reflected emitter
00043    //objects in the simulation.
00044    virtual bool createReflectedEmitterList();
00045 
00046    //This returns a string that uniquely identifies this type of component.
00047    //(must be unique with respect to the component types defined in compTypes.h
00048    //as well as any additional user-defined components).  Returns the string
00049    //"simple-radar-warning-receiver".
00050    virtual DtString type();
00051 
00052    //This is the entity we're detecting for.  We override because we
00053    //want to grab and cache the global object designator.
00054    virtual void setEntity(DtVrfObject * entity);
00055 
00056    //Detects emitters and places them on our port.
00057    virtual void tick();
00058 
00059    //Returns the list of emitters we've detected.
00060    virtual DtEntityListOutputPort* emitterListPort() const;
00061 
00062    //Returns a newly created instance of this class.  We need to provide
00063    //this function so that we can register this class with the component
00064    //factory.
00065    static DtSimComponent * creator(const DtString & name, DtVrfObject* owner,
00066       DtSimManager * simManager, DtComponentDescriptor* desc,
00067       DtReaderWriterRegistry * parentRegistry);
00068 
00069 protected:
00070    
00071    //Overridden to create myEmitterListPort
00072    virtual bool createPorts();
00073 
00074 protected:
00075    //Default constructor; should not be called.  Here because the compiler
00076    //will generate an unprotected one otherwise.
00077    DtSimpleRadarWarningReceiver();
00078 
00079    //copy constructor, not implemented
00080    DtSimpleRadarWarningReceiver(const DtSimpleRadarWarningReceiver& orig);
00081 
00082    //assignment operator, not implemented
00083    DtSimpleRadarWarningReceiver& operator=(
00084       const DtSimpleRadarWarningReceiver& orig);
00085 
00086 protected:
00087 
00088    //List of all remote emitter systems.
00089    DtReflectedEmitterSystemList* myReflectedEmitterList;
00090 
00091    //Port used to communicate the list of detected emitter systems to
00092    //other components.
00093    DtEntityListOutputPort* myEmitterListPort;
00094 
00095    //The id of the entity this receiver is mounted on.
00096    DtGlobalObjectDesignator myGlobalId;
00097 
00098    //Pointer to the descriptor that holds the initialization parameters for this component.
00099    //This pointer is const because all instances of this component share a single
00100    //descriptor instance, so they should not be writing data back to it.
00101    const DtRadarWarningReceiverDescriptor* myDescriptor;
00102 };
00103 
00104 #endif
00105 

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)