VR-Forces 4.1 Class Documentation
Simulation Command Executor

The MySimCommand Executor is a new class the implements a simulation command executor that uses the contents of the MySimCommand to print a message to the back-end console.


Header file:

/*******************************************************************************
** Copyright (c) 2006 MAK Technologies, Inc.
** All rights reserved.
*******************************************************************************/
/*******************************************************************************
** $RCSfile: mySimCommandExecutor.h,v $ $Revision: 1.2 $ $State: Exp $
*******************************************************************************/
//\file mySimCommandExecutor.h
//\brief MySimCommandExecutor.
#ifndef MySimCommandExecutor_h_
#define MySimCommandExecutor_h_
//\brief Executor for the MySimCommand DtSimCommand.
//Prints the text specified in the command to the console.
{
public:
//Prints message to the sim engine console.
virtual bool execute(const DtSimCommand* command);
//Prints message to the objectConsole for the named object.
virtual bool execute(const DtSimCommand* command, const DtString& objectName);
//\return A new instance of this class.
private:
//Not implemented.
//Not implemented.
//Not implemented.
};
#endif

Implementation:

/*******************************************************************************
** Copyright (c) 2006 MAK Technologies, Inc.
** All rights reserved.
*******************************************************************************/
/*******************************************************************************
** $RCSfile: mySimCommandExecutor.cxx,v $ $Revision: 1.2 $ $State: Exp $
*******************************************************************************/
#include "vrfcore/simMgr.h"
#include "assert.h"
#include "mySimCommand.h"
#include <vlutil/vlPrint.h>
: DtSimCommandExecutor(simManager)
{
}
{
}
{
assert(command->type() == MySimCommandType);
const MySimCommand* msgCommand =
static_cast<const MySimCommand*>(command);
DtInfo << msgCommand->messageText() << std::endl;
return true;
}
const DtString& objectName)
{
assert(command->type() == MySimCommandType);
const MySimCommand* msgCommand =
static_cast<const MySimCommand*>(command);
objectName);
if (obj)
{
obj->objectConsoleWarn() << msgCommand->messageText() << std::endl;
}
else
{
DtInfo << "MySimCommand: Could not find entity: " << objectName.string() << std::endl;
}
return true;
}
{
return new MySimCommandExecutor(simManager);
}

Document ID: Generated on Tue Jan 29 18:21:16 EST 2013 from SVN revision 123193
Copyright © 2005-2013 VT MÄK Inc. All Rights Reserved (www.mak.com)