00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #ifndef ___ARG_MGR__
00020 #define ___ARG_MGR__
00021
00022 #include "gdcmCommon.h"
00023 #include <stdio.h>
00024 #include <stdlib.h>
00025
00026 namespace GDCM_NAME_SPACE
00027 {
00028
00029 #define ID_RFILE_TEXT "rt"
00030 #define ARGMAXCOUNT 100 // Maximum number of arguments
00031 #define ARG_LONG_MAX 1000
00032
00033
00034 #define ARG_DEFAULT_PARAMOUT "fileout.par"
00035 #define ARG_DEFAULT_LOGFILE "gdcm.log"
00036
00037 #define ARG_LABEL_LOGFILE "LOG"
00038 #define ARG_LABEL_PARAMOUT "paramout"
00039
00040 #define START_USAGE(usage) const char *usage[] = {
00041 #define FINISH_USAGE 0};
00042
00043
00051 class GDCM_EXPORT ArgMgr
00052 {
00053 public:
00054 ArgMgr(int argc, char **argv);
00055 ~ArgMgr();
00056
00057 int ArgMgrDefined (const char *param);
00058 char *ArgMgrValue (const char *param);
00059 const char *ArgMgrUnused (void);
00060 int ArgMgrSave (const char *);
00061 int ArgMgrUsage (const char **usage);
00062 int ArgMgrPrintUnusedLabels (void);
00063
00064 int ArgMgrGetInt (const char *param, int);
00065 float ArgMgrGetFloat (const char *param, float);
00066 const char *ArgMgrGetString(const char *param, const char* ext = 0);
00067 int ArgMgrGetLabel (const char *param, const char *, int);
00068
00069 int ArgMgrWantInt (const char *param, const char **usage);
00070 float ArgMgrWantFloat (const char *param, const char **usage);
00071 char *ArgMgrWantString(const char *param, const char **usage);
00072 int ArgMgrWantLabel (const char *param, char *, const char **usage);
00073
00074 int *ArgMgrGetListOfInt (const char *param, int *);
00075 float *ArgMgrGetListOfFloat (const char *param, int *);
00076 char **ArgMgrGetListOfString(const char *param, int *);
00077
00078 int *ArgMgrGetIntEnum (const char *param, int *);
00079 uint16_t *ArgMgrGetXInt16Enum (const char *param, int *);
00080 float *ArgMgrGetFloatEnum (const char *param, int *);
00081
00082 private :
00083
00084 int FiltreLong (const char *);
00085 const char *LoadedParam(const char *, FILE *);
00086 int ArgLoadFromFile (const char *);
00087 void ArgStdArgs (void);
00088
00089
00090 char *maj (char *);
00091 char *Majuscule (const char *);
00092
00093 int IdStrCountChar (char *chaine,int caract);
00094 int *IdStrIntEnum (char *value, int *number);
00095 uint16_t *IdStrXInt16Enum (char *value, int *number);
00096 float *IdStrFloatEnum (char *value, int *number);
00097
00098
00099
00100 private :
00101
00102 const char *ArgParamOut;
00103
00104 char *ArgUsed;
00105 char *ArgLab[ARGMAXCOUNT];
00106 char *ArgStr[ARGMAXCOUNT];
00107 int ArgCount;
00108 char *Appel;
00109 };
00110 }
00111
00112 #endif