|
FEBio
1.5.0
|
00001 #pragma once 00002 00003 #include "Command.h" 00004 #include <list> 00005 using namespace std; 00006 00007 class CommandManager 00008 { 00009 public: 00010 static CommandManager* GetInstance() 00011 { 00012 static bool bfirst = true; 00013 if (bfirst) { m_pMngr = new CommandManager; bfirst = false; } 00014 return m_pMngr; 00015 } 00016 00017 public: 00018 void AddCommand(Command* pcmd) { m_Cmd.push_back(pcmd); } 00019 int Size() { return m_Cmd.size(); } 00020 00021 Command* Find(const char* szcmd) 00022 { 00023 int N = m_Cmd.size(); 00024 if (N == 0) return 0; 00025 00026 list<Command*>::iterator ic = m_Cmd.begin(); 00027 for (int i=0; i<N; ++i, ++ic) 00028 { 00029 if (strcmp(szcmd, (*ic)->GetName()) == 0) return (*ic); 00030 } 00031 00032 return 0; 00033 } 00034 00035 typedef list<Command*>::iterator CmdIterator; 00036 00037 CmdIterator First() { return m_Cmd.begin(); } 00038 00039 protected: 00040 list<Command*> m_Cmd; 00041 00042 protected: 00043 static CommandManager* m_pMngr; 00044 };
1.7.5.1