Changeset 1516
- Timestamp:
- 24/08/10 11:53:16 (18 months ago)
- Location:
- trunk/applications
- Files:
-
- 2 edited
-
NXconvert/nxconvert.cpp (modified) (5 diffs)
-
NXsummary/main.cpp (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/applications/NXconvert/nxconvert.cpp
r1489 r1516 58 58 // set up the command line arguments 59 59 CmdLine cmd("Convert a NeXus file between different on disk file formats.", 60 ' ', NXCONVERT_VERSION); 61 UnlabeledValueArg<string> inFileArg("inputFile", "Name of the input file.", 62 EMPTY, "inputFile"); 63 cmd.add(inFileArg); 64 UnlabeledValueArg<string> outFileArg("outputFile", 65 "Name of the output file.", 66 EMPTY, "outputFile"); 67 cmd.add(outFileArg); 60 ' ', NXCONVERT_VERSION, false); 68 61 SwitchArg xmlArg("x", "xml", "Output file in xml format", false); 69 SwitchArg hdf4Arg("4", "hdf4", "Output file in hdf4 format", false); 70 SwitchArg hdf5Arg("5", "hdf5", "Output file in hdf5 format", false); 62 vector<int> allowedHdf; 63 allowedHdf.push_back(4); 64 allowedHdf.push_back(5); 65 ValuesConstraint<int> allowedHdfC(allowedHdf); 66 ValueArg<int> hdfArg("h", "hdf", "Specify HDF version to write", false, 0, &allowedHdfC); 71 67 SwitchArg defArg("d", "dfn", 72 68 "Output definition file used for validating NeXus files", … … 78 74 allowedXml.push_back("keepws"); 79 75 allowedXml.push_back("table"); 76 ValuesConstraint<string> allowedXmlC(allowedXml); 80 77 ValueArg<string> xmlSpecialArg("o", "outputxml", 81 78 "Special arguments for xml. keepws defines that the whitespace should be preserved. table specifies a format that is more easiliy imported into spreadsheet programs. Either option forces xml output", 82 false, "", allowedXml);79 false, "", &allowedXmlC); 83 80 vector<Arg*> outputformats; 84 outputformats.push_back(&hdf 5Arg);81 outputformats.push_back(&hdfArg); 85 82 outputformats.push_back(&xmlArg); 86 outputformats.push_back(&hdf4Arg);87 83 outputformats.push_back(&defArg); 88 84 outputformats.push_back(&defValueArg); … … 90 86 cmd.xorAdd(outputformats); 91 87 88 UnlabeledMultiArg<string> FileArgs("Files", "Name of input and output files.", 89 false, EMPTY); 90 cmd.add(FileArgs); 92 91 // parse the arguments and configure converting the file 93 92 cmd.parse(argc, argv); … … 108 107 definition_name = defValueArg.getValue(); 109 108 } 110 if (hdf4Arg.isSet()) { 111 nx_format = NX_HDF4; 112 nx_write_access |= NXACC_CREATE4; 113 } 114 if (hdf5Arg.isSet()) { 115 nx_format = NX_HDF5; 116 nx_write_access |= NXACC_CREATE5; 109 if (hdfArg.isSet()) { 110 int hdf_type = hdfArg.getValue(); 111 if (hdf_type == 4) { 112 nx_format = NX_HDF4; 113 nx_write_access |= NXACC_CREATE4; 114 } else if (hdf_type == 5) { 115 nx_format = NX_HDF5; 116 nx_write_access |= NXACC_CREATE5; 117 } 117 118 } 118 119 if (xmlSpecialArg.isSet()) { … … 128 129 } 129 130 } 130 string inFile(inFileArg.getValue()); 131 string outFile(outFileArg.getValue()); 131 vector<string> file_args = FileArgs.getValue(); 132 string inFile, outFile; 133 if (file_args.size() > 0) 134 { 135 inFile = file_args[0]; 136 } 137 if (file_args.size() > 1) 138 { 139 outFile = file_args[1]; 140 } 132 141 133 142 // do the actual conversion -
trunk/applications/NXsummary/main.cpp
r1301 r1516 147 147 // configure the arguments 148 148 SwitchArg verboseArg("", "verbose", "Turn on verbose printing", 149 false, cmd);149 cmd, false); 150 150 UnlabeledMultiArg<string> filenameArg("filename", 151 151 "Name of a file to be viewed", 152 "filename",cmd);152 false, "filename",cmd); 153 153 ValueArg<string> configArg("", "config", "Specify configuration file", 154 154 false, "", "config", cmd); … … 160 160 false, "", "label", cmd); 161 161 SwitchArg printXmlArg("", "xml", "Print results as xml", 162 false, cmd);162 cmd, false); 163 163 164 164 // parse the arguments
Note: See TracChangeset
for help on using the changeset viewer.
