VR-Forces 4.0.4 Class Documentation
include/vrfExtProtocol/ifaceCont.h
Go to the documentation of this file.
00001 /*******************************************************************************
00002 ** Copyright (c) 1999 MAK Technologies, Inc.
00003 ** All rights reserved.
00004 *******************************************************************************/
00005 /*******************************************************************************
00006 ** $RCSfile: ifaceCont.h,v $ $Revision: 1.10 $ $State: Exp $
00007 *******************************************************************************/
00008 
00009 //
00010 // File:        ifaceCont.h
00011 //
00012 // Class:       DtSimInterfaceContent
00013 //
00014 
00015 
00016 #ifndef DtSimInterfaceContent_H_
00017 #define DtSimInterfaceContent_H_
00018 
00019 #include <vlutil/vlString.h>
00020 #include <vrfExtProtocol/ifContFactory.h>
00021 
00022 //
00023 // DtSimInterfaceContent is an abstract base class from which real interface
00024 // content can be derived.  Interface content is the request, response, or other
00025 // information provided in an interface message.
00026 //
00027 // All classes derived from DtSimInterfaceContent must implement a type() 
00028 // function that returns the type of the interface content as an integer, such as 
00029 // DtCreate-EntityMessageType or DtPauseControlType. 
00030 // These are defined in msgTypes.h. 
00031 // Derived classes must also provide a clone() function that copies their contents. 
00032 // 
00033 // Content-Type:  Not applicable.
00034 // 
00035 // Parameters: type - The type of interface content, such as "create-entity" or 
00036 // "pause".
00039 
00040 #include <vrfExtProtocol/vrfExtProtocolDefines.h>
00041 class DT_DLL_vrfExtProtocol DtSimInterfaceContent
00042 {
00043 protected:
00044    // constructors are protected because no one should instantiate the
00045    // base class, just derived versions.
00046 
00047    // default constructor
00048    DtSimInterfaceContent();
00049 
00050    // copy constructor; nothing to be copied. Here to thwart over-ambitious
00051    // compilers that create one when it shouldn't.
00052    DtSimInterfaceContent(const DtSimInterfaceContent & orig);
00053 
00054    // assignment operator; same as copy costructor
00055    const DtSimInterfaceContent & operator=(const DtSimInterfaceContent & orig);
00056 
00057 public:
00058    virtual ~DtSimInterfaceContent();
00059 
00060    // Returns the type of Interface Content, such as "create-entity" or "pause".
00061    virtual int type() const = 0;
00062 
00063    virtual DtSimInterfaceContent * clone() const = 0;
00064 
00065    // Like operator = except it return true if the target data was changed.
00066    // Object makes a copy of data and does not take on management, caller is 
00067    // responsible for deletion.
00068    virtual bool update (const DtSimInterfaceContent* data);
00069 
00070    virtual char* netRep();
00071 
00072    virtual int netRepSize() const { return 0; }
00073 
00074    virtual bool setFromNet(const char* contentBuffer,
00075       unsigned contentSize)
00076        { (void) &contentBuffer; (void) &contentSize;
00077        return false; }
00078 
00079    virtual bool setToNet() { return false; }
00080 
00081    // Print message data
00082    virtual void printDataToString(DtString& str);
00083 
00084    // Indicate whether the interface content should be 
00085    // sent with the sender's session ID.  If this value
00086    // is set to true, only those receivers that have the
00087    // same session ID as the sender will read the message.
00088    // If the value is set the false, every receiver will
00089    // read the message, regardless of their session ID.
00090    // Currently, only DtVrfObjectDataType messages set
00091    // useSessionId to false.
00092 
00093    virtual void setUseSessionId(bool yesNo);
00094    virtual bool useSessionId() const;
00095 
00096 public:
00097    //
00098    // Static functions
00099    //
00100 
00101    static DtSimInterfaceContent* createInterfaceContent(int type);
00102 
00103    static void addInterfaceContentCreatorFcn(int type,
00104       DtInterfaceContentCreatorFcn fcn);
00105 
00106    static void setFactory(DtInterfaceContentFactory* factory);
00107 
00108    static DtInterfaceContentFactory* factory();
00109 
00110 protected:
00111    virtual char* createNetworkBuffer();
00112 
00113 protected:
00114    char*                              myNetRep;
00115    bool                          myUseSessionId;
00116 
00117 protected:
00118 
00119    static DtInterfaceContentFactory*  myFactory;
00120 
00121 };
00122 
00123 
00124 #endif
00125 
00126 

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)