1 /** 2 * \file TestPackage.h 3 * \brief Mock Package for testing purposes 4 * \author Frank T. Bergmann <fbergman@caltech.edu> 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 #ifndef LIBSBML_EXTENSION_TEST_TESTPACKAGE 43 #define LIBSBML_EXTENSION_TEST_TESTPACKAGE 44 45 #ifdef __cplusplus 46 47 #include <sbml/common/extern.h> 48 #include <sbml/SBMLTypeCodes.h> 49 50 #include <sbml/SBMLErrorLog.h> 51 #include <sbml/Model.h> 52 #include <sbml/xml/XMLInputStream.h> 53 #include <sbml/xml/XMLOutputStream.h> 54 55 #include <sbml/extension/SBMLExtension.h> 56 #include <sbml/extension/SBMLExtensionNamespaces.h> 57 #include <sbml/extension/SBMLExtensionRegister.h> 58 #include <sbml/extension/SBasePlugin.h> 59 60 #include <vector> 61 62 LIBSBML_CPP_NAMESPACE_BEGIN 63 64 class TestExtension : public SBMLExtension 65 { 66 public: 67 68 static const std::string& getPackageName (); 69 static unsigned int getDefaultLevel(); 70 static unsigned int getDefaultVersion(); 71 static unsigned int getDefaultPackageVersion(); 72 static const std::string& getXmlnsL3V1V1 () ; 73 74 TestExtension(); 75 TestExtension(const TestExtension&); 76 virtual ~TestExtension (); 77 TestExtension& operator=(const TestExtension&); 78 virtual TestExtension* clone () const; 79 virtual const std::string& getName() const; 80 81 virtual const std::string& getURI( 82 unsigned int sbmlLevel, 83 unsigned int sbmlVersion, 84 unsigned int pkgVersion) const; 85 86 virtual unsigned int getLevel(const std::string &uri) const; 87 virtual unsigned int getVersion(const std::string &uri) const; 88 virtual unsigned int getPackageVersion(const std::string &uri) const; 89 virtual SBMLNamespaces* getSBMLExtensionNamespaces(const std::string &uri) const; 90 virtual const char* getStringFromTypeCode(int typeCode) const; 91 static void init(); 92 93 }; 94 95 typedef SBMLExtensionNamespaces<TestExtension> TestPkgNamespaces; 96 97 typedef enum 98 { 99 SBML_TEST_TEST = 200 100 } SBMLGroupsTypeCode_t; 101 102 class TestLOSPlugin : public SBasePlugin 103 { 104 public: 105 TestLOSPlugin(const std::string &uri, const std::string &prefix, 106 TestPkgNamespaces *groupsns); 107 TestLOSPlugin(const TestLOSPlugin& orig); 108 virtual ~TestLOSPlugin(); 109 TestLOSPlugin& operator=(const TestLOSPlugin& orig); 110 virtual TestLOSPlugin* clone() const; 111 virtual SBase* createObject(XMLInputStream& stream); 112 virtual void writeElements(XMLOutputStream& stream) const; 113 virtual bool hasRequiredElements() const; 114 115 virtual void setSBMLDocument(SBMLDocument* d); 116 virtual void connectToParent(SBase *sbase); 117 118 virtual void enablePackageInternal(const std::string& pkgURI, 119 const std::string& pkgPrefix, bool flag); 120 const std::string& getValue() const; 121 void setValue(const std::string& value); 122 virtual bool accept(SBMLVisitor& v) const; 123 124 125 protected: 126 std::string mValue; 127 }; 128 129 class TestModelPlugin : public SBasePlugin 130 { 131 public: 132 TestModelPlugin(const std::string &uri, const std::string &prefix, 133 TestPkgNamespaces *groupsns); 134 TestModelPlugin(const TestModelPlugin& orig); 135 virtual ~TestModelPlugin(); 136 TestModelPlugin& operator=(const TestModelPlugin& orig); 137 virtual TestModelPlugin* clone() const; 138 virtual SBase* createObject(XMLInputStream& stream); 139 virtual void writeElements(XMLOutputStream& stream) const; 140 virtual bool hasRequiredElements() const; 141 142 virtual void setSBMLDocument(SBMLDocument* d); 143 virtual void connectToParent(SBase *sbase); 144 145 virtual void enablePackageInternal(const std::string& pkgURI, 146 const std::string& pkgPrefix, bool flag); 147 const std::string& getValue() const; 148 void setValue(const std::string& value); 149 virtual bool accept (SBMLVisitor& v) const; 150 151 152 protected: 153 std::string mValue; 154 }; 155 LIBSBML_CPP_NAMESPACE_END 156 #endif //__cplusplus 157 #endif //LIBSBML_EXTENSION_TEST_TESTPACKAGE 158