Open cheese-cake opened 3 years ago
Here is useful factory class.
Not command but decoder seems to be automatically registered and created.
$ artemis -l -b
Registering art::TStreamingModuleDecoderLRTDC
Use mass table inside root since Art.MassTable is not defined in .rootrc
Creating art::TStreamingModuleDecoderLRTDC
artemis [0]
Now you can register artemis command by calling the TCatCmdFactory::Register explicitly. However, all the safe commands are expected to be registered automatically. Otherwise, some useful commands will be hidden.
The convenient way maybe a combination of constructor with an argument in a base class to call a pure virtual member function which should be defined in a child class.
In source file of a child command class of TCmdXXX, you have to write when you add your own command,
TCmdXXX aCmd(TCatCmdFactory::Instance());
This constructor should call TCatCmd::TCatCmd(TCatCmdFactory::Instance()),which call a pure virtual function where the concrete command will be registered.
This scheme will be convenient in C++11 or greater version, where