Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: orxonox.OLD/branches/new_class_id/src/lib/shell/shell_command_class.h @ 9692

Last change on this file since 9692 was 9692, checked in by bensch, 18 years ago

orxonox/new_class_id: some thoughts on a BaseIterator class, that can travers through ObejectLists without knowing the Polymorph type.
This is all virtual, and since templated virutal functions are not allowed, quite hard to implements…
hpe it will work

File size: 1.9 KB
Line 
1/*!
2 * @file shell_command_class.h
3 * Definition of a on-screen-shell
4 */
5
6#ifndef _SHELL_COMMAND_CLASS_H
7#define _SHELL_COMMAND_CLASS_H
8
9#include "base_object.h"
10#include <vector>
11#include <list>
12
13namespace OrxShell
14{
15  // FORWARD DECLARATION
16  class ShellCommand;
17  class ShellCommandAlias;
18  class ShellCommandClass;
19
20  typedef std::vector<ShellCommand*>      CmdList;
21  typedef std::vector<ShellCommandClass*> CmdClassList;
22
23
24  //! A class to hold all Classes that have (once) registered Commands.
25  class ShellCommandClass : public BaseObject
26  {
27    NewObjectListDeclaration(ShellCommandClass);
28
29    friend class ShellCommand;
30  public:
31    /** @returns the CommandClassList */
32    static const CmdClassList& getCommandClassList() { return *ShellCommandClass::_commandClassList; };
33
34    static bool getCommandListOfClass(const std::string& className, std::list<std::string>& stringList);
35
36    static void unregisterAllCommands();
37    static ShellCommandClass* getCommandClass(const std::string& className);
38    NewClassID getClassID();
39    static bool exists(const std::string& className);
40
41    static void help (const std::string& className = "");
42
43    static void debug();
44
45  private:
46    ShellCommandClass(const std::string& className);
47    static ShellCommandClass* acquireCommandClass(const std::string& className);
48    virtual ~ShellCommandClass();
49
50
51    void registerCommand(ShellCommand* command);
52    void unregisterCommand(ShellCommand* command);
53
54  private:
55    const std::string                      _className;                 //!< The Name of the Class. This should match the ClassName of the Commands Class.
56    NewClassID                             _classID;                   //!< The classID of this Class
57    CmdList                                _commandList;               //!< A list of Commands from this Class
58
59    static CmdClassList*                   _commandClassList;          //!< A list of Classes
60  };
61}
62
63#endif /* _SHELL_COMMAND_H */
Note: See TracBrowser for help on using the repository browser.