VR-Forces 4.1.1 Class Documentation
Interface Content Message

The MyInterfaceContent is a subclass of DtSimInterfaceContent that is used send interface content messages that can contain any type of information.

When creating the network structure that represents the interface content message, it is important to remember to align it along an 8 byte boundry


Header file:

/*******************************************************************************
** Copyright (c) 2004 MAK Technologies, Inc.
** All rights reserved.
*******************************************************************************/
/*******************************************************************************
** $RCSfile: myInterfaceContent.h,v $ $Revision: 1.7 $ $State: Exp $
*******************************************************************************/
#ifndef MyInterfaceContent_H_
#define MyInterfaceContent_H_
//VR-Forces includes
//VR-Link includes
#include <vlutil/vlString.h>
#include <vlutil/vlNetTypes.h>
//Class MyInterfaceContent
//This is an example of a DtSimInterfaceContent subclass which can be
//used to send a message from one DtVrfMessageInterface to another
//which consists of a string and a number.
//8 bytes total
//To prevent conflicts with existing VR-Forces messages, increment custom
//messages starting at MIN_USER_INTERFACE_MESSAGE_TYPE as defined in
//msgTypes.h.
{
public:
//default constructor
//destructor
//copy constructor
//assignment operator
//Returns the type of interface content (MyInterfaceContentType as defined
//above).
virtual int type() const;
//Calls the copy constructor to create a clone
virtual DtSimInterfaceContent * clone() const;
//Set the message string
virtual const DtString & message() const;
//Get the message string
virtual void setMessage(const DtString & message);
//Set the number
virtual unsigned int number() const;
//Get the number
virtual void setNumber(unsigned int number);
//See if this is an acknowledgement
virtual bool ack() const;
//Set if this is an acknowledgement
virtual void setAck(bool);
//Returns the size of the full network representation padded to an 8-byte
//boundary.
virtual int netRepSize() const;
//Fills in the message from the network buffer
virtual bool setFromNet(const char* contentBuffer,
unsigned contentSize);
//Fills in the network buffer with the message contents
virtual bool setToNet();
//Prints the formatted contents of the message into the given string
virtual void printDataToString(DtString& str);
//Static creator function which gets registered with the
//DtInterfaceContentFactory
protected:
DtU32 myNumber;
bool myAck;
};
#endif

How to Run the Example

This example demonstrates how add a new kind of interface content message.

Usage

Select Settings, Plugins... and on the Plugins Editor page, use the combo box at the top of the page to select the plug-in. Then enable the Load Plugin checkbox and re-start VR-Forces.

To view the new behavior:

  1. Start vrfSim. Watch the console and wait until the parameter database has been loaded.
  2. Start vrfGui.

The vrfGui application creates and sends a new kind of interface content message. Both vrfGui and vrfSim receive the message and display its contents in their console windows (message content includes the phrase 'Testing from interfaceContentGui').


Document ID: Generated on Mon Apr 8 19:24:01 EDT 2013 from SVN revision 125877
Copyright © 2005-2013 VT MÄK. All Rights Reserved (www.mak.com)