1 /**
2 * @file readSBML.cpp
3 * @brief Similar to validateSBML, but without the validation
4 * @author Sarah Keating
5 * @author Ben Bornstein
6 *
7 * <!--------------------------------------------------------------------------
8 * This sample program is distributed under a different license than the rest
9 * of libSBML. This program uses the open-source MIT license, as follows:
10 *
11 * Copyright (c) 2013-2018 by the California Institute of Technology
12 * (California, USA), the European Bioinformatics Institute (EMBL-EBI, UK)
13 * and the University of Heidelberg (Germany), with support from the National
14 * Institutes of Health (USA) under grant R01GM070923. All rights reserved.
15 *
16 * Permission is hereby granted, free of charge, to any person obtaining a
17 * copy of this software and associated documentation files (the "Software"),
18 * to deal in the Software without restriction, including without limitation
19 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
20 * and/or sell copies of the Software, and to permit persons to whom the
21 * Software is furnished to do so, subject to the following conditions:
22 *
23 * The above copyright notice and this permission notice shall be included in
24 * all copies or substantial portions of the Software.
25 *
26 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
27 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
28 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
29 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
30 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
31 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
32 * DEALINGS IN THE SOFTWARE.
33 *
34 * Neither the name of the California Institute of Technology (Caltech), nor
35 * of the European Bioinformatics Institute (EMBL-EBI), nor of the University
36 * of Heidelberg, nor the names of any contributors, may be used to endorse
37 * or promote products derived from this software without specific prior
38 * written permission.
39 * ------------------------------------------------------------------------ -->
40 */
41
42
43 #include <iostream>
44
45 #include <sbml/SBMLTypes.h>
46 #include <sbml/common/extern.h>
47 #include "util.h"
48
49
50 using namespace std;
51 LIBSBML_CPP_NAMESPACE_USE
52
53 BEGIN_C_DECLS
54
55 int
main(int argc,char * argv[])56 main (int argc, char* argv[])
57 {
58 if (argc != 2)
59 {
60 cout << endl << "Usage: readSBML filename" << endl << endl;
61 return 1;
62 }
63
64 const char* filename = argv[1];
65 SBMLDocument* document;
66 SBMLReader reader;
67 #ifdef __BORLANDC__
68 unsigned long start, stop;
69 #else
70 unsigned long long start, stop;
71 #endif
72
73 start = getCurrentMillis();
74 document = reader.readSBML(filename);
75 stop = getCurrentMillis();
76
77 unsigned int errors = document->getNumErrors();
78
79 cout << endl;
80 cout << " filename: " << filename << endl;
81 cout << " file size: " << getFileSize(filename) << endl;
82 cout << " read time (ms): " << stop - start << endl;
83 cout << " validation error(s): " << errors << endl;
84 cout << endl;
85
86 document->printErrors(cerr);
87
88 delete document;
89 return errors;
90 }
91
92 END_C_DECLS
93