MAK RTIspy API Documentation for HLA 1.3
List of all members | Public Member Functions | Static Public Member Functions | Protected Types | Protected Member Functions | Protected Attributes | Static Protected Attributes | Private Member Functions
DtFileDistributor Class Reference

Distributes fomModule files from initiating federate to RtiExec and then from RtiExec to all joining federates. More...

+ Inheritance diagram for DtFileDistributor:
+ Collaboration diagram for DtFileDistributor:

Public Member Functions

virtual bool sendFedFile (const std::vector< MAKRti::DtString > &modules)
 Override sendFedFile upload fed files passed in.
virtual bool pushFedFile (DtConnectionMgr *connMgr, const MAKRti::DtString &fileName, const unsigned int fileSize, const char *fileBuffer, const DtFederateHandle destination=0)
 pushFedFile
virtual void fedFileUploaded (const MAKRti::DtString fileUploaded)
 Called when Fom Module received successfully.
virtual bool fileReceived (const DtFomModuleDistributionMsg &msg, bool &areAllHere)
virtual bool fileRequested (const DtFomModuleRequestMsg &msg)
virtual void removeFile (const MAKRti::DtString fileName)
 Remove all knowledge of this file from myFiles.
virtual void removeFiles (const std::vector< MAKRti::DtString > &modules)
 Remove all knowledge of these file from myFiles.
virtual bool fedFileReady (const MAKRti::DtString &fileName) const
 Does the distributor have a valid copy of this fom Module.
virtual bool fedFilesReady (const std::vector< MAKRti::DtString > *fileNames) const
 Does the distributor have a valid copy of all of these fom Modules.
const FILE * fedFilePtr (MAKRti::DtString fileName) const
 Get the fed file pointer.
const char * fedFileBuff (MAKRti::DtString fileName) const
 Get the fed file buffer.
DtFileInformationtakeFedFile (MAKRti::DtString fileName)
 Take ownership of the file.
unsigned int fileSize (MAKRti::DtString fileName) const
FILE * getTmpFile ()
void setFedHandle (unsigned int newHandle)
 Set the Fed Handle of the distributor.
void setFedexHandle (unsigned int newHandle)
bool requestsPending () const
 Are there outstanding requests to be handled?

Static Public Member Functions

static void setCreatorFunction (DtFileDistributorCreator fn)

Protected Types

typedef std::list< DtRtiMsg * > rtiMsgList

Protected Member Functions

 DtFileDistributor (const int fedExHandle, const int federateHandle, const MAKRti::DtString &fedExName)
 Constructor.
virtual ~DtFileDistributor ()
 Destructor.

Protected Attributes

std::map< MAKRti::DtString,
DtFileInformation * > 
myFiles
 Map between files that have been uploaded to me and their 'file names'.
std::set< std::pair
< DtFederateHandle,
MAKRti::DtString > > 
myPendingRequests
MAKRti::DtString myFedExName
int myFedExHandle
int myFederateHandle
std::map< MAKRti::DtString,
FILE * > 
myOpenFileHandles

Static Protected Attributes

static DtFileDistributorCreator theCreator = 0

Private Member Functions

 DtFileDistributor ()
 DtFileDistributor (const DtFileDistributor &orig)
DtFileDistributoroperator= (const DtFileDistributor &orig)

Detailed Description

Distributes fomModule files from initiating federate to RtiExec and then from RtiExec to all joining federates.

Member Typedef Documentation

typedef std::list< DtRtiMsg* > DtFileDistributor::rtiMsgList
protected

Constructor & Destructor Documentation

DtFileDistributor::DtFileDistributor ( const int  fedExHandle,
const int  federateHandle,
const MAKRti::DtString &  fedExName 
)
protected

Constructor.

DtFileDistributor::~DtFileDistributor ( )
protectedvirtual

Destructor.

References myFiles, and myOpenFileHandles.

DtFileDistributor::DtFileDistributor ( )
private
DtFileDistributor::DtFileDistributor ( const DtFileDistributor orig)
private

Member Function Documentation

const char * DtFileDistributor::fedFileBuff ( MAKRti::DtString  fileName) const

Get the fed file buffer.

References myFiles.

