OpenIG  2.0.4
cross-platform open-source OpenSceneGraph Image Generator
Classes | Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
OpenIG::Base::Commands Class Reference

The Commands singleton class. More...

#include <Commands.h>

Classes

class  Command
 The Command class. More...
 
struct  CommandExecCallback
 Callback when command is executed. More...
 

Public Types

typedef osg::ref_ptr< CommandCommandPtr
 
typedef std::map< std::string, osg::ref_ptr< Command > > CommandsMap
 
typedef std::map< std::string, osg::ref_ptr< Command > >::iterator CommandsMapIterator
 
typedef std::map< std::string, osg::ref_ptr< Command > >::const_iterator CommandsMapConstIterator
 

Public Member Functions

void setCommandExecCallback (CommandExecCallback *callback)
 Sets the Callback when command is executed. More...
 
int exec (const std::string &command)
 Performs execution of a command. More...
 
void addCommand (const std::string &command, Command *cmd)
 Add a command. More...
 
void loadScript (const std::string &fileName)
 Loads a text file with commands in and perform their execition. More...
 
void clear ()
 Clears the commands map. More...
 
const CommandsMap & getCommands () const
 Gives the current commands. More...
 
void removeCommand (const std::string &command)
 Removes a command. More...
 

Static Public Member Functions

static Commandsinstance ()
 The Commands singleton. More...
 

Protected Member Functions

 Commands ()
 Constructor. More...
 
 ~Commands ()
 Destructor. More...
 

Protected Attributes

CommandsMap _commands
 name based std::map of commands added
 
osg::ref_ptr< CommandExecCallback_commandExecCallback
 The command exec callback, executed when a command is executed.
 

Detailed Description

The Commands singleton class.

This singleton gives the user ability to run commands.

Author
Trajce Nikolov Nick openi.nosp@m.g@co.nosp@m.mpro..nosp@m.net
Date
Sun Jan 11 2015

Constructor & Destructor Documentation

OpenIG::Base::Commands::Commands ( )
protected

Constructor.

Author
Trajce Nikolov Nick openi.nosp@m.g@co.nosp@m.mpro..nosp@m.net
Date
Sun Jan 11 2015
OpenIG::Base::Commands::~Commands ( )
protected

Destructor.

Author
Trajce Nikolov Nick openi.nosp@m.g@co.nosp@m.mpro..nosp@m.net
Date
Sun Jan 11 2015

Member Function Documentation

void OpenIG::Base::Commands::addCommand ( const std::string &  command,
Command cmd 
)

Add a command.

Parameters
commandThe name of the command. You use it to invoke the command
cmdInstance of a command
Author
Trajce Nikolov Nick openi.nosp@m.g@co.nosp@m.mpro..nosp@m.net
Date
Sun Jan 11 2015
void OpenIG::Base::Commands::clear ( )

Clears the commands map.

Author
Trajce Nikolov Nick openi.nosp@m.g@co.nosp@m.mpro..nosp@m.net
Date
Sun Jan 11 2015
int OpenIG::Base::Commands::exec ( const std::string &  command)

Performs execution of a command.

Parameters
commandThe command with its arguments
Returns
see Command::exec
Author
Trajce Nikolov Nick openi.nosp@m.g@co.nosp@m.mpro..nosp@m.net
Date
Sun Jan 11 2015
const CommandsMap& OpenIG::Base::Commands::getCommands ( ) const
inline

Gives the current commands.

Returns
Gives the current commands map
Author
Trajce Nikolov Nick openi.nosp@m.g@co.nosp@m.mpro..nosp@m.net
Date
Sun Jan 11 2015
static Commands* OpenIG::Base::Commands::instance ( )
static

The Commands singleton.

Returns
The Commands singleton
Author
Trajce Nikolov Nick openi.nosp@m.g@co.nosp@m.mpro..nosp@m.net
Date
Sun Jan 11 2015
void OpenIG::Base::Commands::loadScript ( const std::string &  fileName)

Loads a text file with commands in and perform their execition.

Parameters
fileNameThe file name of the script
Author
Trajce Nikolov Nick openi.nosp@m.g@co.nosp@m.mpro..nosp@m.net
Date
Sun Jan 11 2015
void OpenIG::Base::Commands::removeCommand ( const std::string &  command)

Removes a command.

Parameters
commandThe name of the command to be removed
Author
Trajce Nikolov Nick openi.nosp@m.g@co.nosp@m.mpro..nosp@m.net
Date
Sun Oct 18 2015
void OpenIG::Base::Commands::setCommandExecCallback ( CommandExecCallback callback)

Sets the Callback when command is executed.

Author
Trajce Nikolov Nick openi.nosp@m.g@co.nosp@m.mpro..nosp@m.net
Date
Fri Jun 17 2016

The documentation for this class was generated from the following file: