libSBML C API  libSBML 5.20.4 C API
Loading...
Searching...
No Matches
printSBML.c

Prints information about the top-level model in the given SBML file.

Prints information about the top-level model in the given SBML file.

/**
* @file printSBML.c
* @brief Prints some information about the top-level model
* @author Ben Bornstein
*
* <!--------------------------------------------------------------------------
* This sample program is distributed under a different license than the rest
* of libSBML. This program uses the open-source MIT license, as follows:
*
* Copyright (c) 2013-2018 by the California Institute of Technology
* (California, USA), the European Bioinformatics Institute (EMBL-EBI, UK)
* and the University of Heidelberg (Germany), with support from the National
* Institutes of Health (USA) under grant R01GM070923. All rights reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*
* Neither the name of the California Institute of Technology (Caltech), nor
* of the European Bioinformatics Institute (EMBL-EBI), nor of the University
* of Heidelberg, nor the names of any contributors, may be used to endorse
* or promote products derived from this software without specific prior
* written permission.
* ------------------------------------------------------------------------ -->
*/
#include <stdio.h>
#include <sbml/SBMLTypes.h>
int
main (int argc, char *argv[])
{
const char *filename;
Model_t *m;
unsigned int level, version;
if (argc != 2)
{
printf("Usage: printSBML filename\n");
return 2;
}
filename = argv[1];
d = readSBML(filename);
level = SBMLDocument_getLevel (d);
printf("\n");
printf("File: %s (Level %u, version %u)\n", filename, level, version);
if (m == NULL)
{
printf("No model present.");
return 1;
}
printf(" ");
printf(" model id: %s\n", Model_isSetId(m) ? Model_getId(m) : "(empty)");
printf( "functionDefinitions: %d\n", Model_getNumFunctionDefinitions(m) );
printf( " unitDefinitions: %d\n", Model_getNumUnitDefinitions (m) );
printf( " compartmentTypes: %d\n", Model_getNumCompartmentTypes (m) );
printf( " specieTypes: %d\n", Model_getNumSpeciesTypes (m) );
printf( " compartments: %d\n", Model_getNumCompartments (m) );
printf( " species: %d\n", Model_getNumSpecies (m) );
printf( " parameters: %d\n", Model_getNumParameters (m) );
printf( " initialAssignments: %d\n", Model_getNumInitialAssignments (m) );
printf( " rules: %d\n", Model_getNumRules (m) );
printf( " constraints: %d\n", Model_getNumConstraints (m) );
printf( " reactions: %d\n", Model_getNumReactions (m) );
printf( " events: %d\n", Model_getNumEvents (m) );
printf( "\n" );
return 0;
}
const char * Model_getId(const Model_t *m)
_tGet_t _tthe_t _tidentifier_t _tof_t _tthe_t _tgiven_t _tModel_t_t _tstructure_t.
Definition Model.cpp:7157
unsigned int Model_getNumEvents(const Model_t *m)
_tGet_t _tthe_t _tnumber_t _tof_t _tEvent_t_t _tstructures_t _tin_t _tthe_t _tgiven_t _tModel_t_t _ts...
Definition Model.cpp:8213
unsigned int Model_getNumReactions(const Model_t *m)
_tGet_t _tthe_t _tnumber_t _tof_t _tReaction_t_t _tstructures_t _tin_t _tthe_t _tgiven_t _tModel_t_t ...
Definition Model.cpp:8205
unsigned int Model_getNumParameters(const Model_t *m)
_tGet_t _tthe_t _tnumber_t _tof_t _tParameter_t_t _tstructures_t _tin_t _tthe_t _tgiven_t _tModel_t_t...
Definition Model.cpp:8174
int Model_isSetId(const Model_t *m)
_tPredicate_t _tfor_t _ttesting_t _twhether_t _tthe_t _tidentifier_t _tof_t _ta_t _tgiven_t _tModel_t...
Definition Model.cpp:7234
unsigned int Model_getNumCompartmentTypes(const Model_t *m)
_tGet_t _tthe_t _tnumber_t _tof_t _tCompartmentType_t_t _tstructures_t _tin_t _tthe_t _tgiven_t _tMod...
Definition Model.cpp:8134
unsigned int Model_getNumFunctionDefinitions(const Model_t *m)
_tGet_t _tthe_t _tnumber_t _tof_t _tFunctionDefinition_t_t _tstructures_t _tin_t _tthe_t _tgiven_t _t...
Definition Model.cpp:8118
unsigned int Model_getNumRules(const Model_t *m)
_tGet_t _tthe_t _tnumber_t _tof_t _tRule_t_t _tstructures_t _tin_t _tthe_t _tgiven_t _tModel_t_t _tst...
Definition Model.cpp:8190
unsigned int Model_getNumCompartments(const Model_t *m)
_tGet_t _tthe_t _tnumber_t _tof_t _tCompartment_t_t _tstructures_t _tin_t _tthe_t _tgiven_t _tModel_t...
Definition Model.cpp:8150
unsigned int Model_getNumSpecies(const Model_t *m)
_tGet_t _tthe_t _tnumber_t _tof_t _tSpecies_t_t _tstructures_t _tin_t _tthe_t _tgiven_t _tModel_t_t _...
Definition Model.cpp:8158
unsigned int Model_getNumSpeciesTypes(const Model_t *m)
_tGet_t _tthe_t _tnumber_t _tof_t _tSpeciesType_t_t _tstructures_t _tin_t _tthe_t _tgiven_t _tModel_t...
Definition Model.cpp:8142
unsigned int Model_getNumInitialAssignments(const Model_t *m)
_tGet_t _tthe_t _tnumber_t _tof_t _tInitialAssignment_t_t _tstructures_t _tin_t _tthe_t _tgiven_t _tM...
Definition Model.cpp:8182
unsigned int Model_getNumUnitDefinitions(const Model_t *m)
_tGet_t _tthe_t _tnumber_t _tof_t _tUnitDefinition_t_t _tstructures_t _tin_t _tthe_t _tgiven_t _tMode...
Definition Model.cpp:8126
unsigned int Model_getNumConstraints(const Model_t *m)
_tGet_t _tthe_t _tnumber_t _tof_t _tConstraint_t_t _tstructures_t _tin_t _tthe_t _tgiven_t _tModel_t_...
Definition Model.cpp:8198
unsigned int SBMLDocument_getLevel(const SBMLDocument_t *d)
_tReturns_t _tthe_t _tSBML_t _tLevel_t _tof_t _tthe_t _tgiven_t _tSBMLDocument_t_t _tstructure_t.
Definition SBMLDocument.cpp:2266
void SBMLDocument_printErrors(SBMLDocument_t *d, FILE *stream)
_tPrints_t _tto_t _tthe_t _tgiven_t _toutput_t _tstream_t _tall_t _tthe_t _terrors_t _tor_t _twarning...
Definition SBMLDocument.cpp:2525
void SBMLDocument_free(SBMLDocument_t *d)
_tFrees_t _tthe_t _tgiven_t _tSBMLDocument_t_t _tstructure_t.
Definition SBMLDocument.cpp:2248
Model_t * SBMLDocument_getModel(SBMLDocument_t *d)
_tReturns_t _tthe_t _tModel_t_t _tstructure_t _tstored_t _tin_t _tthis_t _tSBMLDocument_t_t _tstructu...
Definition SBMLDocument.cpp:2290
unsigned int SBMLDocument_getVersion(const SBMLDocument_t *d)
_tReturns_t _tthe_t _tVersion_t _twithin_t _tthe_t _tSBML_t _tLevel_t _tof_t _tthe_t _tgiven_t _tSBML...
Definition SBMLDocument.cpp:2274
SBMLDocument_t * readSBML(const char *filename)
@_tcopydoc_t _tdoc_readsbmlfromfile_t
Definition SBMLReader.cpp:446
Include all SBML types in a single header file.