const FILE * DtFileDistributor::fedFilePtr ( MAKRti::DtString  fileName) const

Get the fed file pointer.

References myFiles.

Referenced by DtRtiExecFederateMgr::mergeFomModules().

bool DtFileDistributor::fedFileReady ( const MAKRti::DtString &  fileName) const
virtual

Does the distributor have a valid copy of this fom Module.

References myFiles.

Referenced by fedFilesReady().

bool DtFileDistributor::fedFilesReady ( const std::vector< MAKRti::DtString > *  fileNames) const
virtual

Does the distributor have a valid copy of all of these fom Modules.

References fedFileReady().

void DtFileDistributor::fedFileUploaded ( const MAKRti::DtString  fileUploaded)
virtual
bool DtFileDistributor::fileReceived ( const DtFomModuleDistributionMsg msg,
bool &  areAllHere 
)
virtual
bool DtFileDistributor::fileRequested ( const DtFomModuleRequestMsg msg)
virtual
unsigned int DtFileDistributor::fileSize ( MAKRti::DtString  fileName) const

References myFiles.

Referenced by fedFileUploaded(), and pushFedFile().

FILE * DtFileDistributor::getTmpFile ( )

References myOpenFileHandles.

Referenced by fedFileUploaded().

DtFileDistributor& DtFileDistributor::operator= ( const DtFileDistributor orig)
private
bool DtFileDistributor::pushFedFile ( DtConnectionMgr connMgr,
const MAKRti::DtString &  fileName,
const unsigned int  fileSize,
const char *  fileBuffer,
const DtFederateHandle  destination = 0 
)
virtual
void DtFileDistributor::removeFile ( const MAKRti::DtString  fileName)
virtual

Remove all knowledge of this file from myFiles.

References DtFileInformation::myFileOwned, and myFiles.

Referenced by removeFiles().

void DtFileDistributor::removeFiles ( const std::vector< MAKRti::DtString > &  modules)
virtual

Remove all knowledge of these file from myFiles.

References removeFile().

Referenced by DtFedexRemoveFileCmd::operator()().

bool DtFileDistributor::requestsPending ( ) const

Are there outstanding requests to be handled?

Reimplemented in DtAsyncFileDistributorRunnable.

References myPendingRequests.

bool DtFileDistributor::sendFedFile ( const std::vector< MAKRti::DtString > &  modules)
virtual
void DtFileDistributor::setCreatorFunction ( DtFileDistributorCreator  fn)
static

References theCreator.

void DtFileDistributor::setFedexHandle ( unsigned int  newHandle)

References myFedExHandle.

Referenced by DtFedExec::createDistributor().

void DtFileDistributor::setFedHandle ( unsigned int  newHandle)

Set the Fed Handle of the distributor.

Because federates will use the distributor before they're joined, they'll need to reassign from the connectHandle to their Fed Handle once they're joined.

References myFederateHandle.

Referenced by DtFedExec::createDistributor().

DtFileInformation * DtFileDistributor::takeFedFile ( MAKRti::DtString  fileName)

Take ownership of the file.

retVal will be zero if file not complete (or nonexistent)

References myFiles.

Referenced by DtAsyncFileDistributorRunnable::processTakeFileCmd().

Member Data Documentation

int DtFileDistributor::myFederateHandle
protected
int DtFileDistributor::myFedExHandle
protected
MAKRti::DtString DtFileDistributor::myFedExName
protected
std::map<MAKRti::DtString, DtFileInformation*> DtFileDistributor::myFiles
protected
std::map<MAKRti::DtString, FILE* > DtFileDistributor::myOpenFileHandles
protected

Referenced by getTmpFile(), and ~DtFileDistributor().

std::set<std::pair<DtFederateHandle, MAKRti::DtString> > DtFileDistributor::myPendingRequests
protected
DtFileDistributorCreator DtFileDistributor::theCreator = 0
staticprotected

Referenced by setCreatorFunction().


The documentation for this class was generated from the following files:

Document ID: Generated on Tue May 7 16:26:47 EDT 2013 from SVN revision 126903
Copyright © 2005-2013 VT MÄK Inc. All Rights Reserved (www.mak.com)