00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030 #ifndef _hyp_ker_command_h_
00031 #define _hyp_ker_command_h_
00032
00033 #ifndef hyp_KERNEL_CORE_INSIDE
00034 #error Inclusion not allowed (include hyp.kernel.core.h instead)
00035 #endif
00036
00037
00038 class hyp_ker_DLL CCmdInfoArg
00039 {
00040 protected:
00041 static int m_Argc;
00042 static char** m_Argv;
00047 inline static void SetArg(int Argc,char** Argv) { m_Argc=Argc; m_Argv=Argv; }
00048 };
00049
00050
00051 template<class T>
00052 class CCmdInfoData :
00053 protected CCmdInfoArg
00054 {
00055 public:
00056 virtual int GetSize() const =0;
00057 virtual T GetValue(int) const =0;
00058 };
00059
00060 class hyp_ker_DLL CCmdInfoLabel :
00061 public CCmdInfoData<std::string>
00062 {
00063 int m_PosBegin;
00064 int m_PosLast;
00065 public:
00066 CCmdInfoLabel(int =0,int =0);
00067 virtual int GetSize() const;
00068 virtual std::string GetValue(int) const;
00069
00075 template<class T>
00076 void Get(T& Value,int Pos) const {
00077 std::stringstream str_stream;
00078 str_stream<<GetValue(Pos);
00079 str_stream>>Value;
00080 }
00081 };
00082
00083
00084 class CCmdInfo;
00085
00086 typedef std::vector<CCmdInfoLabel> t_CmdInfoLabelEnum;
00087
00088
00089 class hyp_ker_DLL CCmdInfoLabelEnum :
00090 public CCmdInfoData<CCmdInfoLabel>,
00091 public t_CmdInfoLabelEnum
00092 {
00093 std::string m_LabelName;
00094 public:
00095 CCmdInfoLabelEnum(const std::string&);
00096 virtual int GetSize() const;
00097 virtual CCmdInfoLabel GetValue(int) const;
00101 inline std::string GetLabelName() const { return m_LabelName; }
00102 };
00103
00104
00105 class hyp_ker_DLL CCmdInfo :
00106 public CCmdInfoData<CCmdInfoLabelEnum>
00107 {
00108 const char m_LabelKey;
00109
00110 public:
00111 CCmdInfo(int,char**,char ='-');
00112 virtual int GetSize(void) const;
00113 virtual CCmdInfoLabelEnum GetValue(int) const;
00114 std::string GetModuleFileName() const;
00115 std::string GetModulePath() const;
00116 std::string GetModuleName() const;
00117 std::string GetLineOfParameters() const;
00118
00119 private:
00120 int GetNextLabelPosition(int) const;
00121 std::string GetLabelName(int) const;
00122 int GetNextLabel(const std::string&,int) const;
00123
00124 friend hyp_ker_DLL std::ostream& operator<<(std::ostream& ,const CCmdInfo&);
00125 };
00126
00127
00128 #endif