1 /** 2 * @file SBMLLocalParameterConverter.h 3 * @brief Definition of SBMLLocalParameterConverter, a converter replacing local parameters with global ones 4 * @author Frank Bergmann 5 * 6 * <!-------------------------------------------------------------------------- 7 * This file is part of libSBML. Please visit http://sbml.org for more 8 * information about SBML, and the latest version of libSBML. 9 * 10 * Copyright (C) 2020 jointly by the following organizations: 11 * 1. California Institute of Technology, Pasadena, CA, USA 12 * 2. University of Heidelberg, Heidelberg, Germany 13 * 3. University College London, London, UK 14 * 15 * Copyright (C) 2019 jointly by the following organizations: 16 * 1. California Institute of Technology, Pasadena, CA, USA 17 * 2. University of Heidelberg, Heidelberg, Germany 18 * 19 * Copyright (C) 2013-2018 jointly by the following organizations: 20 * 1. California Institute of Technology, Pasadena, CA, USA 21 * 2. EMBL European Bioinformatics Institute (EMBL-EBI), Hinxton, UK 22 * 3. University of Heidelberg, Heidelberg, Germany 23 * 24 * Copyright (C) 2009-2013 jointly by the following organizations: 25 * 1. California Institute of Technology, Pasadena, CA, USA 26 * 2. EMBL European Bioinformatics Institute (EMBL-EBI), Hinxton, UK 27 * 28 * Copyright (C) 2006-2008 by the California Institute of Technology, 29 * Pasadena, CA, USA 30 * 31 * Copyright (C) 2002-2005 jointly by the following organizations: 32 * 1. California Institute of Technology, Pasadena, CA, USA 33 * 2. Japan Science and Technology Agency, Japan 34 * 35 * This library is free software; you can redistribute it and/or modify it 36 * under the terms of the GNU Lesser General Public License as published by 37 * the Free Software Foundation. A copy of the license agreement is provided 38 * in the file named "LICENSE.txt" included with this software distribution 39 * and also available online as http://sbml.org/software/libsbml/license.html 40 * ------------------------------------------------------------------------ --> 41 * 42 * @class SBMLLocalParameterConverter 43 * @sbmlbrief{core} Converter to turn local parameters into global ones. 44 * 45 * @htmlinclude libsbml-facility-only-warning.html 46 * 47 * This converter essentially promotes local parameters to global parameters. 48 * It works by examining every Reaction object for LocalParameter objects, 49 * then creating Parameter objects on the model for each one found, and 50 * finally removing the original LocalParameter objects. It creates new 51 * identifiers for the fresh Parameter objects by concatenating the 52 * identifier of the reaction with the identifier of the original 53 * LocalParameter object. 54 * 55 * This converter can be useful for software applications that do not have 56 * the ability to handle local parameters on reactions. Such applications 57 * could check incoming models for local parameters and run those models 58 * through this converter before proceeding with other steps. 59 * 60 * @section SBMLLocalParameterConverter-usage Configuration and use of SBMLLocalParameterConverter 61 * 62 * SBMLLocalParameterConverter is enabled by creating a ConversionProperties 63 * object with the option @c "promoteLocalParameters", and passing this 64 * properties object to SBMLDocument::convert(@if java 65 * ConversionProperties@endif). The converter offers no other options. 66 * 67 * @copydetails doc_section_using_sbml_converters 68 */ 69 70 #ifndef SBMLLocalParameterConverter_h 71 #define SBMLLocalParameterConverter_h 72 73 #include <sbml/SBMLNamespaces.h> 74 #include <sbml/conversion/SBMLConverter.h> 75 #include <sbml/conversion/SBMLConverterRegister.h> 76 77 78 #ifdef __cplusplus 79 80 81 LIBSBML_CPP_NAMESPACE_BEGIN 82 83 84 class LIBSBML_EXTERN SBMLLocalParameterConverter : public SBMLConverter 85 { 86 public: 87 88 /** @cond doxygenLibsbmlInternal */ 89 /** 90 * Register with the ConversionRegistry. 91 */ 92 static void init(); 93 94 /** @endcond */ 95 96 97 /** 98 * Creates a new SBMLLocalParameterConverter object. 99 */ 100 SBMLLocalParameterConverter(); 101 102 103 /** 104 * Copy constructor; creates a copy of an SBMLLocalParameterConverter 105 * object. 106 * 107 * @param obj the SBMLLocalParameterConverter object to copy. 108 */ 109 SBMLLocalParameterConverter(const SBMLLocalParameterConverter& obj); 110 111 112 /** 113 * Assignment operator for SBMLLocalParameterConverter. 114 * 115 * @param rhs the object whose values are used as the basis of the 116 * assignment. 117 */ 118 SBMLLocalParameterConverter& operator=(const SBMLLocalParameterConverter& rhs); 119 120 121 /** 122 * Creates and returns a deep copy of this SBMLLocalParameterConverter 123 * object. 124 * 125 * @return a (deep) copy of this converter. 126 */ 127 virtual SBMLLocalParameterConverter* clone() const; 128 129 130 /** 131 * Destroy this SBMLLocalParameterConverter object. 132 */ 133 virtual ~SBMLLocalParameterConverter (); 134 135 136 /** 137 * Returns @c true if this converter object's properties match the given 138 * properties. 139 * 140 * A typical use of this method involves creating a ConversionProperties 141 * object, setting the options desired, and then calling this method on 142 * an SBMLLocalParameterConverter object to find out if the object's 143 * property values match the given ones. This method is also used by 144 * SBMLConverterRegistry::getConverterFor(@if java ConversionProperties@endif) 145 * to search across all registered converters for one matching particular 146 * properties. 147 * 148 * @param props the properties to match. 149 * 150 * @return @c true if this converter's properties match, @c false 151 * otherwise. 152 */ 153 virtual bool matchesProperties(const ConversionProperties &props) const; 154 155 156 /** 157 * Perform the conversion. 158 * 159 * This method causes the converter to do the actual conversion work, 160 * that is, to convert the SBMLDocument object set by 161 * SBMLConverter::setDocument(@if java SBMLDocument@endif) and 162 * with the configuration options set by 163 * SBMLConverter::setProperties(@if java ConversionProperties@endif). 164 * 165 * @copydetails doc_returns_success_code 166 * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} 167 * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} 168 * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} 169 */ 170 virtual int convert(); 171 172 173 /** 174 * Returns the default properties of this converter. 175 * 176 * A given converter exposes one or more properties that can be adjusted 177 * in order to influence the behavior of the converter. This method 178 * returns the @em default property settings for this converter. It is 179 * meant to be called in order to discover all the settings for the 180 * converter object. 181 * 182 * @return the ConversionProperties object describing the default properties 183 * for this converter. 184 */ 185 virtual ConversionProperties getDefaultProperties() const; 186 187 }; 188 189 LIBSBML_CPP_NAMESPACE_END 190 191 #endif /* __cplusplus */ 192 193 194 #ifndef SWIG 195 196 LIBSBML_CPP_NAMESPACE_BEGIN 197 BEGIN_C_DECLS 198 199 200 END_C_DECLS 201 LIBSBML_CPP_NAMESPACE_END 202 203 #endif /* !SWIG */ 204 #endif /* SBMLLocalParameterConverter_h */ 205 206