VR-Link API Documentation for HLA Evolved
hServReqInter.h
Go to the documentation of this file.
00001 /*********************************************************************
00002 ** Copyright (c) 1992-2010 VT MAK
00003 ** All rights reserved.
00004 *********************************************************************/
00005 
00006 
00007 #ifndef hServReqInter_H_
00008 #define hServReqInter_H_
00009 
00010 #if DtHLA
00011 
00012 #include "hIntWEncDec.h"
00013 #include "hostStructs.h"
00014 #include <matrix/vlMath.h>
00015 
00016 
00017 #include "packets/logisticsP.h"
00018 
00022 
00023 #define DtSUPPLY_VALID 1
00024 #define DtSUPPLY_BAD_INDEX 0
00025 
00026 class DT_DLL_VL DtServiceRequestInteraction;
00027 class DT_DLL_VL DtExerciseConn;
00028 
00029 
00030 
00032 typedef void (*DtServiceRequestInteractionCb)
00033    (DtServiceRequestInteraction* inter, void* usr);
00034 
00039 
00040 class DT_DLL_VL DtServiceRequestInteraction : public DtInteractionWithEncDec
00041 {
00042 public:
00043 
00045    DtServiceRequestInteraction();
00046 
00048    virtual ~DtServiceRequestInteraction();
00049 
00051    DtServiceRequestInteraction(const DtServiceRequestInteraction& orig);
00052 
00054    DtServiceRequestInteraction& operator=(
00055       const DtServiceRequestInteraction& orig);
00056 
00058    virtual void printData() const;
00059 
00061    virtual void printDataToStream(std::ostream& stream) const;
00062 
00064    virtual void setRequestingId(const DtGlobalObjectDesignator &requester);
00065    virtual const DtGlobalObjectDesignator &requestingId() const;
00066 
00068    virtual void setServicingId(const DtGlobalObjectDesignator &servicer);
00069    virtual const DtGlobalObjectDesignator &servicingId() const;
00070 
00072    virtual void setServiceType(DtServiceType type);
00073    virtual DtServiceType serviceType() const; 
00074 
00076    virtual void setSupplies(const void* data, int numBytes);
00077    virtual const void* supplies() const;
00078 
00080    virtual void setNumSupplyTypes(int numTypes);
00081    virtual int numSupplyTypes() const; 
00082 
00083    virtual void setNthSupply(int supplyIndex, const DtEntityType &supply,
00084       float quantity, int *retCode = NULL);
00085    virtual const DtEntityType& nthSupply(int supplyIndex, 
00086       float *quantity = NULL, int *retCode = NULL) const;
00087 
00088    virtual float supplyQuantity(const DtEntityType &supply) const;
00089 
00090    virtual void changeSuppliesSize(int newSize);
00091 
00092    virtual int indexInBounds(int ind) const;
00093 
00094 
00095 
00097    virtual const char* name() const;
00098 
00099 public:
00100 
00103    static DtInteraction* create();
00104 
00107    static void addCallback(DtExerciseConn* conn,
00108       DtServiceRequestInteractionCb cb, void* usr,
00109       DtDDMRegionSP region = DtDDMRegionSP());
00110    static void removeCallback(DtExerciseConn* conn,
00111       DtServiceRequestInteractionCb cb, void* usr, 
00112       DtDDMRegionSP region = DtDDMRegionSP());
00113 
00114 protected:
00115 
00116    DtGlobalObjectDesignator myRequestingObject;
00117    DtGlobalObjectDesignator myServicingObject;
00118    DtServiceType myServiceType;
00119    int myNumSupplyTypes;
00120    DtNetSupplyQuantity* mySupplies;
00121    DtEntityType myNthSupply;
00122 };
00123 
00124 inline const DtGlobalObjectDesignator& DtServiceRequestInteraction::
00125    requestingId() const
00126 {
00127    return myRequestingObject;
00128 }
00129 
00130 inline const DtGlobalObjectDesignator& DtServiceRequestInteraction::
00131    servicingId() const
00132 {
00133    return myServicingObject;
00134 }
00135 
00136 inline DtServiceType DtServiceRequestInteraction::serviceType() const
00137 {
00138    return myServiceType;
00139 }
00140 
00141 inline void DtServiceRequestInteraction::setServicingId(
00142    const DtGlobalObjectDesignator &id)
00143 {
00144    myServicingObject = id;
00145 }
00146 
00147 inline void DtServiceRequestInteraction::setRequestingId(
00148    const DtGlobalObjectDesignator &id)
00149 {
00150    myRequestingObject = id;
00151 }
00152 
00153 inline void DtServiceRequestInteraction::setServiceType(DtServiceType type)
00154 {
00155    myServiceType = type;
00156 }
00157 
00158 inline const char* DtServiceRequestInteraction::name() const
00159 {
00160    return "DtServiceRequestInteraction";
00161 }
00162 
00163 #endif
00164 #endif
00165 

Document ID: Generated on Mon May 14 08:06:18 EDT 2012 from SVN revision 114750
Copyright © 2005-2012 VT MÄK Inc. All Rights Reserved (www.mak.com)