VR-Forces Development_Version Class Documentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Interface Content Message (interfaceContentSim)

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

In the Launcher, click the Plug-ins button to bring up the Plug-ins Selection dialog. Enable the plugin. Then launch 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 Jul 4 01:00:18 EDT 2016 from SVN revision 166489
Copyright © 2005-2015 VT MÄK. All Rights Reserved (www.mak.com)