VR-Forces 5.0.3 Developer's Guide
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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) 2016 MAK Technologies, Inc.
** All rights reserved.
*******************************************************************************/
//\file mySimCommandExecutor.h
//\brief MySimCommandExecutor.
#pragma once
//\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, DtSimCommandContextPtr &, const DtPlan* = 0);
//Prints message to the objectConsole for the named object.
virtual bool execute(const DtSimCommand* command, DtSimCommandContextPtr &, const DtUUID& objectName, const DtPlan* = 0);
//\return A new instance of this class.
private:
//Not implemented.
//Not implemented.
//Not implemented.
};

Implementation:

/*******************************************************************************
** Copyright (c) 2016 MAK Technologies, Inc.
** All rights reserved.
*******************************************************************************/
#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 DtUUID& objectName, const DtPlan*)
{
assert(command->type() == MySimCommandType);
const MySimCommand* msgCommand =
static_cast<const MySimCommand*>(command);
objectName);
if (obj.isValid())
{
mySimulationServices->objectConsoleManager()->warnStream(objectName) << msgCommand->messageText() << std::endl;
}
else
{
DtInfo << "MySimCommand: Could not find entity: " << objectName.markingText() << std::endl;
}
return true;
}
{
return new MySimCommandExecutor(simManager);
}

Document ID: Generated on Thu Jun 1 17:58:13 EDT 2023 from SVN revision 255404
Copyright © 2005-2021 MAK Technologies. All Rights Reserved (www.mak.com)