VR-Forces 4.0.4 Class Documentation
examples/addCommModel/myCommsModel.h
Go to the documentation of this file.
00001 /*******************************************************************************
00002 ** Copyright (c) 2011 MAK Technologies, Inc.
00003 ** All rights reserved.
00004 *******************************************************************************/
00005 /*******************************************************************************
00006 ** $RCSfile: myCommsModel.h,v $ $Revision: 1.1 $ $State: Exp $
00007 ** Created: 9/16/11 MEM
00008 *******************************************************************************/
00009 
00010 //\file myCommsModel.h
00011 //\brief An implementation of DtCommModel that models a simple radio model,
00012 //\using signal interaction as the network transport type.
00013 //\Will check the range between the sender and receiver. If the power of the sender's 
00014 //\radio is too weak for the range then the receiver will not get the message.
00015 
00016 #pragma once
00017 
00018 #include "vrfobjcore/simpleRadioCommModel.h"
00019 
00020 const char MyCommModelType[] = "my-comm-model";
00021 
00022 class  MyCommModel : public DtSimpleRadioCommModel
00023 {
00024 private:
00025    //Not implemented.
00027    MyCommModel();
00028    MyCommModel(const MyCommModel& orig);
00029    MyCommModel& operator=(const MyCommModel& orig);
00031 
00032 protected:
00033    //Use the create() method instead of calling the constructor.
00034    MyCommModel(DtCommModelCreationParams& params);
00035    //Virtual init() called from the create() method.
00036    //Calls createTransporter() to set myTransporter.
00037    virtual bool init();
00038 
00039 public:
00040    //Static creator function that can be registered with factories.
00041    //Calls the constructor, and init() on the new instance before returning it.
00042    //The params passed in are those read in from the commModelParams.mtl file for your simulation
00043    //model set. If you'd like to add to these derive a new commModelDescriptor.
00044    static DtCommModel* create(DtCommModelCreationParams& params);
00045 
00046    virtual ~MyCommModel();
00047 
00048    //\return MyCommModelType.
00049    //Type strings for default commModel subclasses are defined in 
00050    //commModelTypes.h. Returns MyCommModelType.This is the string that is added to the commModelParams.mtl
00051    //configuration file for the simulation model set being used. Make sure the string returned here
00052    //matches what is in that file.
00053    virtual DtString type() const;
00054 
00055    //Overridden from base to set the ReadyToSend status of the radio to
00056    //true as soon as it registers. 
00057    virtual void registerRadio(DtVrfRadio* radio);
00058 
00059 protected:
00060 
00061    //Checks the connectivity of the radios for delivery of message.
00062    //\return True if the message is allowed to be delivered, or false
00063    //of the sender/receiver radios are not connected.
00064    //Results will vary, depending on the current connection mode specified
00065    //in the descriptor--default connection modes are "all"--you can send to any entity regardless of force,
00066    //"force"--you can send to anyone in your force type, or "aggregate"--you can only send to those in your 
00067    //same echelon, same aggregate.
00068    //For this example we will simply do a range check and see if the receiver is
00069    //within the power range of the sender's radio.
00070    virtual bool checkRadioConnectivity(DtVrfObject* sender, DtVrfObject* receiver);
00071 
00072 protected:
00073 
00074 };
00075 

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)