CommandGeneratorMap.hpp File Reference

Detailed Description

This file contains utility classes to instantiate commands when they are received from the network, or reloaded after a crash.

For each command, a factory will be generated and stored in a map with the command name, to allow fast instantiation upon command reception.

Each command has two identifiers :

  • One is the CommandGroupKey used to differentiate groups of commands
  • One is the CommandKey used to differentiate commands in a same group

They are stored in a CommandData upon serialization, along with the command-specific data.

Reinstantiation is done through score::ApplicationContext::instantiateUndoCommand.

OPTIMIZEME: right now the names are used, it should be nice to migrate towards uids. OPTIMIZEME : maybe we could just concatenate both keys and have a single hash_map...

Go to the source code of this file.

Classes

struct  score::commands::FactoryInserter
 Creates and inserts a new factory class for a given command, in a list of such factories. More...
 

Namespaces

 score
 Base toolkit upon which the software is built.
 

Typedefs

using CommandFactory = score::Command *(*)(const QByteArray &)
 Base factory for commands. More...
 
using CommandGeneratorMap = std::vector< std::pair< CommandKey, CommandFactory > >
 The CommandGeneratorMap struct. More...
 

Typedef Documentation

◆ CommandFactory

using CommandFactory = score::Command* (*)(const QByteArray&)

Base factory for commands.

Base typedef for command instantiation. Allows a polymorphic use.

◆ CommandGeneratorMap

using CommandGeneratorMap = std::vector<std::pair<CommandKey, CommandFactory> >

The CommandGeneratorMap struct.

A map between command names and corresponding factories.