VR-Forces 4.0.4 Class Documentation
exampleCreateObserver

This example shows how to create an observer.

To create an observer, you must first create an observer configuration.

   // First, create an observer configuration that describes the observer to 
   // create.  For this example, the default values are fine - we just need to 
   // supply a unique name.
   makVrv::DtObserverConfiguration observerConfig("Example Observer");

The configuration is then added to the DtInputDriver, which will realize the observer immediately if started, or realize it on start up.

   // Then add the configuration to the input driver.  Since we added the 
   // configuration the input driver will create this observer each time it
   // is started.
   vantageApp.de().driverManager().inputDriver().addObserverConfiguration( 
      observerConfig );

Building the Example

VR-Vantage includes pre-built versions of the example application. To build it yourself, follow the instructions at Building VR-Vantage Examples, Applications, and Plug-ins.

Running the Example

This example is an application. You can run it by running ./bin/exampleCreateObserver.exe (on Windows) or ./bin/exampleCreateObserver (on Linux). For more information about running examples, please see Running Applications and Examples.


exampleCreateObserver.cxx

/******************************************************************************
** Copyright (c) 2007 MAK Technologies, Inc.
** All rights reserved.
******************************************************************************/
/******************************************************************************
** $RCSfile: exampleCreateObserver.cxx,v $ $Revision: 1.17 $ $State: Exp $
******************************************************************************/


#include <vrvCore/DtVantageIgConfiguration.h>
#include <vrvCore/DtVantageIgCommandLineProcessor.h>
#include <vrvCore/DtDe.h>
#include <vrvCore/DtInputDriver.h>
#include <vrvCore/DtDriverManager.h>

#include <vrvUtil/DtObserverConfiguration.h>

#include <boost/bind.hpp>

int main(int argc, char** argv)
{    
   // Create the Application.
   makVrv::DtVantageIgConfiguration config;
   makVrv::DtVrvApplication vantageApp(config);
   makVrv::DtVantageIgCommandLineProcessor vantageCommandLineParser;

   vantageApp.installCommandLineProcessor(&vantageCommandLineParser);

   // Parse Command Line.
   vantageApp.initialize(argc,argv);
   
   // First, create an observer configuration that describes the observer to 
   // create.  For this example, the default values are fine - we just need to 
   // supply a unique name.
   makVrv::DtObserverConfiguration observerConfig("Example Observer");
   
   // Then add the configuration to the input driver.  Since we added the 
   // configuration the input driver will create this observer each time it
   // is started.
   vantageApp.de().driverManager().inputDriver().addObserverConfiguration( 
      observerConfig );

   // Run.
   vantageApp.run();
}

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)