diff --git a/.gitignore b/.gitignore index bf4b3cc..eb68fad 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,9 @@ doc *.bak *.user -.idea/ \ No newline at end of file +.idea/ +.vs +.vscode +build +temp_deviser_file.xml +.DS_Store diff --git a/VERSION.txt b/VERSION.txt index ee1372d..7179039 100644 --- a/VERSION.txt +++ b/VERSION.txt @@ -1 +1 @@ -0.2.2 +0.2.3 diff --git a/dev/combine-archive.xml b/dev/combine-archive.xml index 1ad011f..d9a513d 100644 --- a/dev/combine-archive.xml +++ b/dev/combine-archive.xml @@ -1,10 +1,10 @@ - + - - - + + + @@ -14,6 +14,7 @@ + @@ -21,6 +22,11 @@ + + + + + diff --git a/dev/generated/CMakeLists.txt b/dev/generated/CMakeLists.txt index d4e0e1f..713c1f8 100644 --- a/dev/generated/CMakeLists.txt +++ b/dev/generated/CMakeLists.txt @@ -40,7 +40,7 @@ if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/VERSION.txt") endif() MATH(EXPR LIBCOMBINE_VERSION_NUMERIC "${LIBCOMBINE_VERSION_MAJOR} * 10000 + ${LIBCOMBINE_VERSION_MINOR} * 100 + ${LIBCOMBINE_VERSION_PATCH}" ) -set(LIBCOMBINE_VERSION "${LIBCOMBINE_VERSION_MAJOR}.${LIBCOMBINE_VERSION_MINOR}.${LIBCOMBINE_VERSION_PATCH}${LIBCOMBINE_VERSION_RELEASE}") +set(PACKAGE_VERSION "${LIBCOMBINE_VERSION_MAJOR}.${LIBCOMBINE_VERSION_MINOR}.${LIBCOMBINE_VERSION_PATCH}${LIBCOMBINE_VERSION_RELEASE}") set(PACKAGE_NAME "libCombine") # add make dist and make check target as they are already familiar for @@ -69,16 +69,19 @@ set(CPACK_RPM_PACKAGE_LICENSE "BSD") set(CPACK_RPM_PACKAGE_GROUP "Libraries/Development") set(CPACK_DEBIAN_PACKAGE_SECTION "Libraries") -set(CPACK_SOURCE_IGNORE_FILES "${CMAKE_CURRENT_BINARY_DIR};/.svn/;/.libs/;/.deps/;/.bzr/;.*.o$;.*.lo$;.*.la$;/.git/;${CPACK_SOURCE_IGNORE_FILES};/.DS_Store;/.svnignore;blib;libsbml-dist;*.txt.user") +set(CPACK_SOURCE_IGNORE_FILES "${CMAKE_CURRENT_BINARY_DIR};/out/;/.git/;/.svn/;/.libs/;/.deps/;/.bzr/;.*.pyc$;.*.o$;.*.lo$;.*.la$;${CPACK_SOURCE_IGNORE_FILES};/.DS_Store;/.svnignore;blib;libcombine-dist") + +if(UNIX) + set(CPACK_INSTALL_PREFIX "${CMAKE_INSTALL_PREFIX}") + set(CPACK_SET_DESTDIR "ON") +endif() -set(ADDITIONAL_LIB_DIRS) if(CMAKE_SIZEOF_VOID_P EQUAL 4) set(CPACK_DEBIAN_PACKAGE_ARCHITECTURE "i386") set(CPACK_RPM_PACKAGE_ARCHITECTURE "i386") else() set(CPACK_DEBIAN_PACKAGE_ARCHITECTURE "amd64") set(CPACK_RPM_PACKAGE_ARCHITECTURE "x86_64") - set(ADDITIONAL_LIB_DIRS "/usr/lib64" "/usr/lib/x86_64-linux-gnu/") endif() include(CPack) @@ -173,8 +176,6 @@ if("${LIBCOMBINE_DEPENDENCY_DIR}" STREQUAL "") "Directory containing libraries that libCombine depends upon. (Particularly important on Windows.)" FORCE) endif() -set(LIBCOMBINE_ROOT_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}) -set(LIBCOMBINE_ROOT_BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR}) ############################################################################### # @@ -191,6 +192,9 @@ if(WITH_SWIG) find_program(SWIG_EXECUTABLE NAMES swig PATHS + c:/swigwin-3.0.12 + c:/swigwin-3.0.10 + c:/swigwin-3.0.8 c:/swigwin-3.0.5 c:/swigwin-3.0.2 c:/swigwin-3.0.0 @@ -385,13 +389,13 @@ if(UNIX OR CYGWIN) set(PATH_SEP "/") set(FILE_SEP ":") set( MISC_PREFIX "share/libcombine/" ) - set(LIBCOMBINE_LIBRARY omex) + set(LIBCOMBINE_LIBRARY combine) else() set( MISC_PREFIX "" ) set(PATH_SEP "\\") set(FILE_SEP ";") if(MINGW) - set(LIBCOMBINE_LIBRARY omex) + set(LIBCOMBINE_LIBRARY combine) else() set(LIBCOMBINE_LIBRARY libcombine) endif() @@ -474,11 +478,11 @@ if(UNIX) set(BUILD_DEFINITIONS "${BUILD_DEFINITIONS} -DLINUX") endif(APPLE) - add_definitions( -DPACKAGE_VERSION=\"${LIBCOMBINE_VERSION}\" -DPACKAGE_NAME=\"${PROJECT_NAME}\") - set(BUILD_DEFINITIONS "${BUILD_DEFINITIONS} -DPACKAGE_VERSION=\"${LIBCOMBINE_VERSION}\" -DPACKAGE_NAME=\"${PROJECT_NAME}\"") + add_definitions( -DPACKAGE_VERSION=\"${PACKAGE_VERSION}\" -DPACKAGE_NAME=\"${PROJECT_NAME}\") + set(BUILD_DEFINITIONS "${BUILD_DEFINITIONS} -DPACKAGE_VERSION=\"${PACKAGE_VERSION}\" -DPACKAGE_NAME=\"${PROJECT_NAME}\"") else(UNIX) - add_definitions(-DPACKAGE_VERSION=\"${LIBCOMBINE_VERSION}\" -DPACKAGE_NAME=\"${PROJECT_NAME}\") + add_definitions(-DPACKAGE_VERSION=\"${PACKAGE_VERSION}\" -DPACKAGE_NAME=\"${PROJECT_NAME}\") add_definitions(-DWIN32) set(BUILD_DEFINITIONS "${BUILD_DEFINITIONS} -DWIN32") @@ -576,7 +580,7 @@ endif() ############################################################################### # -# Initialize OMEX sources +# Initialize LIBCOMBINE sources # set(LIBCOMBINE_SOURCES) @@ -665,6 +669,7 @@ add_subdirectory(src/bindings) + ############################################################################### # # Build examples if specified @@ -708,16 +713,14 @@ endif() message(STATUS " ---------------------------------------------------------------------- -libCombine version ${LIBCOMBINE_VERSION} +libCombine version ${PACKAGE_VERSION} ---------------------------------------------------------------------- More information and the latest version are available online at - https://github.com/fbergmann/libCombine/ Please report problems using the issue tracker at - https://github.com/fbergmann/libCombine/issues - To contact the developers directly, email fbergman@caltech.edu + To contact the developers directly, email sbml-team@caltech.edu Configured on host '${HOSTNAME}' host type = ${CMAKE_SYSTEM_NAME} diff --git a/dev/generated/src/CMakeLists.txt b/dev/generated/src/CMakeLists.txt index 58029ee..73a2e72 100644 --- a/dev/generated/src/CMakeLists.txt +++ b/dev/generated/src/CMakeLists.txt @@ -84,7 +84,7 @@ configure_file( ${CMAKE_CURRENT_BINARY_DIR}/omex/common/libcombine-config-common.h ) -# Replace: @LIBCOMBINE_VERSION@ and @LIBCOMBINE_VERSION_NUMERIC@ +# Replace: @PACKAGE_VERSION@ and @LIBCOMBINE_VERSION_NUMERIC@ configure_file ( "${CMAKE_CURRENT_SOURCE_DIR}/omex/common/libcombine-version.h.cmake" "${CMAKE_CURRENT_BINARY_DIR}/omex/common/libcombine-version.h" @@ -95,10 +95,6 @@ configure_file ( "${CMAKE_CURRENT_BINARY_DIR}/omex/common/libcombine-namespace.h" ) -configure_file ( - "${CMAKE_CURRENT_SOURCE_DIR}/omex/common/libcombine-package.h.cmake" - "${CMAKE_CURRENT_BINARY_DIR}/omex/common/libcombine-package.h" -) ############################################################################### # diff --git a/dev/generated/src/bindings/csharp/AssemblyInfo.cs.in b/dev/generated/src/bindings/csharp/AssemblyInfo.cs.in index d60aa50..e57cdac 100644 --- a/dev/generated/src/bindings/csharp/AssemblyInfo.cs.in +++ b/dev/generated/src/bindings/csharp/AssemblyInfo.cs.in @@ -2,12 +2,12 @@ using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; -[assembly: AssemblyTitle("libCombine C# Binding Proxy Class DLL")] +[assembly: AssemblyTitle("libSEDML C# Binding Proxy Class DLL")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("The SBML Team")] -[assembly: AssemblyProduct("libcombinecsP.dll")] -[assembly: AssemblyCopyright("Copyright (C) 2016 SBML Team")] +[assembly: AssemblyCompany("The SEDML Team")] +[assembly: AssemblyProduct("libsedmlcsP.dll")] +[assembly: AssemblyCopyright("Copyright (C) Frank T. Bergmann 2013")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] diff --git a/dev/generated/src/bindings/csharp/compile-native-files.cmake b/dev/generated/src/bindings/csharp/compile-native-files.cmake index ff1ef5e..4480277 100644 --- a/dev/generated/src/bindings/csharp/compile-native-files.cmake +++ b/dev/generated/src/bindings/csharp/compile-native-files.cmake @@ -7,7 +7,11 @@ # This file is part of libSBML. Please visit http://sbml.org for more # information about SBML, and the latest version of libSBML. # - # Copyright (C) 2013-2016 jointly by the following organizations: + # Copyright (C) 2019 jointly by the following organizations: + # 1. California Institute of Technology, Pasadena, CA, USA + # 2. University of Heidelberg, Heidelberg, Germany + # + # Copyright (C) 2013-2018 jointly by the following organizations: # 1. California Institute of Technology, Pasadena, CA, USA # 2. EMBL European Bioinformatics Institute (EMBL-EBI), Hinxton, UK # 3. University of Heidelberg, Heidelberg, Germany diff --git a/dev/generated/src/bindings/csharp/libcombine.i b/dev/generated/src/bindings/csharp/libcombine.i index fb4f2ff..67d0f97 100644 --- a/dev/generated/src/bindings/csharp/libcombine.i +++ b/dev/generated/src/bindings/csharp/libcombine.i @@ -7,7 +7,11 @@ * This file is part of libSBML. Please visit http://sbml.org for more * information about SBML, and the latest version of libSBML. * - * Copyright (C) 2013-2016 jointly by the following organizations: + * Copyright (C) 2019 jointly by the following organizations: + * 1. California Institute of Technology, Pasadena, CA, USA + * 2. University of Heidelberg, Heidelberg, Germany + * + * Copyright (C) 2013-2018 jointly by the following organizations: * 1. California Institute of Technology, Pasadena, CA, USA * 2. EMBL European Bioinformatics Institute (EMBL-EBI), Hinxton, UK * 3. University of Heidelberg, Heidelberg, Germany diff --git a/dev/generated/src/bindings/csharp/local.cpp b/dev/generated/src/bindings/csharp/local.cpp index 0a62872..8b0b5c3 100644 --- a/dev/generated/src/bindings/csharp/local.cpp +++ b/dev/generated/src/bindings/csharp/local.cpp @@ -7,7 +7,11 @@ * This file is part of libSBML. Please visit http://sbml.org for more * information about SBML, and the latest version of libSBML. * - * Copyright (C) 2013-2016 jointly by the following organizations: + * Copyright (C) 2019 jointly by the following organizations: + * 1. California Institute of Technology, Pasadena, CA, USA + * 2. University of Heidelberg, Heidelberg, Germany + * + * Copyright (C) 2013-2018 jointly by the following organizations: * 1. California Institute of Technology, Pasadena, CA, USA * 2. EMBL European Bioinformatics Institute (EMBL-EBI), Hinxton, UK * 3. University of Heidelberg, Heidelberg, Germany diff --git a/dev/generated/src/bindings/csharp/local.i b/dev/generated/src/bindings/csharp/local.i index 701e269..bc88384 100644 --- a/dev/generated/src/bindings/csharp/local.i +++ b/dev/generated/src/bindings/csharp/local.i @@ -7,7 +7,11 @@ * This file is part of libSBML. Please visit http://sbml.org for more * information about SBML, and the latest version of libSBML. * - * Copyright (C) 2013-2016 jointly by the following organizations: + * Copyright (C) 2019 jointly by the following organizations: + * 1. California Institute of Technology, Pasadena, CA, USA + * 2. University of Heidelberg, Heidelberg, Germany + * + * Copyright (C) 2013-2018 jointly by the following organizations: * 1. California Institute of Technology, Pasadena, CA, USA * 2. EMBL European Bioinformatics Institute (EMBL-EBI), Hinxton, UK * 3. University of Heidelberg, Heidelberg, Germany @@ -201,6 +205,9 @@ SWIGCSHARP_IMTYPE_WSTRING(const char*) case (int) libcombine.LIB_COMBINE_CONTENT: return new CaContent(cPtr, owner); + case (int) libcombine.OMEX_COMBINE_CROSSREF: + return new CaCrossRef(cPtr, owner); + case (int) libcombine.OMEX_LIST_OF: String name = sb.getElementName(); if(name == "listOf") @@ -211,6 +218,10 @@ SWIGCSHARP_IMTYPE_WSTRING(const char*) { return new CaListOfContents(cPtr, owner); } + else if (name == "listOfCrossRefs") + { + return new CaListOfCrossRefs(cPtr, owner); + } return new CaListOf(cPtr, owner); @@ -551,7 +562,9 @@ COVARIANT_RTYPE_CLONE(CaConstructorException) COVARIANT_RTYPE_CLONE(CaNamespaces) COVARIANT_RTYPE_CLONE(CaContent) COVARIANT_RTYPE_CLONE(CaOmexManifest) +COVARIANT_RTYPE_CLONE(CaCrossRef) COVARIANT_RTYPE_CLONE(CaListOfContents) +COVARIANT_RTYPE_CLONE(CaListOfCrossRefs) /** * @@ -601,6 +614,7 @@ COVARIANT_RTYPE_LISTOF_GET_REMOVE(Unit) %csmethodmodifiers ListOfLocalParameters::remove(unsigned int n) "public new" COVARIANT_RTYPE_LISTOF_GET_REMOVE(CaListOfContents) +COVARIANT_RTYPE_LISTOF_GET_REMOVE(CaListOfCrossRefs) %define COVARIANT_GETID(_CNAME_) %typemap(cstype) string _CNAME_ ## ::getId "_CNAME_" @@ -733,7 +747,9 @@ COVARIANT_RTYPE_LISTOF_GET_REMOVE(CaListOfContents) SEDMLCONSTRUCTOR_EXCEPTION(CaContent) SEDMLCONSTRUCTOR_EXCEPTION(CaOmexManifest) +SEDMLCONSTRUCTOR_EXCEPTION(CaCrossRef) SEDMLCONSTRUCTOR_EXCEPTION(CaListOfContents) +SEDMLCONSTRUCTOR_EXCEPTION(CaListOfCrossRefs) %define XMLCONSTRUCTOR_EXCEPTION(SBASE_CLASS_NAME) %exception SBASE_CLASS_NAME diff --git a/dev/generated/src/bindings/java/CMakeLists.txt b/dev/generated/src/bindings/java/CMakeLists.txt new file mode 100644 index 0000000..d96989b --- /dev/null +++ b/dev/generated/src/bindings/java/CMakeLists.txt @@ -0,0 +1,183 @@ +find_package(SWIG REQUIRED) +find_package(JNI) +find_package(Java COMPONENTS Development REQUIRED) +include(${SWIG_USE_FILE}) + + +#################################################################### +# +# create manifest file +# +configure_file ( + "${CMAKE_CURRENT_SOURCE_DIR}/Manifest.txt.in" + "${CMAKE_CURRENT_BINARY_DIR}/Manifest.txt" + ) + +#################################################################### +# +# ensure that javac, jar and python are available +# + +if (NOT EXISTS "${Java_JAVAC_EXECUTABLE}") + if (NOT EXISTS "${JAVA_COMPILE}") + message(FATAL_ERROR "The java language bindings require Java_JAVAC_EXECUTABLE to be set to the javac command.") + else() + SET(Java_JAVAC_EXECUTABLE "${JAVA_COMPILE}" CACHE STRING "Javac compiler" FORCE) + endif() +endif() + + +if (NOT EXISTS "${Java_JAR_EXECUTABLE}") + if (NOT EXISTS "${JAVA_ARCHIVE}") + message(FATAL_ERROR "The java language bindings require Java_JAR_EXECUTABLE to be set to the jar command.") + else() + set (Java_JAR_EXECUTABLE "${JAVA_ARCHIVE}" CACHE STRING "jar command" FORCE) + endif() +endif() + + +#################################################################### +# +# determine local dependencies, so as to re-swig if one of them changed +# + +file(GLOB SWIG_DEPENDENCIES + ${CMAKE_CURRENT_SOURCE_DIR}/*.i + ${CMAKE_CURRENT_SOURCE_DIR}/*.h + ${CMAKE_CURRENT_SOURCE_DIR}/*.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/../swig/*.i + ${CMAKE_CURRENT_SOURCE_DIR}/../swig/*.h + ) + + +# +# Determine the installation directory +# +set(JAVA_PACKAGE_BIN_INSTALL_DIR) +set(JAVA_PACKAGE_JAR_INSTALL_DIR) +if (UNIX OR CYGWIN) + set(JAVA_PACKAGE_BIN_INSTALL_DIR ${CMAKE_INSTALL_LIBDIR}) + set(JAVA_PACKAGE_JAR_INSTALL_DIR ${CMAKE_INSTALL_PREFIX}/share/java) +else() + set(JAVA_PACKAGE_BIN_INSTALL_DIR ${MISC_PREFIX}bindings/java) + set(JAVA_PACKAGE_JAR_INSTALL_DIR ${MISC_PREFIX}bindings/java) +endif() + +# +# Remove SWIG wrappers if requested +# +if (LIBCOMBINE_REMOVE_WRAPPERS) + foreach(file + ${CMAKE_CURRENT_BINARY_DIR}/libcombine_wrap.cpp + ) + if (EXISTS ${file}) + FILE(REMOVE ${file}) + endif() + endforeach() +endif(LIBCOMBINE_REMOVE_WRAPPERS) + + +set(SWIG_EXTRA_FLAGS -DSWIGEXPORT + -DLIBSBML_CPP_NAMESPACE_BEGIN -DLIBSBML_CPP_NAMESPACE_END -DLIBSBML_CPP_NAMESPACE_QUALIFIER -DLIBSBML_CPP_NAMESPACE_USE + -DLIBNUML_CPP_NAMESPACE_BEGIN -DLIBNUML_CPP_NAMESPACE_END -DLIBNUML_CPP_NAMESPACE_QUALIFIER -DLIBNUML_CPP_NAMESPACE_USE + ) +if(NOT UNIX) + set(SWIG_EXTRA_FLAGS ${SWIG_EXTRA_FLAGS} -DSWIGWIN -DSWIG_CSHARP_NO_WSTRING_HELPER ) +endif() + + +#################################################################### +# +# Swig bindings +# +# +ADD_CUSTOM_COMMAND( + OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/libcombine_wrap.cpp + ${CMAKE_CURRENT_BINARY_DIR}/java-files/org/omex/libcombine/libcombineJNI.java + COMMAND "${CMAKE_COMMAND}" + ARGS -E make_directory ${CMAKE_CURRENT_BINARY_DIR}/java-files/org/omex/libcombine + COMMAND "${SWIG_EXECUTABLE}" + ARGS -I${CMAKE_CURRENT_SOURCE_DIR}/../swig/ + -I${CMAKE_CURRENT_SOURCE_DIR}/../../ + -I${CMAKE_CURRENT_BINARY_DIR}/../../ + -I${CMAKE_CURRENT_SOURCE_DIR}/../../omex + -I${CMAKE_CURRENT_SOURCE_DIR} + -I${LIBSBML_INCLUDE_DIR}/ + -c++ + -java + -package org.omex.libcombine + ${SWIG_EXTRA_ARGS} + ${SWIG_EXTRA_FLAGS} + -outdir ${CMAKE_CURRENT_BINARY_DIR}/java-files/org/omex/libcombine + -o ${CMAKE_CURRENT_BINARY_DIR}/libcombine_wrap.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/../swig/libcombine.i + MAIN_DEPENDENCY ${CMAKE_CURRENT_SOURCE_DIR}/../swig/libcombine.i + DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt + ${SWIG_DEPENDENCIES} + COMMENT "Swig Java source") + +add_custom_target(binding_java_swig ALL DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/libcombine_wrap.cpp) + + +include_directories(${CMAKE_CURRENT_SOURCE_DIR}) +include_directories(${CMAKE_CURRENT_SOURCE_DIR}/../swig) +include_directories(${LIBSBML_INCLUDE_DIR}) +include_directories(BEFORE ${CMAKE_CURRENT_SOURCE_DIR}/../..) +include_directories(BEFORE ${CMAKE_CURRENT_BINARY_DIR}/../../) +add_definitions(-DLIBCOMBINE_STATIC) +if (EXTRA_INCLUDE_DIRS) + include_directories(${EXTRA_INCLUDE_DIRS}) +endif(EXTRA_INCLUDE_DIRS) + +# if additional directories are set be sure to include them +if (JNI_INCLUDE_DIRS) +include_directories(${JNI_INCLUDE_DIRS}) +endif(JNI_INCLUDE_DIRS) +if (JAVA_INCLUDE_PATH) +include_directories(${JAVA_INCLUDE_PATH}) +endif(JAVA_INCLUDE_PATH) +if (JAVA_INCLUDE_PATH2) +include_directories(${JAVA_INCLUDE_PATH2}) +endif(JAVA_INCLUDE_PATH2) + + +add_library(binding_java_lib SHARED ${CMAKE_CURRENT_BINARY_DIR}/libcombine_wrap.cpp ) +add_dependencies( binding_java_lib binding_java_swig) +set_target_properties (binding_java_lib PROPERTIES OUTPUT_NAME "omexj") + + +if(APPLE) + set_target_properties (binding_java_lib PROPERTIES SUFFIX ".jnilib") +endif() + +install(TARGETS binding_java_lib DESTINATION ${JAVA_PACKAGE_BIN_INSTALL_DIR} ) + +target_link_libraries(binding_java_lib ${LIBCOMBINE_LIBRARY}-static ) + +ADD_CUSTOM_COMMAND( + OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/libcombinej.jar + COMMAND "${CMAKE_COMMAND}" + ARGS -E make_directory ${CMAKE_CURRENT_BINARY_DIR}/test + COMMAND "${CMAKE_COMMAND}" + ARGS -DJava_JAVAC_EXECUTABLE=\"${Java_JAVAC_EXECUTABLE}\" + -DJava_JAR_EXECUTABLE=\"${Java_JAR_EXECUTABLE}\" + -DBIN_DIRECTORY=\"${CMAKE_CURRENT_BINARY_DIR}\" + -DSRC_DIRECTORY=\"${CMAKE_CURRENT_SOURCE_DIR}\" + -DFILE_SEP=\"${FILE_SEP}\" + -DPATH_SEP=${PATH_SEP} + -P "${CMAKE_CURRENT_SOURCE_DIR}/compile-native-files.cmake" + + WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}" + COMMENT "Building: libcombine.jar" + ) + +add_custom_target(binding_java_jar ALL DEPENDS + ${CMAKE_CURRENT_BINARY_DIR}/libcombinej.jar + ${CMAKE_CURRENT_BINARY_DIR}/java-files/org/omex/libcombine/libcombineJNI.java + ) + +add_dependencies(binding_java_jar binding_java_swig) + +install(FILES ${CMAKE_CURRENT_BINARY_DIR}/libcombinej.jar DESTINATION ${JAVA_PACKAGE_JAR_INSTALL_DIR}) + + diff --git a/dev/generated/src/bindings/java/Manifest.txt.in b/dev/generated/src/bindings/java/Manifest.txt.in new file mode 100644 index 0000000..9d383aa --- /dev/null +++ b/dev/generated/src/bindings/java/Manifest.txt.in @@ -0,0 +1,4 @@ +Name: org.sedml.libcombine +Implementation-Title: "@PACKAGE_NAME@ Java API" +Implementation-Version: "@LIBCOMBINE_VERSION@" +Implementation-Vendor: "Frank T. Bergmann" diff --git a/dev/generated/src/bindings/java/compile-native-files.cmake b/dev/generated/src/bindings/java/compile-native-files.cmake new file mode 100644 index 0000000..35f3de6 --- /dev/null +++ b/dev/generated/src/bindings/java/compile-native-files.cmake @@ -0,0 +1,87 @@ +################################################# + # @file compile-native-files.cmake + # @brief Base file + # @author DEVISER + # + # + # + + +message("Creating: libcombine.jar") + +# find all sources +file(GLOB_RECURSE SOURCE_FILES RELATIVE ${BIN_DIRECTORY} ${BIN_DIRECTORY}/java-files/org/omex/libcombine/*.java) + +# convert paths +set(NATIVE_FILES) +foreach(javaFile ${SOURCE_FILES}) + file(TO_NATIVE_PATH ${javaFile} temp) + set(NATIVE_FILES ${NATIVE_FILES} ${temp}) +endforeach() + +# delete file if it exists +if (EXISTS ${BIN_DIRECTORY}/libcombine.jar) + file(REMOVE ${BIN_DIRECTORY}/libcombine.jar) +endif() + +# compile files +execute_process( + COMMAND "${Java_JAVAC_EXECUTABLE}" + -source 1.5 + -target 1.5 + -d java-files + ${NATIVE_FILES} + WORKING_DIRECTORY "${BIN_DIRECTORY}" +) + +# enumerate class files +file(GLOB_RECURSE CLASS_FILES RELATIVE ${BIN_DIRECTORY}/java-files ${BIN_DIRECTORY}/java-files/org/omex/libcombine/*.class) +set(NATIVE_CLASS_FILES) +foreach(classFile ${CLASS_FILES}) + file(TO_NATIVE_PATH ${classFile} temp) + set(NATIVE_CLASS_FILES ${NATIVE_CLASS_FILES} ${temp}) +endforeach() + +# create jar +execute_process( + COMMAND "${Java_JAR_EXECUTABLE}" + -cvfm ..${PATH_SEP}libcombinej.jar + ../Manifest.txt + ${NATIVE_CLASS_FILES} + WORKING_DIRECTORY "${BIN_DIRECTORY}/java-files" +) + +# # print variables for debug purposes +# message("BIN_DIRECTORY : ${BIN_DIRECTORY}") +# message("Java_JAVAC_EXECUTABLE : ${Java_JAVAC_EXECUTABLE}") +# message("Java_JAR_EXECUTABLE : ${Java_JAR_EXECUTABLE}") + diff --git a/dev/generated/src/bindings/java/libcombine.i b/dev/generated/src/bindings/java/libcombine.i new file mode 100644 index 0000000..67d0f97 --- /dev/null +++ b/dev/generated/src/bindings/java/libcombine.i @@ -0,0 +1,40 @@ +/** + * @file libcombine.i + * @brief Base file + * @author DEVISER + * + * + */ + + + +%include "../swig/libcombine.i" diff --git a/dev/generated/src/bindings/java/local.cpp b/dev/generated/src/bindings/java/local.cpp new file mode 100644 index 0000000..19093c8 --- /dev/null +++ b/dev/generated/src/bindings/java/local.cpp @@ -0,0 +1,297 @@ +/** + * @file local.cpp + * @brief Implementation of the local class. + * @author DEVISER + * + * + */ + + + + +//-------------------------------------------------------------------------------- +// (Currently (2008-07-25), this file is used only for Windows) +// +// Utility functions for converting encodings between Unicode (wide char), +// UTF8 and ANSI CP (multibyte char) +// +// 1) char* convertUnicodeToUTF8(const wchar_t* src_wstr) +// 2) char* convertUnicodeToACP(const wchar_t* src_wstr) +// 3) wchar_t* convertUTF8ToUnicode(const char* src_str) +// 4) char* convertACPToUTF8(const char* src_str) +// 5) char* convertUTF8ToACP(const char* src_str) +// +//-------------------------------------------------------------------------------- + +#ifdef WIN32 + +// do not include MFC +#define WIN32_LEAN_AND_MEAN +// do not include GDI by default +#define NOGDI + +#include +#include + +// +// convert Unicode -> UTF8 (for Windows) +// +char* convertUnicodeToUTF8(const wchar_t* src_wstr) +{ + int length; + int clength; + char* sbuf; + + // + // Unicode -> UTF8 + // + + // + // Check wbuf length + // + length = WideCharToMultiByte(CP_UTF8, 0, (LPCWSTR)src_wstr, -1, NULL, 0, NULL, NULL); + + if(length == 0){ + return NULL; + } + + sbuf = new char[length+1]; + + // + // Convert + // + clength = WideCharToMultiByte(CP_UTF8, 0, (LPCWSTR)src_wstr, -1, sbuf, length, NULL, NULL); + sbuf[clength] = 0; + + if(clength == 0){ + delete [] sbuf; + return NULL; + } + + return sbuf; +} + + +// +// convert Unicode -> ANSI CP (for Windows) +// +char* convertUnicodeToACP(const wchar_t* src_wstr) +{ + int length; + int clength; + char* sbuf; + + // + // Unicode -> ANSI CP + // + + // + // Check wbuf length + // + length = WideCharToMultiByte(CP_ACP, 0, (LPCWSTR)src_wstr, -1, NULL, 0, NULL, NULL); + + if(length == 0){ + return NULL; + } + + sbuf = new char[length+1]; + + // + // Convert + // + clength = WideCharToMultiByte(CP_ACP, 0, (LPCWSTR)src_wstr, -1, sbuf, length, NULL, NULL); + sbuf[clength] = 0; + + if(clength == 0){ + delete [] sbuf; + return NULL; + } + + return sbuf; +} + + +// +// convert UTF8 -> Unicode (for Windows) +// +wchar_t* convertUTF8ToUnicode(const char* src_str) +{ + int length; + int c_length; + wchar_t* wbuf; + + // + // UTF8 -> Unicode + // + + // Check src_str length + length = MultiByteToWideChar(CP_UTF8, 0, (LPCSTR)src_str, -1, NULL, 0); + if(length == 0){ + return NULL; + } + + wbuf = new wchar_t[length+1]; + + // Convert + c_length = MultiByteToWideChar(CP_UTF8, 0, (LPCSTR)src_str, -1, wbuf, length); + wbuf[c_length] = 0; + if(c_length == 0) { + delete [] wbuf; + return NULL; + } + + return wbuf; + +} + + +// +// convert ANSI CP -> UTF8 for Windows +// +char* convertACPToUTF8(const char* src_str) +{ + int length; + int c_length; + wchar_t* wbuf; + char* ubuf; + + // + // ANSI CP -> Unicode + // + + // Check src_str length + length = MultiByteToWideChar(CP_ACP, 0, (LPCSTR)src_str, -1, NULL, 0); + if(length == 0){ + return NULL; + } + + wbuf = new wchar_t[length+1]; + + // Convert + c_length = MultiByteToWideChar(CP_ACP, 0,(LPCSTR)src_str,-1,wbuf,length); + wbuf[c_length] = 0; + + if(c_length == 0) { + delete [] wbuf; + return NULL; + } + + // + // Unicode -> UTF8 + // + + // Check wbuf length + length = WideCharToMultiByte(CP_UTF8, 0, (LPCWSTR)wbuf,-1,NULL,0,NULL,NULL); + + if(length == 0){ + delete [] wbuf; + return NULL; + } + + ubuf = new char[length+1]; + + // Convert + c_length = WideCharToMultiByte(CP_UTF8, 0, (LPCWSTR)wbuf,-1,ubuf,length,NULL,NULL); + ubuf[c_length] = 0; + + if(c_length == 0){ + delete [] wbuf; + delete [] ubuf; + return NULL; + } + + delete [] wbuf; + return ubuf; + +} + + +// +// convert UTF8 -> ANSI CP for Windows +// +char* convertUTF8ToACP(const char* src_str) +{ + int length; + int c_length; + wchar_t* wbuf; + char* ubuf; + + // + // UTF8 -> Unicode + // + + // Check src_str length + length = MultiByteToWideChar(CP_UTF8, 0, (LPCSTR)src_str, -1, NULL, 0); + if(length == 0){ + return NULL; + } + + wbuf = new wchar_t[length+1]; + + // Convert + c_length = MultiByteToWideChar(CP_UTF8, 0,(LPCSTR)src_str,-1,wbuf,length); + wbuf[c_length] = 0; + if(c_length == 0) { + delete [] wbuf; + return NULL; + } + + // + // Unicode -> ANSI CP + // + + // Check wbuf length + length = WideCharToMultiByte(CP_ACP, 0, (LPCWSTR)wbuf,-1,NULL,0,NULL,NULL); + + if(length == 0){ + delete [] wbuf; + return NULL; + } + + ubuf = new char[length+1]; + + // Convert + c_length = WideCharToMultiByte(CP_ACP, 0, (LPCWSTR)wbuf,-1,ubuf,length,NULL,NULL); + ubuf[c_length] = 0; + + if(c_length == 0){ + delete [] wbuf; + delete [] ubuf; + return NULL; + } + + delete [] wbuf; + return ubuf; + +} + +#endif // WIN32 diff --git a/dev/generated/src/bindings/java/local.i b/dev/generated/src/bindings/java/local.i new file mode 100644 index 0000000..1dae360 --- /dev/null +++ b/dev/generated/src/bindings/java/local.i @@ -0,0 +1,1043 @@ +/** + * @file local.i + * @brief Base file + * @author DEVISER + * + * + */ + + +%include "std_string.i" +%include "std_wstring.i" + +%include "exception.i" +%include + +%include "enumsimple.swg" + + +/** +* Renames *::clone() to *::cloneObject(). +* In JDK 1.4.2, libcombine's *::clone() methods can't override +* "Object Java.lang.Object.clone()" because JDK 1.4.2 doesn't +* allow override with different return type. +* +* (2008-12-07) +* Currently, JDK 1.5 or later, which allows a covariant return type, +* is required for libCombine Java binding, and thus we don't have to use +* this rename directive. However, this directive is still enabled for +* compatiblity. +*/ + +%rename(cloneObject) *::clone; + +/** +* Rename XMLNode::equals() to XMLNode::xmlEquals(), otherwise it conflicts with the +* equals operation defined below +*/ +%rename(xmlEquals) XMLNode::equals; +/** +* Rename ASTNode::getClass() to ASTNode::getClassName(), otherwise it conflicts +*/ +%rename(getClassName) ASTNode::getClass; +%rename(setClassName) ASTNode::setClass; + +/** +* Wraps covariant return types of ::clone functions. +* +* Currently, SWIG doesn't allow a covariant return type although +* JDK 1.5 or later supports it. +* Thus, the following directives are required to enable the +* covariant return type. +*/ + +#pragma SWIG nowarn=822 + +%define COVARIANT_RTYPE_CLONE(_CNAME_) +%typemap(jstype) _CNAME_* _CNAME_::clone "_CNAME_" +%enddef + +COVARIANT_RTYPE_CLONE(Compartment) +COVARIANT_RTYPE_CLONE(CompartmentType) +COVARIANT_RTYPE_CLONE(Constraint) +COVARIANT_RTYPE_CLONE(Delay) +COVARIANT_RTYPE_CLONE(Event) +COVARIANT_RTYPE_CLONE(EventAssignment) +COVARIANT_RTYPE_CLONE(FunctionDefinition) +COVARIANT_RTYPE_CLONE(InitialAssignment) +COVARIANT_RTYPE_CLONE(KineticLaw) +COVARIANT_RTYPE_CLONE(Model) +COVARIANT_RTYPE_CLONE(Parameter) +COVARIANT_RTYPE_CLONE(Priority) +COVARIANT_RTYPE_CLONE(LocalParameter) +COVARIANT_RTYPE_CLONE(Reaction) +COVARIANT_RTYPE_CLONE(Rule) +COVARIANT_RTYPE_CLONE(AlgebraicRule) +COVARIANT_RTYPE_CLONE(AssignmentRule) +COVARIANT_RTYPE_CLONE(RateRule) +COVARIANT_RTYPE_CLONE(Species) +COVARIANT_RTYPE_CLONE(SpeciesReference) +COVARIANT_RTYPE_CLONE(SpeciesType) +COVARIANT_RTYPE_CLONE(StoichiometryMath) +COVARIANT_RTYPE_CLONE(Trigger) +COVARIANT_RTYPE_CLONE(Unit) +COVARIANT_RTYPE_CLONE(UnitDefinition) +COVARIANT_RTYPE_CLONE(ListOf) +COVARIANT_RTYPE_CLONE(ListOfCompartmentTypes) +COVARIANT_RTYPE_CLONE(ListOfCompartments) +COVARIANT_RTYPE_CLONE(ListOfConstraints) +COVARIANT_RTYPE_CLONE(ListOfEventAssignments) +COVARIANT_RTYPE_CLONE(ListOfEvents) +COVARIANT_RTYPE_CLONE(ListOfFunctionDefinitions) +COVARIANT_RTYPE_CLONE(ListOfInitialAssignments) +COVARIANT_RTYPE_CLONE(ListOfParameters) +COVARIANT_RTYPE_CLONE(ListOfLocalParameters) +COVARIANT_RTYPE_CLONE(ListOfReactions) +COVARIANT_RTYPE_CLONE(ListOfRules) +COVARIANT_RTYPE_CLONE(ListOfSpecies) +COVARIANT_RTYPE_CLONE(ListOfSpeciesReferences) +COVARIANT_RTYPE_CLONE(ListOfSpeciesTypes) +COVARIANT_RTYPE_CLONE(ListOfUnitDefinitions) +COVARIANT_RTYPE_CLONE(ListOfUnits) +COVARIANT_RTYPE_CLONE(CaConstructorException) +COVARIANT_RTYPE_CLONE(CaNamespaces) +COVARIANT_RTYPE_CLONE(CaContent) +COVARIANT_RTYPE_CLONE(CaOmexManifest) +COVARIANT_RTYPE_CLONE(CaCrossRef) +COVARIANT_RTYPE_CLONE(CaListOfContents) +COVARIANT_RTYPE_CLONE(CaListOfCrossRefs) + + + +/** +* +* Wraps covariant return types of ListOfXXX::get functions. +* +*/ + +%define COVARIANT_RTYPE_LISTOF_GET_REMOVE(_CNAME_) +%typemap(jstype) _CNAME_* ListOf ## _CNAME_ ## s::get "_CNAME_" +%typemap(jstype) _CNAME_* ListOf ## _CNAME_ ## s::remove "_CNAME_" +%enddef + +COVARIANT_RTYPE_LISTOF_GET_REMOVE(CompartmentType) +COVARIANT_RTYPE_LISTOF_GET_REMOVE(Compartment) +COVARIANT_RTYPE_LISTOF_GET_REMOVE(EventAssignment) +COVARIANT_RTYPE_LISTOF_GET_REMOVE(Event) +COVARIANT_RTYPE_LISTOF_GET_REMOVE(FunctionDefinition) +COVARIANT_RTYPE_LISTOF_GET_REMOVE(InitialAssignment) +COVARIANT_RTYPE_LISTOF_GET_REMOVE(LocalParameter) +COVARIANT_RTYPE_LISTOF_GET_REMOVE(Parameter) +COVARIANT_RTYPE_LISTOF_GET_REMOVE(Reaction) +COVARIANT_RTYPE_LISTOF_GET_REMOVE(Rule) +COVARIANT_RTYPE_LISTOF_GET_REMOVE(SpeciesType) +COVARIANT_RTYPE_LISTOF_GET_REMOVE(UnitDefinition) +COVARIANT_RTYPE_LISTOF_GET_REMOVE(Constraint) +COVARIANT_RTYPE_LISTOF_GET_REMOVE(Unit) + +// Only ListOfSpecies and ListOfSpeciesReference classes do not +// match the above macro... +%typemap(jstype) Species* ListOfSpecies::get "Species" +%typemap(jstype) Species* ListOfSpecies::remove "Species" +%typemap(jstype) SimpleSpeciesReference* ListOfSpeciesReferences::get "SimpleSpeciesReference" +%typemap(jstype) SimpleSpeciesReference* ListOfSpeciesReferences::remove "SimpleSpeciesReference" + + +COVARIANT_RTYPE_LISTOF_GET_REMOVE(CaListOfContents) +COVARIANT_RTYPE_LISTOF_GET_REMOVE(CaListOfCrossRefs) + +/** +* Wraps the CaConstructorException +* +* The CaConstructorException (C++ class) is wrapped as the +* CaConstructorException (Java class) which is derived from +* the built-in IllegalArgumentException class which is a subclass +* of RunTimeException. +* +* For example, the exception can be catched in Java code as follows: +* +* --------------------------------------------- +* try +* { +* Model s = new Model(level,version); +* } +* catch (CaConstructorException e) +* { +* String errmsg = e.getMessage(); +* } +* --------------------------------------------- +*/ + +%ignore CaConstructorException::CaConstructorException(std::string); + +%typemap(javabase) CaConstructorException "java.lang.IllegalArgumentException"; +%typemap(javacode) CaConstructorException +%{ + protected CaConstructorException(long cPtr, boolean cMemoryOwn, String v) + { + super(v); + swigCMemOwn = cMemoryOwn; + swigCPtr = cPtr; + } + + /** +* Exception thrown by libCombine object constructors if something prevents +* the object from being properly created. +* +* An example of what can cause this exception to be thrown is attempting +* to create an Ca component with an invalid Ca Level/Version +* combination. +*/ + public CaConstructorException(String v) + { + this(libcombineJNI.new_CaConstructorException__SWIG_0(), true, v); + } + %} + +%define SEDMLCONSTRUCTOR_EXCEPTION(SBASE_CLASS_NAME) +%javaexception("org.omex.libcombine.CaConstructorException") SBASE_CLASS_NAME +%{ + try { + $action + } + catch (const CaConstructorException &e) { + jenv->ExceptionClear(); + jclass clazz = jenv->FindClass("org/omex/libcombine/CaConstructorException"); + if (clazz) + jenv->ThrowNew(clazz, e.what()); + return $null; + } + %} +%enddef + +SEDMLCONSTRUCTOR_EXCEPTION(CaContent) +SEDMLCONSTRUCTOR_EXCEPTION(CaOmexManifest) +SEDMLCONSTRUCTOR_EXCEPTION(CaCrossRef) +SEDMLCONSTRUCTOR_EXCEPTION(CaListOfContents) +SEDMLCONSTRUCTOR_EXCEPTION(CaListOfCrossRefs) + + + +/** +* Wraps the XMLConstructorException +* +* The XMLConstructorException (C++ class) is wrapped as the +* XMLConstructorException (Java class) which is derived from +* the built-in IllegalArgumentException class which is a subclass +* of RunTimeException. +* +* For example, the exception can be catched in Java code as follows: +* +* --------------------------------------------- +* try +* { +* Model s = new Model(level,version); +* } +* catch (XMLConstructorException e) +* { +* String errmsg = e.getMessage(); +* } +* --------------------------------------------- +*/ + +%typemap(javabase) XMLConstructorException "java.lang.IllegalArgumentException"; +%typemap(javacode) XMLConstructorException +%{ + /* +* To pass the message from an exception to the parent exception class, +* we have to create our own variant of the constructor that takes an +* extra string argument. +*/ + protected XMLConstructorException(long cPtr, boolean cMemoryOwn, String v) + { + super(v); + swigCMemOwn = cMemoryOwn; + swigCPtr = cPtr; + } + + /* +* Next, we define the public constructor to take a string (like all basic +* Java exception class constructors), and invoke our internal special +* constructor with the extra argument. +*/ + public XMLConstructorException(String v) + { + this(libcombineJNI.new_XMLConstructorException(), true, v); + } + %} + +/* +* Finally, to make our string-passing constructor work, we have to disable +* the default constructor created by SWIG in newer versions of SWIG. +*/ +%ignore XMLConstructorException(std::string message); + +/* +* The following creates a macro used to wrap individual class constructors +* that may throw XMLConstructorException. +*/ +%define XMLCONSTRUCTOR_EXCEPTION(SBASE_CLASS_NAME) +%javaexception("org.omex.libcombine.XMLConstructorException") SBASE_CLASS_NAME +%{ + try { + $action + } + catch (const XMLConstructorException &e) { + jenv->ExceptionClear(); + jclass clazz = jenv->FindClass("org/omex/libcombine/XMLConstructorException"); + if (clazz) + jenv->ThrowNew(clazz, e.what()); + return $null; + } + %} +%enddef + + +XMLCONSTRUCTOR_EXCEPTION(XMLAttributes) +XMLCONSTRUCTOR_EXCEPTION(XMLError) +XMLCONSTRUCTOR_EXCEPTION(XMLNamespaces) +XMLCONSTRUCTOR_EXCEPTION(XMLNode) +XMLCONSTRUCTOR_EXCEPTION(XMLOutputStream) +XMLCONSTRUCTOR_EXCEPTION(XMLToken) +XMLCONSTRUCTOR_EXCEPTION(XMLTripple) + + +/** +* Ignores XMLToken::clone() in order to use XMLNode::clone(). +* (XMLNode is a derived class of XMLToken) +* In JDK 1.4.2, "XMLNode XMLNode::clone()" can't override +* "XMLToken XMLToken::clone()" because JDK 1.4.2 doesn't +* allow override with different return type. +*/ + +//%javamethodmodifiers XMLToken::clone "private" + +/** +* Ignores XMLErrorLog::getError(unsigned int) in order to use +* CaErrorLog::getError(unsigned int). +* (XMLErrorLog is a derived class of CaErrorLog) +* In JDK 1.4.2, "CaError* CaErrorLog::getError(unsigned int)" +* can't override "XMLError* XMLErrorLog::getError(unsigned int)" +* due to the above mentioned reason. +*/ + +//%javamethodmodifiers XMLErrorLog::getError "private" + +/** +* Turns off object destruction. For testing purposes only. +* +* FIXME: Disable for the final 3.0 release. +*/ +/* +%typemap (javafinalize) SWIGTYPE %{ %} +*/ + + +/** +* Make most libCombine constants (e.g. CaTypecodes) Java compile-time +* constants so they may be used in switch statements. +*/ +%include "enumsimple.swg" +%javaconst(1); + + +/** +* A bug in Swig prevents these four ASTNode constants being generated +* as Java compile-time constants. Swig does not parse the following +* enum correctly: +* +* typedef enum +* { +* AST_PLUS = '+' +* , AST_MINUS = '-' +* , AST_TIMES = '*' +* , AST_DIVIDE = '/' +* , AST_POWER = '^' +* +* +* The generated Java code does not like the tick marks ('). To fix +* this, we need to be explicit about (and duplicate) the value of +* the constants here. +*/ + +%javaconstvalue("'+'") AST_PLUS; +%javaconstvalue("'-'") AST_MINUS; +%javaconstvalue("'*'") AST_TIMES; +%javaconstvalue("'/'") AST_DIVIDE; +%javaconstvalue("'^'") AST_POWER; + + + +/** +* @return the most specific Java object possible for the given CaBase +* object. +*/ +%pragma(java) modulecode = +%{ + + + /** +* Internal method. +* +* @internal +*/ + public static CaBase DowncastCaBase(long cPtr, boolean owner) + { + if (cPtr == 0) return null; + + CaBase sb = new CaBase(cPtr, false); + switch( sb.getTypeCode() ) + { + case (int) libcombine.LIB_COMBINE_OMEXMANIFEST: + return new CaOmexManifest(cPtr, owner); + + case (int) libcombine.LIB_COMBINE_CONTENT: + return new CaContent(cPtr, owner); + + case (int) libcombine.OMEX_COMBINE_CROSSREF: + return new CaCrossRef(cPtr, owner); + + case (int) libcombine.OMEX_LIST_OF: + String name = sb.getElementName(); + if(name.equals("listOf")) + { + return new CaListOf(cPtr, owner); + } + else if (name == "listOfContents") + { + return new CaListOfContents(cPtr, owner); + } + else if (name == "listOfCrossRefs") + { + return new CaListOfCrossRefs(cPtr, owner); + } + + return new CaListOf(cPtr, owner); + + default: + return new CaBase(cPtr, owner); + } + + } + %} + + + +/** +* Convert CaBase objects into the most specific object possible. +*/ +%typemap("javaout") CaBase* +{ + return libcombine.DowncastCaBase($jnicall, $owner); +} + + +/** +* getCPtrAndDisown() is like getCPtr() but it also sets the SWIG memory +* ownsership flag to false. +* +* We used to use %typemap(javagetcptr), but this has been deprecated +* in SWIG 1.3.24. Instead we add getCPtrAndDisown() from the incantation +* below (taken from the SWIG 1.3.24 CHANGES file). +*/ + +/* Utility macro for manipulating the Java body code method attributes */ +%define SWIGJAVA_ATTRIBS(TYPENAME, CTOR_ATTRIB, GETCPTR_ATTRIB) + +%typemap(javabody) TYPENAME +%{ + private long swigCPtr; + protected boolean swigCMemOwn; + + CTOR_ATTRIB $javaclassname(long cPtr, boolean cMemoryOwn) + { + swigCMemOwn = cMemoryOwn; + swigCPtr = cPtr; + } + + GETCPTR_ATTRIB static long getCPtr($javaclassname obj) + { + return (obj == null) ? 0 : obj.swigCPtr; + } + + GETCPTR_ATTRIB static long getCPtrAndDisown ($javaclassname obj) + { + long ptr = 0; + + if (obj != null) + { + ptr = obj.swigCPtr; + obj.swigCMemOwn = false; + } + + return ptr; + } + %} + + +#if SWIG_VERSION >= 0x020000 + +%typemap(javabody_derived) TYPENAME +%{ + private long swigCPtr; + + CTOR_ATTRIB $javaclassname(long cPtr, boolean cMemoryOwn) + { + super($moduleJNI.$javaclassname_SWIGUpcast(cPtr), cMemoryOwn); + swigCPtr = cPtr; + } + + GETCPTR_ATTRIB static long getCPtr($javaclassname obj) + { + return (obj == null) ? 0 : obj.swigCPtr; + } + + GETCPTR_ATTRIB static long getCPtrAndDisown ($javaclassname obj) + { + long ptr = 0; + + if (obj != null) + { + ptr = obj.swigCPtr; + obj.swigCMemOwn = false; + } + + return ptr; + } + %} + +#else + +%typemap(javabody_derived) TYPENAME +%{ + private long swigCPtr; + + CTOR_ATTRIB $javaclassname(long cPtr, boolean cMemoryOwn) + { + super($moduleJNI.SWIG$javaclassnameUpcast(cPtr), cMemoryOwn); + swigCPtr = cPtr; + } + + GETCPTR_ATTRIB static long getCPtr($javaclassname obj) + { + return (obj == null) ? 0 : obj.swigCPtr; + } + + GETCPTR_ATTRIB static long getCPtrAndDisown ($javaclassname obj) + { + long ptr = 0; + + if (obj != null) + { + ptr = obj.swigCPtr; + obj.swigCMemOwn = false; + } + + return ptr; + } + %} + +#endif + +%enddef + +/* The default is protected getCPtr, protected constructor */ +SWIGJAVA_ATTRIBS(SWIGTYPE, protected, protected) + +/* Public getCPtr method, protected constructor */ +%define PUBLIC_GETCPTR(TYPENAME) +SWIGJAVA_ATTRIBS(TYPENAME, protected, public) +%enddef + +/* Public getCPtr method, public constructor */ +%define PUBLIC_BODYMETHODS(TYPENAME) +SWIGJAVA_ATTRIBS(TYPENAME, public, public) +%enddef + +/** +* +* Overrides the 'equals' method for CaBase subclasses and other classes +* in libcombine. +* +* By default, 'equals' method ( and '==' operator) for each wrapped class +* object returns 'true' if the given two objects refer to the same +* *Java proxy object* (not the underlying C++ object). +* For example, the following code returns 'true'. +* +* Model m = new Model(); +* m.createReaction(); +* Reaction r1 = m.getReaction(0); +* Reaction r2 = r1; +* return r1.equals(r2); <---- this returns 'true' +* +* On the other hand, the following code returns 'false' in spite of +* the same underlying C++ objects. +* +* Model m = new Model(); +* m.createReaction(); +* Reaction r1 = m.getReaction(0); +* Reaction r2 = m.getReaction(0); +* return r1.equals(r2); <---- this returns 'false' +* +* The following override changes the behaviour of 'equals' method such that +* returns 'true' if the given two objects refer to the same underlying C++ +* object (i.e. 'true' is returned in the both above examples). +* +* (Unfortunately, '==' operator can't be overidden in Java. +* Thus, the underlying C++ objects can't be compared by the '==' operator.) +* +*/ + +%define SWIGJAVA_EQUALS(CLASS) +%typemap("javacode") CLASS +%{ + /** +* Equality comparison method for CLASS. +*

+* Because the Java methods for libCombine are actually wrappers around code +* implemented in C++ and C, certain operations will not behave as +* expected. Equality comparison is one such case. An instance of a +* libCombine object class is actually a proxy object +* wrapping the real underlying C/C++ object. The normal == +* equality operator in Java will only compare the Java proxy objects, +* not the underlying native object. The result is almost never what you +* want in practical situations. Unfortunately, Java does not provide a +* way to override ==. +*

+* The alternative that must be followed is to use the +* equals() method. The equals method on this +* class overrides the default java.lang.Object one, and performs an +* intelligent comparison of instances of objects of this class. The +* result is an assessment of whether two libCombine Java objects are truly +* the same underlying native-code objects. +*

+* The use of this method in practice is the same as the use of any other +* Java equals method. For example, +* a.equals(b) returns +* true if a and b are references to the +* same underlying object. +* +* @param sb a reference to an object to which the current object +* instance will be compared +* +* @return true if sb refers to the same underlying +* native object as this one, false otherwise +*/ + public boolean equals(Object sb) + { + if ( this == sb ) + { + return true; + } + return swigCPtr == getCPtr((CLASS)(sb)); + } + + /** +* Returns a hashcode for this CLASS object. +* +* @return a hash code usable by Java methods that need them. +*/ + public int hashCode() + { + return (int)(swigCPtr^(swigCPtr>>>32)); + } + %} +%enddef + +SWIGJAVA_EQUALS(CaBase) +SWIGJAVA_EQUALS(CaReader) +SWIGJAVA_EQUALS(CaWriter) +SWIGJAVA_EQUALS(ASTNode) +SWIGJAVA_EQUALS(CVTerm) +SWIGJAVA_EQUALS(Date) +SWIGJAVA_EQUALS(ModelHistory) +SWIGJAVA_EQUALS(ModelCreator) +SWIGJAVA_EQUALS(XMLNamespaces) +SWIGJAVA_EQUALS(CaNamespaces) +SWIGJAVA_EQUALS(XMLAttributes) +SWIGJAVA_EQUALS(XMLToken) +SWIGJAVA_EQUALS(XMLNode) +SWIGJAVA_EQUALS(XMLTriple) +SWIGJAVA_EQUALS(XMLError) +SWIGJAVA_EQUALS(XMLErrorLog) +SWIGJAVA_EQUALS(XMLOutputStream) + +/** +* Part of libCombine methods takeover ownership of passed-in objects, so we need +* to make sure SWIG disowns the object. +* (Most libCombine methods don't takeover ownership since 3.0.0) +* +*/ + +/** +* takeover ownership +* +* - void CaListOf::appendAndOwn(CaBase* item) +*/ +%typemap(javain) CaBase* item "CaBase.getCPtrAndDisown($javainput)"; +%typemap(javain) const CaBase* item "CaBase.getCPtr($javainput)"; + +/** +* takeover ownership +* +* - void ASTNode::addChild (ASTNode* child) +* - void ASTNode::prependChild (ASTNode* child) +*/ +%typemap(javain) ASTNode* child "ASTNode.getCPtrAndDisown($javainput)"; +%typemap(javain) const ASTNode* child "ASTNode.getCPtr($javainput)"; + +/** +* takeover ownership +* +* - void ASTNode::insertChild (unsigned int n, ASTNode *newChild) +* - void ASTNode::replaceChild(unsigned int n, ASTNode *newChild) +*/ +%typemap(javain) ASTNode* newChild "ASTNode.getCPtrAndDisown($javainput)"; +%typemap(javain) const ASTNode* newChild "ASTNode.getCPtr($javainput)"; + +/** +* takeover ownership +* +* - void ASTNode::addSemanticsAnnotation (XMLNode* sAnnotation); +*/ +%typemap(javain) XMLNode* sAnnotation "XMLNode.getCPtrAndDisown($javainput)"; +%typemap(javain) const XMLNode* sAnnotation "XMLNode.getCPtr($javainput)"; + + +/** +* On Windows, a string for filename should be encoded by ANSI CP +* instead of UTF-8 because file I/O APIs internally used in libCombine +* requires an ANSI CP encoded string for the given filename. +* +* 1) CaReader::readOMEX(const std::string& filename) +* 2) readOMEX(const char* filename) +* 3) CaWriter::writeOMEX(CaOmexManifest*, const std::string& filename) +* 4) writeOMEX(CaOmexManifest*, const char* filename) +*/ + +// +// UTF8 -> ANSI CP (for const std::string& filename) +// +%typemap("in") const std::string& filename (const char* arg_pstr, std::string arg_str) +%{ + if(!$input) { + SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "null std::string"); + return $null; + } + arg_pstr = (char const *)jenv->GetStringUTFChars($input, 0); + if (!arg_pstr) return $null; +#ifdef WIN32 + char* mbstr = convertUTF8ToACP(arg_pstr); + if (!mbstr) + { + jenv->ReleaseStringUTFChars($input, arg_pstr); + return $null; + } + + arg_str.assign(mbstr); + delete[] mbstr; +#else + arg_str.assign(arg_pstr); +#endif + $1 = &arg_str; + jenv->ReleaseStringUTFChars($input, arg_pstr); + + %} + + + +// +// Unicode -> ANSI CP (for const char* filename) +// +%typemap("in") const char* filename (const char* arg_pstr) +%{ + if ($input) { + arg_pstr = (char const *)jenv->GetStringUTFChars($input, 0); + if (!arg_pstr) return $null; + } + else + { + arg_pstr = 0; + } +#ifdef WIN32 + $1 = convertUTF8ToACP(arg_pstr); + if (!$1) + { + jenv->ReleaseStringUTFChars($input, (const char*)arg_pstr); + return $null; + } + jenv->ReleaseStringUTFChars($input, (const char*)arg_pstr); +#else + $1 = (char*)arg_pstr; +#endif + %} + +%typemap("freearg") const char* filename +%{ +#ifdef WIN32 + delete[] $1; +#else + if ($1) jenv->ReleaseStringUTFChars($input, (const char*)$1); +#endif + %} + + +/** +* Some combinations of platforms and underlying XML parsers *require* +* an absolute path to a filename while others do not. It's best to +* hide this from the end-user by making CaReader.readOMEX() and +* readOMEX() always compute an absolute path and filename. +*/ + +%pragma(java) modulecode = +%{ + static String getAbsolutePath(String filename) + { + java.io.File file = new java.io.File(filename); + return file.getAbsolutePath(); + } + %} + +%typemap("javain") const std::string& filename "libcombine.getAbsolutePath($javainput)"; +%typemap("javain") const char* filename "libcombine.getAbsolutePath($javainput)"; + +/** +* Wraps std::ostream by implementing three simple wrapper classes. +* +* 1) OStream wraps std::cout, std::cerr, and std::clog. +* The following public final static variables are provied in +* libcombine class like in C++. +* +* 1. public final static OStream cout; +* 2. public final static OStream cerr; +* 3. public final static OStream clog; +* +* 2) OFStream (derived class of OStream) wraps std::ofstream +* with ios_base::cout (default) or ios_base::app flag. +* +* 3) OStringStream (derived class of OStream) wraps std::ostringstream. +* +* These wrapper classes provide only the minimum functions. +* +* (sample code) ----------------------------------------------------- +* +* 1. wraps std::cout +* +* XMLOutputStream xos = new XMLOutputStream(libcombine.cout); +* +* 2. wraps std::cerr +* +* CaOmexManifest d = libcombine.readOMEX("foo.xml"); +* if ( d.getNumErrors() > 0) { +* d.printErrors(libcombine.cerr); +* } +* +* 3. wraps std::ofstream (write to file "foo.xml") +* +* OFStream ofs = new OFStream("foo.xml"); +* CaOmexManifest d = libcombine.readOMEX("foo.xml"); +* CaWriter w = new CaWriter(); +* w.writeOMEX(d,ofs); +* +* 4. wraps std::ofstream (write to file "foo.xml" with append mode) +* +* OFStream ofs = new OFStream("foo.xml",true); +* XMLOutputStream xos = new XMLOutputStream(ofs); +* +* 5. wraps std::ostringstream +* +* OStringStream oss = new OStringStream(); +* XMLOutputStream xos = new XMLOutputStream(oss); +* ... +* oss.endl(); +* String s = oss.str(); +* +*/ + +%typemap(jstype) std::ostream& "OStream" +%typemap(javain) std::ostream& "SWIGTYPE_p_std__ostream.getCPtr($javainput.get_ostream())"; + +%include "OStream.h" + +%{ +#include "OStream.cpp" + %} + +%pragma(java) modulecode = +%{ + /** +* Stream handle for low-level C++ standard output stream. +*

+* A few libCombine methods accept an argument for indicating where to send +* text string output. An example is the {@link +* CaOmexManifest#printErrors} method. However, the methods use C++ style +* streams and not Java stream objects. The OStream object class in the +* libCombine Java interface provides a wrapper for the underlying C++ +* streams. The present object (cout) is a static final variable that +* can be used directly from your code. An example use might be +* something like this: +*

+*

+* CaOmexManifest document = libcombine.readOMEX("somefile.xml");
+* if (document.getNumErrors() > 0)
+* {
+*     document.printErrors(libcombine.cout);
+*     println("Please correct the above problems first.");
+*     System.exit(1);
+* }
+* +* @see #cerr +* @see #clog +*/ + public final static OStream cout; + + + /** +* Stream handle for low-level C++ standard error stream. +*

+* A few libCombine methods accept an argument for indicating where to send +* text string output. An example is the {@link +* CaOmexManifest#printErrors} method. However, the methods use C++ style +* streams and not Java stream objects. The OStream object class in the +* libCombine Java interface provides a wrapper for the underlying C++ +* streams. The present object (cerr) is a static final variable that +* can be used directly from your code. An example use might be +* something like this: +*

+*

+* CaOmexManifest document = libcombine.readOMEX("somefile.xml");
+* if (document.getNumErrors() > 0)
+* {
+*     document.printErrors(libcombine.cerr);
+*     println("Please correct the above problems first.");
+*     System.exit(1);
+* }
+*

+* By default, most operating systems have have their standard error and +* logging output streams directed to the console/terminal, and this is +* where text messages will be shown. This can usually be redirected +* elsewhere, although how to do this depends on the specific environment +* where the program is running. +* +* @see #cout +* @see #clog +*/ + public final static OStream cerr; + + + /** +* Stream handle for low-level C++ standard logging stream. +*

+* A few libCombine methods accept an argument for indicating where to send +* text string output. An example is the {@link +* CaOmexManifest#printErrors} method. However, the methods use C++ style +* streams and not Java stream objects. The OStream object class in the +* libCombine Java interface provides a wrapper for the underlying C++ +* streams. The present object (clog) is a static final variable that +* can be used directly from your code. An example use might be +* something like this: +*

+*

+* CaOmexManifest document = libcombine.readOMEX("somefile.xml");
+* if (document.getNumErrors() > 0)
+* {
+*     document.printErrors(libcombine.clog);
+*     println("Please correct the above problems first.");
+*     System.exit(1);
+* }
+*

+* By default, most operating systems have have their standard error and +* logging output streams directed to the console/terminal, and this is +* where text messages will be shown. This can usually be redirected +* elsewhere, although how to do this depends on the specific environment +* where the program is running. +* +* @see #cout +* @see #cerr +*/ + public final static OStream clog; + + static { + cout = new OStream(OStream.COUT); + cerr = new OStream(OStream.CERR); + clog = new OStream(OStream.CLOG); + } + + /** +* This private constructor does nothing and never invoked. +* The purpose of this constuctor is to hide a default constructor of this +* class in javadoc documentation. +*/ + private libcombine() {} + + %} + + + +/** +* Wraps the following functions by using the corresponding +* ListWrapper class. +* +* - List* ModelHistory::getListCreators() +* - List* ModelHistory::getListModifiedDates() +* - List* CaBase::getCVTerms() +* - List* CaNamespaces::getSupportedNamespaces() +* +* ListWrapper class is wrapped as TYPENAMEListclass. +* So, the above functions are wrapped as follows: +* +* - ModelCreatorList ModelHistory.getListCreators() +* - DateList ModelHistory.getListModifiedDates() +* - CVTermList CaBase.getCVTerms() +* - CaNamespacseList CaNamespaces.getSupportedNamespaces() +* +*/ + +%define LIST_WRAPPER(_FNAME_,_TYPENAME_) +%typemap(jstype) List* _FNAME_ %{ _TYPENAME_ ## List %} + +%typemap(javaout) List* _FNAME_ +{ + long cPtr = $jnicall; + return (cPtr == 0) ? null : new _TYPENAME_ ## List(cPtr, true); +} + +%typemap(out) List* _FNAME_ +{ + ListWrapper<_TYPENAME_> *listw = ($1 != 0) ? new ListWrapper<_TYPENAME_>($1) : 0; + *( ListWrapper<_TYPENAME_> **)&$result = listw; +} +%enddef + +LIST_WRAPPER(CaBase::getCaListOfAllElements,CaBase) + + diff --git a/dev/generated/src/bindings/python/CMakeLists.txt b/dev/generated/src/bindings/python/CMakeLists.txt new file mode 100644 index 0000000..04f0e9e --- /dev/null +++ b/dev/generated/src/bindings/python/CMakeLists.txt @@ -0,0 +1,146 @@ +find_package(SWIG REQUIRED) +include(${SWIG_USE_FILE}) +find_package(PythonInterp) + +# specify that the same python library should be found +# as the one the selected interpreter uses +set (Python_ADDITIONAL_VERSIONS ${PYTHON_VERSION_STRING}) +find_package(PythonLibs) + + +#################################################################### +# +# determine local dependencies, so as to re-swig if one of them changed +# + +file(GLOB SWIG_DEPENDENCIES + ${CMAKE_CURRENT_SOURCE_DIR}/*.i + ${CMAKE_CURRENT_SOURCE_DIR}/*.h + ${CMAKE_CURRENT_SOURCE_DIR}/*.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/../swig/*.i + ${CMAKE_CURRENT_SOURCE_DIR}/../swig/*.h + ) + +# +# Remove SWIG wrappers if requested +# +if (LIBCOMBINE_REMOVE_WRAPPERS) + foreach(file + ${CMAKE_CURRENT_BINARY_DIR}/libcombine_wrap.cpp + ) + if (EXISTS ${file}) + FILE(REMOVE ${file}) + endif() + endforeach() +endif(LIBCOMBINE_REMOVE_WRAPPERS) + + + +set(SWIG_EXTRA_FLAGS -DSWIGEXPORT + -DLIBSBML_CPP_NAMESPACE_BEGIN -DLIBSBML_CPP_NAMESPACE_END -DLIBSBML_CPP_NAMESPACE_QUALIFIER -DLIBSBML_CPP_NAMESPACE_USE + -DLIBNUML_CPP_NAMESPACE_BEGIN -DLIBNUML_CPP_NAMESPACE_END -DLIBNUML_CPP_NAMESPACE_QUALIFIER -DLIBNUML_CPP_NAMESPACE_USE + ) +if(NOT UNIX) + set(SWIG_EXTRA_FLAGS ${SWIG_EXTRA_FLAGS} -DSWIGWIN -DSWIG_CSHARP_NO_WSTRING_HELPER ) +endif() + + +ADD_CUSTOM_COMMAND( + OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/libcombine_wrap.cpp + COMMAND "${SWIG_EXECUTABLE}" + ARGS -I${CMAKE_CURRENT_SOURCE_DIR}/../swig/ + -I${CMAKE_CURRENT_SOURCE_DIR}/../../ + -I${CMAKE_CURRENT_BINARY_DIR}/../../ + -I${CMAKE_CURRENT_SOURCE_DIR}/../../omex + -I${CMAKE_CURRENT_SOURCE_DIR} + -I${LIBSBML_INCLUDE_DIR}/ + -c++ + -python + ${SWIG_EXTRA_FLAGS} + ${SWIG_EXTRA_ARGS} + -o ${CMAKE_CURRENT_BINARY_DIR}/libcombine_wrap.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/libcombine.i + + + COMMAND "${CMAKE_COMMAND}" + ARGS -DCUR_BIN_DIRECTORY=\"${CMAKE_CURRENT_BINARY_DIR}\" + -DVERSION=\"${LIBCOMBINE_VERSION}\" + -P "${CMAKE_CURRENT_SOURCE_DIR}/add_version.cmake" + + + DEPENDS local.i local.cpp local-contrib.i + COMMENT "Swig Python source") + +add_custom_target(binding_python_swig ALL DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/libcombine_wrap.cpp) + +#################################################################### +# +# Build native library +# + +include_directories(${CMAKE_CURRENT_SOURCE_DIR}) +include_directories(${CMAKE_CURRENT_SOURCE_DIR}/../swig) +include_directories(${LIBSBML_INCLUDE_DIR}) +include_directories(BEFORE ${CMAKE_CURRENT_SOURCE_DIR}/../../) +include_directories(BEFORE ${CMAKE_CURRENT_BINARY_DIR}/../../) +add_definitions(-DLIBCOMBINE_STATIC) +include_directories(${PYTHON_INCLUDE_DIRS}) +if (EXTRA_INCLUDE_DIRS) + include_directories(${EXTRA_INCLUDE_DIRS}) +endif(EXTRA_INCLUDE_DIRS) + +if (MSVC) + # the build fails when compiled with packages as the object file is too + # big adding the big flag makes it work! + add_definitions(/bigobj) +endif(MSVC) + +add_library(binding_python_lib SHARED libcombine_wrap.cpp) +add_dependencies( binding_python_lib binding_python_swig) + +set_target_properties (binding_python_lib PROPERTIES OUTPUT_NAME "_libcombine") +if (UNIX) + set_target_properties (binding_python_lib PROPERTIES PREFIX "") + set_target_properties (binding_python_lib PROPERTIES SUFFIX ".so") +else() + if (CYGWIN) + set_target_properties (binding_python_lib PROPERTIES PREFIX "") + set_target_properties (binding_python_lib PROPERTIES SUFFIX ".dll") + else() + set_target_properties (binding_python_lib PROPERTIES SUFFIX ".pyd") + endif() +endif() + + +if(APPLE OR UNIX) + option (PYTHON_USE_DYNAMIC_LOOKUP + "Do not actually link against the python library, instead use the undefined lookup mechanism, that ." OFF) + mark_as_advanced(PYTHON_USE_DYNAMIC_LOOKUP) +endif(APPLE OR UNIX) + +if (PYTHON_USE_DYNAMIC_LOOKUP) + if (APPLE) + set_target_properties (binding_python_lib PROPERTIES LINK_FLAGS "-undefined dynamic_lookup") + endif() + target_link_libraries(binding_python_lib ${LIBCOMBINE_LIBRARY}-static) +else() + target_link_libraries(binding_python_lib ${LIBCOMBINE_LIBRARY}-static ${PYTHON_LIBRARIES}) +endif() + +# +# Determine the python installation directory +# +set(PYTHON_PACKAGE_INSTALL_DIR) +if (UNIX OR CYGWIN) + execute_process(COMMAND "${PYTHON_EXECUTABLE}" -c "import sys;import platform; sys.stdout.write(platform.python_version()[:3])" + OUTPUT_VARIABLE PYTHON_VERSION) + set(PYTHON_PACKAGE_INSTALL_DIR ${CMAKE_INSTALL_LIBDIR}/python${PYTHON_VERSION}/site-packages) +else() + set(PYTHON_PACKAGE_INSTALL_DIR ${MISC_PREFIX}bindings/python) +endif() + +INSTALL(TARGETS binding_python_lib DESTINATION ${PYTHON_PACKAGE_INSTALL_DIR}/libcombine ) + +file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/libcombine.pth" "libcombine\n") +INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/libcombine.pth DESTINATION ${PYTHON_PACKAGE_INSTALL_DIR}) +INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/libcombine.py DESTINATION ${PYTHON_PACKAGE_INSTALL_DIR}/libcombine ) diff --git a/dev/generated/src/bindings/python/add_version.cmake b/dev/generated/src/bindings/python/add_version.cmake new file mode 100644 index 0000000..4b6da8a --- /dev/null +++ b/dev/generated/src/bindings/python/add_version.cmake @@ -0,0 +1,10 @@ +message("Python: Add Version to generated file") + +if(NOT EXISTS ${CUR_BIN_DIRECTORY}/libcombine.py) + message(FATAL_ERROR " The SWIG wrapper has not yet been created") +else() + file(APPEND ${CUR_BIN_DIRECTORY}/libcombine.py " +global __version__ +__version__ = '${VERSION}' +") +endif() diff --git a/dev/generated/src/bindings/python/libcombine.i b/dev/generated/src/bindings/python/libcombine.i new file mode 100644 index 0000000..eef1cb0 --- /dev/null +++ b/dev/generated/src/bindings/python/libcombine.i @@ -0,0 +1,41 @@ +/** + * @file libcombine.i + * @brief Base file + * @author DEVISER + * + * + */ + + + +%include "../swig/libcombine.i" + diff --git a/dev/generated/src/bindings/python/local-contrib.i b/dev/generated/src/bindings/python/local-contrib.i new file mode 100644 index 0000000..245d13b --- /dev/null +++ b/dev/generated/src/bindings/python/local-contrib.i @@ -0,0 +1,166 @@ +/** + * @file local-contrib.i + * @brief Contributed class that makes using libCombine from python more convenient + * for the time being this only works for python 2.x, but won't break python 3 + * @author Gordon Ball + * + **/ + + +/** + * Metaclass to convert getX/setX methods into python properties. + * This is attached to CaBase and automatically applies for all classes + * which inherit from it. + * + * This does not remove or alter the getX/setX methods. + */ + +%pythoncode %{ + +class AutoProperty(type): + """ + A metaclass for automatically detecting getX/setX methods at class creation + time (not instantiation), and adding properties (directly calling C methods + where possible) to the class dictionary. + """ + def __new__(cls, classname, bases, classdict): + """ + Iterate over the items in the classdict looking for get/set pairs + and declaring them as properties. + """ + + import re + import keyword + + re_mangle = re.compile(r'[A-Za-z][a-z]+|[A-Z]+(?=$|[A-Z0-9])|\d+') + re_id = re.compile(r'^[A-Za-z_][A-Za-z0-9_]*$') + re_getdoc = re.compile(r'^\s*[A-Za-z_][A-Za-z0-9_]*\(self\)') + re_setdoc = re.compile(r'^\s*[A-Za-z_][A-Za-z0-9_]*\(self,[^,)]+\)') + + #convert ACapitalCasedStringXYZ123 -> a_capital_cased_string_xyz_123 + mangle_name = lambda x: ('_'.join(re_mangle.findall(x))).lower() + + get_methods = set() + set_methods = set() + swig_setter = classdict.get('__swig_setmethods__', {}) + + #only search for get/set methods + #we assume that any unset method also has either get or set + #a small number of set without get cases exist so we can't only + #search for get methods + for k, v in classdict.items(): + name = k[3:] + prefix = k[:3] + mangled = mangle_name(name) + if name: + if callable(v): + if re_id.match(mangled) and mangled not in keyword.kwlist: + if prefix == 'get': + get_methods.add(name) + elif prefix == 'set': + set_methods.add(name) + + for name in get_methods | set_methods: + + mangled = mangle_name(name) + + #CaListOfFoobars -> foobars + if mangled.startswith('list_of_'): + mangled = mangled[8:] + + getter = setter = deleter = None + if name in get_methods: + getter = classdict['get'+name] + + #this is a very dirty way of checking if the get method + #requires extra arguments (and hence cannot be a property) + #it should be possible to do this properly in SWIG? + if getter.__doc__: + if not re_getdoc.match(getter.__doc__): + continue + + #use the c-level get function if the python function + #only consists of a call to it + cname = classname + '_get' + name + #test if function is "return _libcombine.CLASS_getNAME(__args__)" + if getter.func_code.co_names == ('_libcombine', cname): + getter = getattr(_libcombine, cname) + + if name in set_methods: + setter = classdict['set'+name] + if setter.__doc__: + if not re_setdoc.match(setter.__doc__): + continue + + cname = classname + '_set' + name + if setter.func_code.co_names == ('_libcombine', cname): + setter = getattr(_libcombine, cname) + #property fget does not get intercepted by __getattr__ + #but fset does, so we implement property setting via + #the __swig_setmethods__ dict + swig_setter[mangled] = setter + + if 'unset' + name in classdict: + deleter = classdict['unset'+name] + if deleter.__doc__: + #like a get method, a delete method should + #only require a self argument + if not re_getdoc.match(deleter.__doc__): + continue + + cname = classname + '_unset' + name + if deleter.func_code.co_names == ('_libcombine', cname): + deleter = getattr(_libcombine, cname) + + if getter or setter or deleter: + #fset is technically redundant since the method is dispatched + #via _swig_setattr rather than through the property due to that + #function not delegating to object.__setattr__ which properly + #handles properties + classdict[mangled] = property(fget=getter, fset=setter, fdel=deleter) + + def __repr__(self): + desc = self.__class__.__name__ + if hasattr(self, '__len__'): + desc += '[%s]' % self.__len__() + if hasattr(self, 'id') and self.id: + desc += ' %s' % self.id + if hasattr(self, 'name') and self.name: + desc += ' "%s"' % self.name + return '<' + desc + '>' + + if classdict.get('__repr__', None) in (_swig_repr, None): + classdict['__repr__'] = __repr__ + + + return type.__new__(cls, classname, bases, classdict) + +%} + +%extend SedBase +{ + %pythoncode + { + __metaclass__ = AutoProperty + } +} diff --git a/dev/generated/src/bindings/python/local.cpp b/dev/generated/src/bindings/python/local.cpp new file mode 100644 index 0000000..30eddb0 --- /dev/null +++ b/dev/generated/src/bindings/python/local.cpp @@ -0,0 +1,93 @@ +/** + * @file local.cpp + * @brief Implementation of the local class. + * @author DEVISER + * + * + */ + + + +#include +#include "omex/CaBase.h" + +/** +* @return the most specific Swig type for the given CaBase object. +*/ +struct swig_type_info* +GetDowncastSwigType (CaBase* sb) +{ + if (sb == 0) return SWIGTYPE_p_CaBase; + + std::string name; + + switch (sb->getTypeCode()) + { + case LIB_COMBINE_OMEXMANIFEST: + return SWIGTYPE_p_CaOmexManifest; + + case LIB_COMBINE_CONTENT: + return SWIGTYPE_p_CaContent; + + case OMEX_COMBINE_CROSSREF: + return SWIGTYPE_p_CaCrossRef; + + case OMEX_LIST_OF: + name = sb->getElementName(); + if(name == "listOf") + { + return SWIGTYPE_p_CaListOf; + } + else if (name == "listOfContents") + { + return SWIGTYPE_p_CaListOfContents; + } + else if (name == "listOfCrossRefs") + { + return SWIGTYPE_p_CaListOfCrossRefs; + } + + return SWIGTYPE_p_CaListOf; + + default: + return SWIGTYPE_p_CaBase; + } + + return SWIGTYPE_p_CaBase; +} + +/* Compatibility bug fix for swig 2.0.7 and Python 3. +* See http://patch-tracker.debian.org/patch/series/view/swig2.0/2.0.7-3/pyint_fromsize_t.diff +*/ +#if (PY_MAJOR_VERSION >= 3) +#define PyInt_FromSize_t(x) PyLong_FromSize_t(x) +#endif diff --git a/dev/generated/src/bindings/python/local.i b/dev/generated/src/bindings/python/local.i new file mode 100644 index 0000000..17455e9 --- /dev/null +++ b/dev/generated/src/bindings/python/local.i @@ -0,0 +1,826 @@ +/** + * @file local.i + * @brief Base file + * @author DEVISER + * + * + */ + + + +/** + * Turn on (minimal) Python docstrings and then append our own. + */ +%feature("autodoc", "1"); + +%include "local-contrib.i" + + +/** + * Wraps std::cout, std::cerr, std::clog, std::ostream, and std::ostringstream, + * + * (sample code) ----------------------------------------------------- + * + * 1. wraps std::cout + * + * xos = libcombine.XMLOutputStream(libcombine.cout) + * + * 2. wraps std::cerr + * + * d = libcombine.readOMEX("foo.xml") + * if d.getNumErrors() > 0 : + * d.printErrors(libcombine.cerr) + * + * + * 3. wraps std::ostringstream + * + * oss = libcombine.ostringstream() + * xos = libcombine.XMLOutputStream(oss) + * ... + * libcombine.endl(oss) + * s = oss.str() + * + */ + +// ignores C++ specific methods in std::string. +%ignore std::basic_string::begin; +%ignore std::basic_string::end; +%ignore std::basic_string::rbegin; +%ignore std::basic_string::rend; +%ignore std::basic_string::get_allocator; +%ignore std::basic_string::capacity; +%ignore std::basic_string::reserve; + +%include +%include +%include + +#pragma SWIG nowarn=509 +%warnfilter(401) basic_ios; + +namespace std +{ + // Template class basic ios + template > + class basic_ios : public ios_base {}; + + // Template class basic_ostream + template > + class basic_ostream : virtual public basic_ios<_CharT, _Traits> + { + public: + explicit + basic_ostream(std::basic_streambuf<_CharT, _Traits>* __sb); + virtual + ~basic_ostream(); + }; + + // Template class basic_ostringstream + template, + typename _Alloc = allocator<_CharT> > + class basic_ostringstream : public basic_ostream<_CharT, _Traits> + { + public: + explicit + basic_ostringstream(std::ios_base::openmode __mode = std::ios_base::out); + ~basic_ostringstream(); + + basic_string<_CharT, _Traits, _Alloc> + str() const; + + void + str(const basic_string<_CharT, _Traits, _Alloc>& __s); + }; + + + /** + * Insert a newline character into the given C++ stream. + * + * This is a wrapper around the underlying C++ OStream method + * endl. It inserts a newline into the stream + * passed as argument. Additionally, it flushes buffered + * streams. + */ + template > + basic_ostream<_CharT, _Traits>& + endl(basic_ostream<_CharT, _Traits>&); + + + /** + * Flush the given C++ stream. + * + * This is a wrapper around the underlying C++ OStream method + * flush. It flush any pending output in the stream + * passed as argument. + */ + template > + basic_ostream<_CharT, _Traits>& + flush(basic_ostream<_CharT, _Traits>&); +} + +namespace std +{ + /** + * std::ostream and std::ostringstream + * (std::ios is not wrapped) + */ + typedef basic_ios ios; + typedef basic_ostream ostream ; + typedef basic_ostringstream ostringstream ; + + %template() basic_ios; + %template(ostream) basic_ostream; + %template(ostringstream) basic_ostringstream; + + /** + * output manipulators + */ + %template(endl) endl >; + %template(flush) flush >; + + /** + * std::cout, std::cerr, and std::clog. + */ + %immutable; + extern std::ostream cout; + extern std::ostream cerr; + extern std::ostream clog; + %mutable; +} + + +/** + * Convert an CaBase object to a string. + * +%extend CaBase +{ + %pythoncode + { + def __str__(self): + """ + Return a string representation of this object. + + Note that the string will not be a complete Ca document. + """ + + return self.toCa() + } +}*/ + + +/** + * Allows CaListOf objects: + * + * - To be indexed and sliced, e.g. lst[0]. + */ +%extend SedCaListOf +{ + int __len__() + { + return self->size(); + } + + %pythoncode + { + def __getitem__(self, key): + + try: + keyIsSlice = isinstance(key, slice) + except: + keyIsSlice = 0 + + if keyIsSlice: + start = key.start + if start is None: + start = 0 + stop = key.stop + if stop is None: + stop = self.size() + return [self[i] for i in range( + self._fixNegativeIndex(start), self._fixNegativeIndex(stop) + )] + + key = self._fixNegativeIndex(key) + if key < 0 or key >= self.size(): + raise IndexError(key) + return self.get(key) + + + def _fixNegativeIndex(self, index): + if index < 0: + return index + self.size() + else: + return index + + + def __iter__(self): + for i in range(self.size()): + yield self[i] + + + def __repr__(self): + return "[" + ", ".join([repr(self[i]) for i in range(len(self))]) + "]" + + + def __str__(self): + return repr(self) + } +} + + + +/** + * Convert objects into the most specific type possible. + */ +%typemap(out) CaBase*, SedSimulation*, SedTask*, SedOutput*, SedChange*, SedRange* +{ + $result = SWIG_NewPointerObj(SWIG_as_voidptr($1), GetDowncastSwigType($1), + $owner | %newpointer_flags); +} + + +/* + * SWIG-generated wrapper code wrongly invokes + * XMLOutputStream::writeAttribute(.., const unsigned int& value) instead of + * XMLOutputStream::writeAttribute(.., const bool& value) even if the writeAttribute + * function invoked with a bool value (True or False) in Python code. + * It seems that a bool value could be casted to unsigned int, int, or long value + * in SWIG-generated internal type check code when these types are overloaded in the + * wrapped function. + * + * To avoid this problem, XMLOutputStream::writeAttribute(.., const bool& value) + * is internally wrapped as XMLOutputStream::writeAttributeBool(.., const bool&) + * and this function is properly invoked when the writeAttribute function is invoked + * with a bool value in Python code. + */ + +%extend XMLOutputStream +{ + void writeAttributeBool(const std::string& name, const bool& value) + { + $self->writeAttribute(name, value); + } + + void writeAttributeBool(const XMLTriple& name, const bool& value) + { + $self->writeAttribute(name, value); + } +} + +#if SWIG_VERSION > 0x010336 +%feature("pythonprepend") +XMLOutputStream::writeAttribute +%{ + if type(args[1]) == type(True): return _libcombine.XMLOutputStream_writeAttributeBool(self, *args) +%} +#else +%feature("pythonprepend") +XMLOutputStream::writeAttribute +%{ + if type(args[2]) == type(True): return _libcombine.XMLOutputStream_writeAttributeBool(*args) +%} +#endif + +/** + * Add an equality operator to CaBase. All subclasses of CaBase + * will inherit this method. + * + * The %extend rewrites __cmp__ such that two objects of + * disimilar type can be compared without throwing a TypeError. For + * example: the following will return false and not throw an exception: + * + * c = libcombine.Compartment() + * n = 5 + * c == n + * + * For more information, see testEquality() in test/TestPython.py + */ + +%define SWIGPYTHON__CMP__(CLASS) +%extend CLASS +{ + %pythoncode + { + def __eq__(self, rhs): + if ((self is None) and (rhs is None)): return True + if ((self is None) or (rhs is None)): return False + if (hasattr(self, 'this') and hasattr(rhs, 'this')): + if (self.this == rhs.this): return True + return False + + def __ne__(self, rhs): + if ((self is None) and (rhs is None)): return False + if ((self is None) or (rhs is None)): return True + if (hasattr(self, 'this') and hasattr(rhs, 'this')): + if (self.this == rhs.this): return False + return True + } +} +%enddef + +SWIGPYTHON__CMP__(CaBase) +SWIGPYTHON__CMP__(SedWriter) +SWIGPYTHON__CMP__(SedReader) +SWIGPYTHON__CMP__(ASTNode) +SWIGPYTHON__CMP__(XMLNamespaces) +SWIGPYTHON__CMP__(CaNamespaces) +SWIGPYTHON__CMP__(XMLAttributes) +SWIGPYTHON__CMP__(XMLToken) +SWIGPYTHON__CMP__(XMLTriple) +SWIGPYTHON__CMP__(XMLError) +SWIGPYTHON__CMP__(XMLErrorLog) +SWIGPYTHON__CMP__(XMLOutputStream) + +/** + * The features directives below override the default SWIG generated + * code for certain methods. The idea is to tell SWIG to disown the + * passed-in object. The containing object will takeover ownership + * and delete the object as appropriate. This avoids a deadly + * double-delete which can result in a segmentation fault. For + * example, each CaBase that is appended to a CaListOf is subsequently + * owned by that CaListOf. + */ + +%define TAKEOVER_OWNERSHIP(METHOD_NAME,ARG) +%feature("pythonprepend") +METHOD_NAME +%{ + if ARG is not None: ARG.thisown = 0 +%} +%enddef + +// ---------------------------------------------------------------------- +// CaListOf +// ---------------------------------------------------------------------- + +TAKEOVER_OWNERSHIP(CaListOf::appendAndOwn(CaBase*),item) + +// ---------------------------------------------------------------------- +// ASTNode +// ---------------------------------------------------------------------- + +TAKEOVER_OWNERSHIP(ASTNode::addChild(ASTNode*),disownedChild) +TAKEOVER_OWNERSHIP(ASTNode::prependChild(ASTNode*),disownedChild) +TAKEOVER_OWNERSHIP(ASTNode::insertChild(unsigned int, ASTNode*),disownedChild) +TAKEOVER_OWNERSHIP(ASTNode::replaceChild(unsigned int, ASTNode*),disownedChild) +TAKEOVER_OWNERSHIP(ASTNode::addSemanticsAnnotation(XMLNode*),disownedAnnotation) + +/** + * + * Wraps the SedConstructorException class (C++ exception defined by libCombine) + * as the ValueError class (Python built-in exception). + * + * For example, the exception can be catched in Python code as follows: + * + * -------------------------------------- + * try: + * s = libcombine.CompartmentType(level,version) + * except ValueError, inst: + * errmsg = inst.args[0] + * -------------------------------------- + */ + +%ignore CaConstructorException; + +%define SEDMLCONSTRUCTOR_EXCEPTION(SBASE_CLASS_NAME) +%exception SBASE_CLASS_NAME { + try { + $action + } + catch (CaConstructorException &e) { + PyErr_SetString(PyExc_ValueError, const_cast(e.what())); + return NULL; + } +} +%enddef +SEDMLCONSTRUCTOR_EXCEPTION(CaContent) +SEDMLCONSTRUCTOR_EXCEPTION(CaOmexManifest) +SEDMLCONSTRUCTOR_EXCEPTION(CaCrossRef) +SEDMLCONSTRUCTOR_EXCEPTION(CaListOfContents) +SEDMLCONSTRUCTOR_EXCEPTION(CaListOfCrossRefs) + +/** + * + * Wraps the XMLConstructorException class (C++ exception defined by libCombine) + * as the VaueError class (Python built-in exception). + * + * For example, the exception can be catched in Python code as follows: + * + * -------------------------------------- + * try: + * s = libcombine.XMLAttributes(invalid arguments) + * except ValueError, inst: + * errmsg = inst.args[0] + * -------------------------------------- + */ + +%ignore XMLConstructorException; + +%define XMLCONSTRUCTOR_EXCEPTION(SBASE_CLASS_NAME) +%exception SBASE_CLASS_NAME { + try { + $action + } + catch (XMLConstructorException &e) { + PyErr_SetString(PyExc_ValueError, const_cast(e.what())); + return NULL; + } +} +%enddef + +XMLCONSTRUCTOR_EXCEPTION(XMLAttributes) +XMLCONSTRUCTOR_EXCEPTION(XMLError) +XMLCONSTRUCTOR_EXCEPTION(XMLNamespaces) +XMLCONSTRUCTOR_EXCEPTION(XMLNode) +XMLCONSTRUCTOR_EXCEPTION(XMLOutputStream) +XMLCONSTRUCTOR_EXCEPTION(XMLToken) +XMLCONSTRUCTOR_EXCEPTION(XMLTripple) + + +// ---------------------------------------------------------------------- +// SedReader +// ---------------------------------------------------------------------- + + +%pythoncode +%{ +import sys +import os.path + +# @cond doxygen-libcombine-internal + +def conditional_abspath (filename): + """conditional_abspath (filename) -> filename + + Returns filename with an absolute path prepended, if necessary. + Some combinations of platforms and underlying XML parsers *require* + an absolute path to a filename while others do not. This function + encapsulates the appropriate logic. It is used by readOMEX() and + SedReader.readOMEX(). + """ + if sys.platform.find('cygwin') != -1: + return filename + else: + return os.path.abspath(filename) + +# @endcond +%} + + +/* + * I haven't been able to attach the original docstring without + * copying it here. A %feature("docstring") directive placed + * after here won't do it, and neither will moving the pydoc.i + * file inclusion from the top of this file to the end of this + * file. I'm giving up and just copy-pasting the doc string + * from SedReader.h. Definitely non-ideal, but I'm at the end + * of ideas. + */ +%feature("shadow") +SedReader::readOMEX(const std::string&) +%{ + def readOMEX(*args): + """ + readOMEX(self, string filename) -> CaOmexManifest + + Reads an Ca document from a file. + + This method is identical to readOMEXFromFile(). + + If the file named 'filename' does not exist or its content is not + valid Ca, one or more errors will be logged with the CaOmexManifest + object returned by this method. Callers can use the methods on + CaOmexManifest such as CaOmexManifest.getNumErrors() and + CaOmexManifest.getError() to get the errors. The object returned by + CaOmexManifest.getError() is an SedError object, and it has methods to + get the error code, category, and severity level of the problem, as + well as a textual description of the problem. The possible severity + levels range from informational messages to fatal errors; see the + documentation for SedError for more information. + + If the file 'filename' could not be read, the file-reading error will + appear first. The error code can provide a clue about what happened. + For example, a file might be unreadable (either because it does not + actually exist or because the user does not have the necessary access + priviledges to read it) or some sort of file operation error may have + been reported by the underlying operating system. Callers can check + for these situations using a program fragment such as the following: + + reader = SedReader() + doc = reader.readOMEX(filename) + + if doc.getNumErrors() > 0: + if doc.getError(0).getErrorId() == libcombine.XMLFileUnreadable: + # Handle case of unreadable file here. + elif doc.getError(0).getErrorId() == libcombine.XMLFileOperationError: + # Handle case of other file error here. + else: + # Handle other error cases here. + + If the given filename ends with the suffix \".gz\" (for example, + \"myfile.xml.gz\"), the file is assumed to be compressed in gzip format + and will be automatically decompressed upon reading. Similarly, if the + given filename ends with \".zip\" or \".bz2\", the file is assumed to be + compressed in zip or bzip2 format (respectively). Files whose names + lack these suffixes will be read uncompressed. Note that if the file + is in zip format but the archive contains more than one file, only the + first file in the archive will be read and the rest ignored. + + To read a gzip/zip file, libCombine needs to be configured and linked with + the zlib library at compile time. It also needs to be linked with the + bzip2 library to read files in bzip2 format. (Both of these are the + default configurations for libCombine.) Errors about unreadable files + will be logged if a compressed filename is given and libCombine was not + linked with the corresponding required library. + + Parameter 'filename is the name or full pathname of the file to be + read. + + Returns a pointer to the CaOmexManifest created from the Ca content. + + See also SedError. + + Note: + + LibCombine versions 2.x and later versions behave differently in + error handling in several respects. One difference is how early some + errors are caught and whether libCombine continues processing a file in + the face of some early errors. In general, libCombine versions after 2.x + stop parsing Ca inputs sooner than libCombine version 2.x in the face + of XML errors, because the errors may invalidate any further Ca + content. For example, a missing XML declaration at the beginning of + the file was ignored by libCombine 2.x but in version 3.x and later, it + will cause libCombine to stop parsing the rest of the input altogether. + While this behavior may seem more severe and intolerant, it was + necessary in order to provide uniform behavior regardless of which + underlying XML parser (Expat, Xerces, libxml2) is being used by + libCombine. The XML parsers themselves behave differently in their error + reporting, and sometimes libCombine has to resort to the lowest common + denominator. + """ + args_copy = list(args) + args_copy[1] = conditional_abspath(args[1]) + return _libcombine.SedReader_readOMEX(*args_copy) +%} + +%feature("shadow") +SedReader::readOMEXFromFile(const std::string&) +%{ + def readOMEXFromFile(*args): + """ + readOMEXFromFile(self, string filename) -> CaOmexManifest + + Reads an Ca document from a file. + + This method is identical to readOMEXFromFile(). + + If the file named 'filename' does not exist or its content is not + valid Ca, one or more errors will be logged with the CaOmexManifest + object returned by this method. Callers can use the methods on + CaOmexManifest such as CaOmexManifest.getNumErrors() and + CaOmexManifest.getError() to get the errors. The object returned by + CaOmexManifest.getError() is an SedError object, and it has methods to + get the error code, category, and severity level of the problem, as + well as a textual description of the problem. The possible severity + levels range from informational messages to fatal errors; see the + documentation for SedError for more information. + + If the file 'filename' could not be read, the file-reading error will + appear first. The error code can provide a clue about what happened. + For example, a file might be unreadable (either because it does not + actually exist or because the user does not have the necessary access + priviledges to read it) or some sort of file operation error may have + been reported by the underlying operating system. Callers can check + for these situations using a program fragment such as the following: + + reader = SedReader() + doc = reader.readOMEX(filename) + + if doc.getNumErrors() > 0: + if doc.getError(0).getErrorId() == libcombine.XMLFileUnreadable: + # Handle case of unreadable file here. + elif doc.getError(0).getErrorId() == libcombine.XMLFileOperationError: + # Handle case of other file error here. + else: + # Handle other error cases here. + + If the given filename ends with the suffix \".gz\" (for example, + \"myfile.xml.gz\"), the file is assumed to be compressed in gzip format + and will be automatically decompressed upon reading. Similarly, if the + given filename ends with \".zip\" or \".bz2\", the file is assumed to be + compressed in zip or bzip2 format (respectively). Files whose names + lack these suffixes will be read uncompressed. Note that if the file + is in zip format but the archive contains more than one file, only the + first file in the archive will be read and the rest ignored. + + To read a gzip/zip file, libCombine needs to be configured and linked with + the zlib library at compile time. It also needs to be linked with the + bzip2 library to read files in bzip2 format. (Both of these are the + default configurations for libCombine.) Errors about unreadable files + will be logged if a compressed filename is given and libCombine was not + linked with the corresponding required library. + + Parameter 'filename is the name or full pathname of the file to be + read. + + Returns a pointer to the CaOmexManifest created from the Ca content. + + See also SedError. + + Note: + + LibCombine versions 2.x and later versions behave differently in + error handling in several respects. One difference is how early some + errors are caught and whether libCombine continues processing a file in + the face of some early errors. In general, libCombine versions after 2.x + stop parsing Ca inputs sooner than libCombine version 2.x in the face + of XML errors, because the errors may invalidate any further Ca + content. For example, a missing XML declaration at the beginning of + the file was ignored by libCombine 2.x but in version 3.x and later, it + will cause libCombine to stop parsing the rest of the input altogether. + While this behavior may seem more severe and intolerant, it was + necessary in order to provide uniform behavior regardless of which + underlying XML parser (Expat, Xerces, libxml2) is being used by + libCombine. The XML parsers themselves behave differently in their error + reporting, and sometimes libCombine has to resort to the lowest common + denominator. + """ + args_copy = list(args) + args_copy[1] = conditional_abspath(args[1]) + return _libcombine.SedReader_readOMEX(*args_copy) +%} + + +/** + * Since we cannot seem to "shadow" readOMEX() (maybe because it's + * not a method of some object, but rather a top-level function, we + * employ the following HACK: Tell SWIG to ignore readOMEX and just + * define it in terms of SedReader.readOMEX(). This is less than + * ideal, because the libCombine C/C++ core does essentially the same + * thing, so now we're repeating ourselves. + */ + +%ignore readOMEX(const char*); + +%pythoncode +%{ +def readOMEX(*args): + """ + readOMEX(self, string filename) -> CaOmexManifest + + Reads an Ca document from a file. + + This method is identical to readOMEXFromFile(). + + If the file named 'filename' does not exist or its content is not + valid Ca, one or more errors will be logged with the CaOmexManifest + object returned by this method. Callers can use the methods on + CaOmexManifest such as CaOmexManifest.getNumErrors() and + CaOmexManifest.getError() to get the errors. The object returned by + CaOmexManifest.getError() is an SedError object, and it has methods to + get the error code, category, and severity level of the problem, as + well as a textual description of the problem. The possible severity + levels range from informational messages to fatal errors; see the + documentation for SedError for more information. + + If the file 'filename' could not be read, the file-reading error will + appear first. The error code can provide a clue about what happened. + For example, a file might be unreadable (either because it does not + actually exist or because the user does not have the necessary access + priviledges to read it) or some sort of file operation error may have + been reported by the underlying operating system. Callers can check + for these situations using a program fragment such as the following: + + reader = SedReader() + doc = reader.readOMEX(filename) + + if doc.getNumErrors() > 0: + if doc.getError(0).getErrorId() == libcombine.XMLFileUnreadable: + # Handle case of unreadable file here. + elif doc.getError(0).getErrorId() == libcombine.XMLFileOperationError: + # Handle case of other file error here. + else: + # Handle other error cases here. + + If the given filename ends with the suffix \".gz\" (for example, + \"myfile.xml.gz\"), the file is assumed to be compressed in gzip format + and will be automatically decompressed upon reading. Similarly, if the + given filename ends with \".zip\" or \".bz2\", the file is assumed to be + compressed in zip or bzip2 format (respectively). Files whose names + lack these suffixes will be read uncompressed. Note that if the file + is in zip format but the archive contains more than one file, only the + first file in the archive will be read and the rest ignored. + + To read a gzip/zip file, libCombine needs to be configured and linked with + the zlib library at compile time. It also needs to be linked with the + bzip2 library to read files in bzip2 format. (Both of these are the + default configurations for libCombine.) Errors about unreadable files + will be logged if a compressed filename is given and libCombine was not + linked with the corresponding required library. + + Parameter 'filename is the name or full pathname of the file to be + read. + + Returns a pointer to the CaOmexManifest created from the Ca content. + + See also SedError. + + Note: + + LibCombine versions 2.x and later versions behave differently in + error handling in several respects. One difference is how early some + errors are caught and whether libCombine continues processing a file in + the face of some early errors. In general, libCombine versions after 2.x + stop parsing Ca inputs sooner than libCombine version 2.x in the face + of XML errors, because the errors may invalidate any further Ca + content. For example, a missing XML declaration at the beginning of + the file was ignored by libCombine 2.x but in version 3.x and later, it + will cause libCombine to stop parsing the rest of the input altogether. + While this behavior may seem more severe and intolerant, it was + necessary in order to provide uniform behavior regardless of which + underlying XML parser (Expat, Xerces, libxml2) is being used by + libCombine. The XML parsers themselves behave differently in their error + reporting, and sometimes libCombine has to resort to the lowest common + denominator. + """ + reader = SedReader() + return reader.readOMEX(args[0]) +%} + + +/** + * Wraps the following functions by using the corresponding + * ListWrapper class. + * + * - List* ModelHistory::getListCreators() + * - List* ModelHistory::getListModifiedDates() + * - List* CaBase::getCVTerms() + * - List* CaNamespaces::getSupportedNamespaces() + * + * ListWrapper class is wrapped as TYPENAMEList class. + * So, the above functions are wrapped as follows: + * + * - ModelCreatorList ModelHistory.getListCreators() + * - DateList ModelHistory.getListModifiedDates() + * - CVTermList CaBase.getCVTerms() + * - CaNamespacesList CaNamespaces::getSupportedNamespaces() + * + */ + +%feature("shadow") +CaNamespaces::getSupportedNamespaces +%{ + def getSupportedNamespaces(self): + """ + getSupportedNamespaces(self) -> CaNamespaceList + + Get the List of supported CaNamespaces for this + version of LibCombine. + + Returns the supported list of CaNamespaces. + + + """ + return _libcombine.CaNamespaces_getSupportedNamespaces(self) +%} + +%typemap(out) List* CaNamespaces::getSupportedNamespaces +{ + ListWrapper *listw = ($1 != 0) ? new ListWrapper($1) : 0; + $result = SWIG_NewPointerObj(SWIG_as_voidptr(listw), +#if SWIG_VERSION > 0x010333 + SWIGTYPE_p_ListWrapperT_CaNamespaces_t, +#else + SWIGTYPE_p_ListWrapperTCaNamespaces_t, +#endif + SWIG_POINTER_OWN | 0 ); +} diff --git a/dev/generated/src/bindings/swig/ASTNodes.i b/dev/generated/src/bindings/swig/ASTNodes.i index 3a97d90..e58634d 100644 --- a/dev/generated/src/bindings/swig/ASTNodes.i +++ b/dev/generated/src/bindings/swig/ASTNodes.i @@ -7,7 +7,11 @@ * This file is part of libSBML. Please visit http://sbml.org for more * information about SBML, and the latest version of libSBML. * - * Copyright (C) 2013-2016 jointly by the following organizations: + * Copyright (C) 2019 jointly by the following organizations: + * 1. California Institute of Technology, Pasadena, CA, USA + * 2. University of Heidelberg, Heidelberg, Germany + * + * Copyright (C) 2013-2018 jointly by the following organizations: * 1. California Institute of Technology, Pasadena, CA, USA * 2. EMBL European Bioinformatics Institute (EMBL-EBI), Hinxton, UK * 3. University of Heidelberg, Heidelberg, Germany diff --git a/dev/generated/src/bindings/swig/ListWrapper.h b/dev/generated/src/bindings/swig/ListWrapper.h index 093d6c6..385aa45 100644 --- a/dev/generated/src/bindings/swig/ListWrapper.h +++ b/dev/generated/src/bindings/swig/ListWrapper.h @@ -7,7 +7,11 @@ * This file is part of libSBML. Please visit http://sbml.org for more * information about SBML, and the latest version of libSBML. * - * Copyright (C) 2013-2016 jointly by the following organizations: + * Copyright (C) 2019 jointly by the following organizations: + * 1. California Institute of Technology, Pasadena, CA, USA + * 2. University of Heidelberg, Heidelberg, Germany + * + * Copyright (C) 2013-2018 jointly by the following organizations: * 1. California Institute of Technology, Pasadena, CA, USA * 2. EMBL European Bioinformatics Institute (EMBL-EBI), Hinxton, UK * 3. University of Heidelberg, Heidelberg, Germany @@ -30,7 +34,7 @@ * available online as http://sbml.org/software/libsbml/license.html * ------------------------------------------------------------------------ --> * - * @class + * @class ListWrapper * @sbmlbrief{} TODO:Definition of the ListWrapper class. */ diff --git a/dev/generated/src/bindings/swig/OStream.cpp b/dev/generated/src/bindings/swig/OStream.cpp index 72051c0..8a626e1 100644 --- a/dev/generated/src/bindings/swig/OStream.cpp +++ b/dev/generated/src/bindings/swig/OStream.cpp @@ -7,7 +7,11 @@ * This file is part of libSBML. Please visit http://sbml.org for more * information about SBML, and the latest version of libSBML. * - * Copyright (C) 2013-2016 jointly by the following organizations: + * Copyright (C) 2019 jointly by the following organizations: + * 1. California Institute of Technology, Pasadena, CA, USA + * 2. University of Heidelberg, Heidelberg, Germany + * + * Copyright (C) 2013-2018 jointly by the following organizations: * 1. California Institute of Technology, Pasadena, CA, USA * 2. EMBL European Bioinformatics Institute (EMBL-EBI), Hinxton, UK * 3. University of Heidelberg, Heidelberg, Germany diff --git a/dev/generated/src/bindings/swig/OStream.h b/dev/generated/src/bindings/swig/OStream.h index a28dd7d..18803cf 100644 --- a/dev/generated/src/bindings/swig/OStream.h +++ b/dev/generated/src/bindings/swig/OStream.h @@ -7,7 +7,11 @@ * This file is part of libSBML. Please visit http://sbml.org for more * information about SBML, and the latest version of libSBML. * - * Copyright (C) 2013-2016 jointly by the following organizations: + * Copyright (C) 2019 jointly by the following organizations: + * 1. California Institute of Technology, Pasadena, CA, USA + * 2. University of Heidelberg, Heidelberg, Germany + * + * Copyright (C) 2013-2018 jointly by the following organizations: * 1. California Institute of Technology, Pasadena, CA, USA * 2. EMBL European Bioinformatics Institute (EMBL-EBI), Hinxton, UK * 3. University of Heidelberg, Heidelberg, Germany @@ -30,7 +34,7 @@ * available online as http://sbml.org/software/libsbml/license.html * ------------------------------------------------------------------------ --> * - * @class + * @class OStream * @sbmlbrief{} TODO:Definition of the OStream class. */ diff --git a/dev/generated/src/bindings/swig/libcombine.h b/dev/generated/src/bindings/swig/libcombine.h index 05d7ff5..696a91d 100644 --- a/dev/generated/src/bindings/swig/libcombine.h +++ b/dev/generated/src/bindings/swig/libcombine.h @@ -7,7 +7,11 @@ * This file is part of libSBML. Please visit http://sbml.org for more * information about SBML, and the latest version of libSBML. * - * Copyright (C) 2013-2016 jointly by the following organizations: + * Copyright (C) 2019 jointly by the following organizations: + * 1. California Institute of Technology, Pasadena, CA, USA + * 2. University of Heidelberg, Heidelberg, Germany + * + * Copyright (C) 2013-2018 jointly by the following organizations: * 1. California Institute of Technology, Pasadena, CA, USA * 2. EMBL European Bioinformatics Institute (EMBL-EBI), Hinxton, UK * 3. University of Heidelberg, Heidelberg, Germany diff --git a/dev/generated/src/bindings/swig/libcombine.i b/dev/generated/src/bindings/swig/libcombine.i index f9eb74e..287db7a 100644 --- a/dev/generated/src/bindings/swig/libcombine.i +++ b/dev/generated/src/bindings/swig/libcombine.i @@ -7,7 +7,11 @@ * This file is part of libSBML. Please visit http://sbml.org for more * information about SBML, and the latest version of libSBML. * - * Copyright (C) 2013-2016 jointly by the following organizations: + * Copyright (C) 2019 jointly by the following organizations: + * 1. California Institute of Technology, Pasadena, CA, USA + * 2. University of Heidelberg, Heidelberg, Germany + * + * Copyright (C) 2013-2018 jointly by the following organizations: * 1. California Institute of Technology, Pasadena, CA, USA * 2. EMBL European Bioinformatics Institute (EMBL-EBI), Hinxton, UK * 3. University of Heidelberg, Heidelberg, Germany @@ -355,4 +359,6 @@ typedef std::vector CaErrorStdVector; %include %include %include +%include +%include diff --git a/dev/generated/src/bindings/swig/std_set.i b/dev/generated/src/bindings/swig/std_set.i index 813db20..560a385 100644 --- a/dev/generated/src/bindings/swig/std_set.i +++ b/dev/generated/src/bindings/swig/std_set.i @@ -7,7 +7,11 @@ * This file is part of libSBML. Please visit http://sbml.org for more * information about SBML, and the latest version of libSBML. * - * Copyright (C) 2013-2016 jointly by the following organizations: + * Copyright (C) 2019 jointly by the following organizations: + * 1. California Institute of Technology, Pasadena, CA, USA + * 2. University of Heidelberg, Heidelberg, Germany + * + * Copyright (C) 2013-2018 jointly by the following organizations: * 1. California Institute of Technology, Pasadena, CA, USA * 2. EMBL European Bioinformatics Institute (EMBL-EBI), Hinxton, UK * 3. University of Heidelberg, Heidelberg, Germany diff --git a/dev/generated/src/omex/CMakeLists.txt b/dev/generated/src/omex/CMakeLists.txt index 180d190..bf99bf9 100644 --- a/dev/generated/src/omex/CMakeLists.txt +++ b/dev/generated/src/omex/CMakeLists.txt @@ -14,7 +14,7 @@ configure_file( "${CMAKE_CURRENT_BINARY_DIR}/common/libcombine-config-common.h" ) -# Replace: @LIBCOMBINE_VERSION@ and @LIBCOMBINE_VERSION_NUMERIC@ +# Replace: @PACKAGE_VERSION@ and @LIBCOMBINE_VERSION_NUMERIC@ configure_file ( "${CMAKE_CURRENT_SOURCE_DIR}/common/libcombine-version.h.cmake" "${CMAKE_CURRENT_BINARY_DIR}/common/libcombine-version.h" diff --git a/dev/generated/src/omex/CaBase.cpp b/dev/generated/src/omex/CaBase.cpp index 93ef23f..9f2dc38 100644 --- a/dev/generated/src/omex/CaBase.cpp +++ b/dev/generated/src/omex/CaBase.cpp @@ -7,7 +7,11 @@ * This file is part of libSBML. Please visit http://sbml.org for more * information about SBML, and the latest version of libSBML. * - * Copyright (C) 2013-2016 jointly by the following organizations: + * Copyright (C) 2019 jointly by the following organizations: + * 1. California Institute of Technology, Pasadena, CA, USA + * 2. University of Heidelberg, Heidelberg, Germany + * + * Copyright (C) 2013-2018 jointly by the following organizations: * 1. California Institute of Technology, Pasadena, CA, USA * 2. EMBL European Bioinformatics Institute (EMBL-EBI), Hinxton, UK * 3. University of Heidelberg, Heidelberg, Germany @@ -107,6 +111,7 @@ CaBase::getAllElements() */ CaBase::CaBase (unsigned int level, unsigned int version) : mMetaId ("") + , mId ("") , mNotes(NULL) , mAnnotation( NULL ) , mCa ( NULL ) @@ -137,6 +142,7 @@ CaBase::CaBase (unsigned int level, unsigned int version) */ CaBase::CaBase (CaNamespaces *omexns) : mMetaId("") + , mId("") , mNotes(NULL) , mAnnotation( NULL ) , mCa ( NULL ) @@ -167,6 +173,7 @@ CaBase::CaBase (CaNamespaces *omexns) */ CaBase::CaBase(const CaBase& orig) : mMetaId (orig.mMetaId) + , mId (orig.mId) , mNotes (NULL) , mAnnotation (NULL) , mCa (NULL) @@ -178,12 +185,12 @@ CaBase::CaBase(const CaBase& orig) , mURI(orig.mURI) { if(orig.mNotes != NULL) - this->mNotes = new XMLNode(*const_cast(orig).getNotes()); + this->mNotes = new LIBSBML_CPP_NAMESPACE_QUALIFIER XMLNode(*const_cast(orig).getNotes()); else this->mNotes = NULL; if(orig.mAnnotation != NULL) - this->mAnnotation = new XMLNode(*const_cast(orig).mAnnotation); + this->mAnnotation = new LIBSBML_CPP_NAMESPACE_QUALIFIER XMLNode(*const_cast(orig).mAnnotation); else this->mAnnotation = NULL; @@ -216,18 +223,19 @@ CaBase& CaBase::operator=(const CaBase& rhs) if(&rhs!=this) { this->mMetaId = rhs.mMetaId; + this->mId = rhs.mId; delete this->mNotes; if(rhs.mNotes != NULL) - this->mNotes = new XMLNode(*const_cast(rhs).getNotes()); + this->mNotes = new LIBSBML_CPP_NAMESPACE_QUALIFIER XMLNode(*const_cast(rhs).getNotes()); else this->mNotes = NULL; delete this->mAnnotation; if(rhs.mAnnotation != NULL) - this->mAnnotation = new XMLNode(*const_cast(rhs).mAnnotation); + this->mAnnotation = new LIBSBML_CPP_NAMESPACE_QUALIFIER XMLNode(*const_cast(rhs).mAnnotation); else this->mAnnotation = NULL; @@ -276,21 +284,21 @@ CaBase::getMetaId () const string& CaBase::getId() const { - return mEmptyString; + return mId; } /* * @return the notes of this OMEX object. */ -XMLNode* +LIBSBML_CPP_NAMESPACE_QUALIFIER XMLNode* CaBase::getNotes() { return mNotes; } -const XMLNode* +const LIBSBML_CPP_NAMESPACE_QUALIFIER XMLNode* CaBase::getNotes() const { return mNotes; @@ -303,28 +311,28 @@ CaBase::getNotes() const std::string CaBase::getNotesString() { - return XMLNode::convertXMLNodeToString(mNotes); + return LIBSBML_CPP_NAMESPACE_QUALIFIER XMLNode::convertXMLNodeToString(mNotes); } std::string CaBase::getNotesString() const { - return XMLNode::convertXMLNodeToString(mNotes); + return LIBSBML_CPP_NAMESPACE_QUALIFIER XMLNode::convertXMLNodeToString(mNotes); } /* * @return the annotation of this OMEX object. */ -XMLNode* +LIBSBML_CPP_NAMESPACE_QUALIFIER XMLNode* CaBase::getAnnotation () { return mAnnotation; } -const XMLNode* +const LIBSBML_CPP_NAMESPACE_QUALIFIER XMLNode* CaBase::getAnnotation () const { return const_cast(this)->getAnnotation(); @@ -337,14 +345,14 @@ CaBase::getAnnotation () const std::string CaBase::getAnnotationString () { - return XMLNode::convertXMLNodeToString(getAnnotation()); + return LIBSBML_CPP_NAMESPACE_QUALIFIER XMLNode::convertXMLNodeToString(getAnnotation()); } std::string CaBase::getAnnotationString () const { - return XMLNode::convertXMLNodeToString(getAnnotation()); + return LIBSBML_CPP_NAMESPACE_QUALIFIER XMLNode::convertXMLNodeToString(getAnnotation()); } @@ -422,7 +430,7 @@ CaBase::unsetUserData() /* * @return the Namespaces associated with this OMEX object */ -XMLNamespaces* +LIBSBML_CPP_NAMESPACE_QUALIFIER XMLNamespaces* CaBase::getNamespaces() { if (mCa != NULL) @@ -432,7 +440,7 @@ CaBase::getNamespaces() } -const XMLNamespaces* +const LIBSBML_CPP_NAMESPACE_QUALIFIER XMLNamespaces* CaBase::getNamespaces() const { if (mCa != NULL) @@ -637,12 +645,34 @@ CaBase::setMetaId (const std::string& metaid) } } +/* + * Sets the id field of the given OMEX object to a copy of sid. + */ +int +CaBase::setId (const std::string& sid) +{ + if (sid.empty()) + { + mId.erase(); + return LIBCOMBINE_OPERATION_SUCCESS; + } + else if (!(SyntaxChecker::isValidXMLID(sid))) + { + return LIBCOMBINE_INVALID_ATTRIBUTE_VALUE; + } + else + { + mId = sid; + return LIBCOMBINE_OPERATION_SUCCESS; + } +} + /* * Sets the annotation of this OMEX object to a copy of annotation. */ int -CaBase::setAnnotation (XMLNode* annotation) +CaBase::setAnnotation (LIBSBML_CPP_NAMESPACE_QUALIFIER XMLNode* annotation) { if (annotation == NULL) { @@ -675,17 +705,17 @@ CaBase::setAnnotation (const std::string& annotation) return LIBCOMBINE_OPERATION_SUCCESS; } - XMLNode* annt_xmln; + LIBSBML_CPP_NAMESPACE_QUALIFIER XMLNode* annt_xmln; // you might not have a document !! if (getCaOmexManifest() != NULL) { - XMLNamespaces* xmlns = getCaOmexManifest()->getNamespaces(); - annt_xmln = XMLNode::convertStringToXMLNode(annotation,xmlns); + LIBSBML_CPP_NAMESPACE_QUALIFIER XMLNamespaces* xmlns = getCaOmexManifest()->getNamespaces(); + annt_xmln = LIBSBML_CPP_NAMESPACE_QUALIFIER XMLNode::convertStringToXMLNode(annotation,xmlns); } else { - annt_xmln = XMLNode::convertStringToXMLNode(annotation); + annt_xmln = LIBSBML_CPP_NAMESPACE_QUALIFIER XMLNode::convertStringToXMLNode(annotation); } if(annt_xmln != NULL) @@ -703,7 +733,7 @@ CaBase::setAnnotation (const std::string& annotation) * adding additional information. */ int -CaBase::appendAnnotation (const XMLNode* annotation) +CaBase::appendAnnotation (const LIBSBML_CPP_NAMESPACE_QUALIFIER XMLNode* annotation) { int success = LIBCOMBINE_OPERATION_FAILED; unsigned int duplicates = 0; @@ -711,14 +741,14 @@ CaBase::appendAnnotation (const XMLNode* annotation) if(annotation == NULL) return LIBCOMBINE_OPERATION_SUCCESS; - XMLNode* new_annotation = NULL; + LIBSBML_CPP_NAMESPACE_QUALIFIER XMLNode* new_annotation = NULL; const string& name = annotation->getName(); // check for annotation tags and add if necessary if (name != "annotation") { - XMLToken ann_t = XMLToken(XMLTriple("annotation", "", ""), XMLAttributes()); - new_annotation = new XMLNode(ann_t); + LIBSBML_CPP_NAMESPACE_QUALIFIER XMLToken ann_t = LIBSBML_CPP_NAMESPACE_QUALIFIER XMLToken(LIBSBML_CPP_NAMESPACE_QUALIFIER XMLTriple("annotation", "", ""), LIBSBML_CPP_NAMESPACE_QUALIFIER XMLAttributes()); + new_annotation = new LIBSBML_CPP_NAMESPACE_QUALIFIER XMLNode(ann_t); new_annotation->addChild(*annotation); } else @@ -767,7 +797,7 @@ CaBase::appendAnnotation (const XMLNode* annotation) } else { - XMLNode *copy = mAnnotation->clone(); + LIBSBML_CPP_NAMESPACE_QUALIFIER XMLNode *copy = mAnnotation->clone(); success = setAnnotation(copy); delete copy; } @@ -793,15 +823,15 @@ int CaBase::appendAnnotation (const std::string& annotation) { int success = LIBCOMBINE_OPERATION_FAILED; - XMLNode* annt_xmln; + LIBSBML_CPP_NAMESPACE_QUALIFIER XMLNode* annt_xmln; if (getCaOmexManifest() != NULL) { - XMLNamespaces* xmlns = getCaOmexManifest()->getNamespaces(); - annt_xmln = XMLNode::convertStringToXMLNode(annotation,xmlns); + LIBSBML_CPP_NAMESPACE_QUALIFIER XMLNamespaces* xmlns = getCaOmexManifest()->getNamespaces(); + annt_xmln = LIBSBML_CPP_NAMESPACE_QUALIFIER XMLNode::convertStringToXMLNode(annotation,xmlns); } else { - annt_xmln = XMLNode::convertStringToXMLNode(annotation); + annt_xmln = LIBSBML_CPP_NAMESPACE_QUALIFIER XMLNode::convertStringToXMLNode(annotation); } if(annt_xmln != NULL) @@ -838,7 +868,7 @@ CaBase::removeTopLevelAnnotationElement(const std::string elementName, // check uri matches if (elementURI.empty() == false) { - XMLNode child = mAnnotation->getChild(index); + LIBSBML_CPP_NAMESPACE_QUALIFIER XMLNode child = mAnnotation->getChild(index); std::string prefix = child.getPrefix(); if (prefix.empty() == false @@ -890,10 +920,10 @@ CaBase::removeTopLevelAnnotationElement(const std::string elementName, int -CaBase::replaceTopLevelAnnotationElement(const XMLNode* annotation) +CaBase::replaceTopLevelAnnotationElement(const LIBSBML_CPP_NAMESPACE_QUALIFIER XMLNode* annotation) { int success = LIBCOMBINE_OPERATION_FAILED; - XMLNode * replacement = NULL; + LIBSBML_CPP_NAMESPACE_QUALIFIER XMLNode * replacement = NULL; if (annotation->getName() == "annotation") { if (annotation->getNumChildren() != 1) @@ -927,15 +957,15 @@ int CaBase::replaceTopLevelAnnotationElement(const std::string& annotation) { int success = LIBCOMBINE_OPERATION_FAILED; - XMLNode* annt_xmln; + LIBSBML_CPP_NAMESPACE_QUALIFIER XMLNode* annt_xmln; if (getCaOmexManifest() != NULL) { - XMLNamespaces* xmlns = getCaOmexManifest()->getNamespaces(); - annt_xmln = XMLNode::convertStringToXMLNode(annotation,xmlns); + LIBSBML_CPP_NAMESPACE_QUALIFIER XMLNamespaces* xmlns = getCaOmexManifest()->getNamespaces(); + annt_xmln = LIBSBML_CPP_NAMESPACE_QUALIFIER XMLNode::convertStringToXMLNode(annotation,xmlns); } else { - annt_xmln = XMLNode::convertStringToXMLNode(annotation); + annt_xmln = LIBSBML_CPP_NAMESPACE_QUALIFIER XMLNode::convertStringToXMLNode(annotation); } if(annt_xmln != NULL) @@ -953,7 +983,7 @@ CaBase::replaceTopLevelAnnotationElement(const std::string& annotation) * Sets the notes of this OMEX object to a copy of notes. */ int -CaBase::setNotes(const XMLNode* notes) +CaBase::setNotes(const LIBSBML_CPP_NAMESPACE_QUALIFIER XMLNode* notes) { if (mNotes == notes) { @@ -973,13 +1003,13 @@ CaBase::setNotes(const XMLNode* notes) if (name == "notes") { - mNotes = static_cast( notes->clone() ); + mNotes = static_cast( notes->clone() ); } else { - XMLToken notes_t = XMLToken(XMLTriple("notes", "", ""), - XMLAttributes()); - mNotes = new XMLNode(notes_t); + LIBSBML_CPP_NAMESPACE_QUALIFIER XMLToken notes_t = LIBSBML_CPP_NAMESPACE_QUALIFIER XMLToken(LIBSBML_CPP_NAMESPACE_QUALIFIER XMLTriple("notes", "", ""), + LIBSBML_CPP_NAMESPACE_QUALIFIER XMLAttributes()); + mNotes = new LIBSBML_CPP_NAMESPACE_QUALIFIER XMLNode(notes_t); // The root node of the given XMLNode tree can be an empty XMLNode // (i.e. neither start, end, nor text XMLNode) if the given notes was @@ -1028,17 +1058,17 @@ CaBase::setNotes(const std::string& notes, bool addXHTMLMarkup) } else { - XMLNode* notes_xmln; + LIBSBML_CPP_NAMESPACE_QUALIFIER XMLNode* notes_xmln; // you might not have a document !! if (getCaOmexManifest() != NULL) { - XMLNamespaces* xmlns = getCaOmexManifest()->getNamespaces(); - notes_xmln = XMLNode::convertStringToXMLNode(notes,xmlns); + LIBSBML_CPP_NAMESPACE_QUALIFIER XMLNamespaces* xmlns = getCaOmexManifest()->getNamespaces(); + notes_xmln = LIBSBML_CPP_NAMESPACE_QUALIFIER XMLNode::convertStringToXMLNode(notes,xmlns); } else { - notes_xmln = XMLNode::convertStringToXMLNode(notes); + notes_xmln = LIBSBML_CPP_NAMESPACE_QUALIFIER XMLNode::convertStringToXMLNode(notes); } if (notes_xmln != NULL) @@ -1051,11 +1081,11 @@ CaBase::setNotes(const std::string& notes, bool addXHTMLMarkup) && notes_xmln->isText() == true) { //create a parent node of xhtml type p - XMLAttributes blank_att = XMLAttributes(); - XMLTriple triple = XMLTriple("p", "http://www.w3.org/1999/xhtml", ""); - XMLNamespaces xmlns = XMLNamespaces(); + LIBSBML_CPP_NAMESPACE_QUALIFIER XMLAttributes blank_att = LIBSBML_CPP_NAMESPACE_QUALIFIER XMLAttributes(); + LIBSBML_CPP_NAMESPACE_QUALIFIER XMLTriple triple = LIBSBML_CPP_NAMESPACE_QUALIFIER XMLTriple("p", "http://www.w3.org/1999/xhtml", ""); + LIBSBML_CPP_NAMESPACE_QUALIFIER XMLNamespaces xmlns = LIBSBML_CPP_NAMESPACE_QUALIFIER XMLNamespaces(); xmlns.add("http://www.w3.org/1999/xhtml", ""); - XMLNode *xmlnode = new XMLNode(XMLToken(triple, blank_att, xmlns)); + LIBSBML_CPP_NAMESPACE_QUALIFIER XMLNode *xmlnode = new LIBSBML_CPP_NAMESPACE_QUALIFIER XMLNode(LIBSBML_CPP_NAMESPACE_QUALIFIER XMLToken(triple, blank_att, xmlns)); // create a text node from the text given xmlnode->addChild(*notes_xmln); @@ -1085,7 +1115,7 @@ CaBase::setNotes(const std::string& notes, bool addXHTMLMarkup) * adding additional information. */ int -CaBase::appendNotes(const XMLNode* notes) +CaBase::appendNotes(const LIBSBML_CPP_NAMESPACE_QUALIFIER XMLNode* notes) { int success = LIBCOMBINE_OPERATION_FAILED; if(notes == NULL) @@ -1114,7 +1144,7 @@ CaBase::appendNotes(const XMLNode* notes) typedef enum { _ANotesHTML, _ANotesBody, _ANotesAny } _NotesType; _NotesType addedNotesType = _ANotesAny; - XMLNode addedNotes; + LIBSBML_CPP_NAMESPACE_QUALIFIER XMLNode addedNotes; //------------------------------------------------------------ // @@ -1225,7 +1255,7 @@ CaBase::appendNotes(const XMLNode* notes) if (getLevel() > 2 || (getLevel() == 2 && getVersion() > 1)) { - XMLNode tmpNotes(XMLTriple("notes","",""), XMLAttributes()); + LIBSBML_CPP_NAMESPACE_QUALIFIER XMLNode tmpNotes(LIBSBML_CPP_NAMESPACE_QUALIFIER XMLTriple("notes","",""), LIBSBML_CPP_NAMESPACE_QUALIFIER XMLAttributes()); if (addedNotesType == _ANotesAny) { @@ -1255,7 +1285,7 @@ CaBase::appendNotes(const XMLNode* notes) //------------------------------------------------------------ _NotesType curNotesType = _ANotesAny; - XMLNode& curNotes = *mNotes; + LIBSBML_CPP_NAMESPACE_QUALIFIER XMLNode& curNotes = *mNotes; // curNotes.getChild(0) must be "html", "body", or any XHTML // element that would be permitted within a "body" element . @@ -1264,7 +1294,7 @@ CaBase::appendNotes(const XMLNode* notes) if (cname == "html") { - XMLNode& curHTML = curNotes.getChild(0); + LIBSBML_CPP_NAMESPACE_QUALIFIER XMLNode& curHTML = curNotes.getChild(0); // // checks the curHTML if the html tag contains "head" and "body" tags // which must be located in this order, otherwise nothing will be done. @@ -1304,14 +1334,14 @@ CaBase::appendNotes(const XMLNode* notes) if (curNotesType == _ANotesHTML) { - XMLNode& curHTML = curNotes.getChild(0); - XMLNode& curBody = curHTML.getChild(1); + LIBSBML_CPP_NAMESPACE_QUALIFIER XMLNode& curHTML = curNotes.getChild(0); + LIBSBML_CPP_NAMESPACE_QUALIFIER XMLNode& curBody = curHTML.getChild(1); if (addedNotesType == _ANotesHTML) { // adds the given html tag to the current html tag - XMLNode& addedBody = addedNotes.getChild(1); + LIBSBML_CPP_NAMESPACE_QUALIFIER XMLNode& addedBody = addedNotes.getChild(1); for (i=0; i < addedBody.getNumChildren(); i++) { @@ -1339,9 +1369,9 @@ CaBase::appendNotes(const XMLNode* notes) { // adds the given html tag to the current body tag - XMLNode addedHTML(addedNotes); - XMLNode& addedBody = addedHTML.getChild(1); - XMLNode& curBody = curNotes.getChild(0); + LIBSBML_CPP_NAMESPACE_QUALIFIER XMLNode addedHTML(addedNotes); + LIBSBML_CPP_NAMESPACE_QUALIFIER XMLNode& addedBody = addedHTML.getChild(1); + LIBSBML_CPP_NAMESPACE_QUALIFIER XMLNode& curBody = curNotes.getChild(0); for (i=0; i < curBody.getNumChildren(); i++) { @@ -1357,7 +1387,7 @@ CaBase::appendNotes(const XMLNode* notes) // adds the given body or other tag (permitted in the body) to the current // body tag - XMLNode& curBody = curNotes.getChild(0); + LIBSBML_CPP_NAMESPACE_QUALIFIER XMLNode& curBody = curNotes.getChild(0); for (i=0; i < addedNotes.getNumChildren(); i++) { @@ -1373,8 +1403,8 @@ CaBase::appendNotes(const XMLNode* notes) { // adds the given html tag to the current any tag permitted in the body. - XMLNode addedHTML(addedNotes); - XMLNode& addedBody = addedHTML.getChild(1); + LIBSBML_CPP_NAMESPACE_QUALIFIER XMLNode addedHTML(addedNotes); + LIBSBML_CPP_NAMESPACE_QUALIFIER XMLNode& addedBody = addedHTML.getChild(1); for (i=0; i < curNotes.getNumChildren(); i++) { @@ -1389,7 +1419,7 @@ CaBase::appendNotes(const XMLNode* notes) { // adds the given body tag to the current any tag permitted in the body. - XMLNode addedBody(addedNotes); + LIBSBML_CPP_NAMESPACE_QUALIFIER XMLNode addedBody(addedNotes); for (i=0; i < curNotes.getNumChildren(); i++) { @@ -1437,16 +1467,16 @@ CaBase::appendNotes(const std::string& notes) return LIBCOMBINE_OPERATION_SUCCESS; } - XMLNode* notes_xmln; + LIBSBML_CPP_NAMESPACE_QUALIFIER XMLNode* notes_xmln; // you might not have a document !! if (getCaOmexManifest() != NULL) { - XMLNamespaces* xmlns = getCaOmexManifest()->getNamespaces(); - notes_xmln = XMLNode::convertStringToXMLNode(notes,xmlns); + LIBSBML_CPP_NAMESPACE_QUALIFIER XMLNamespaces* xmlns = getCaOmexManifest()->getNamespaces(); + notes_xmln = LIBSBML_CPP_NAMESPACE_QUALIFIER XMLNode::convertStringToXMLNode(notes,xmlns); } else { - notes_xmln = XMLNode::convertStringToXMLNode(notes); + notes_xmln = LIBSBML_CPP_NAMESPACE_QUALIFIER XMLNode::convertStringToXMLNode(notes); } if(notes_xmln != NULL) @@ -1570,7 +1600,7 @@ CaBase::getAncestorOfType(int type) const * @param xmlns the namespaces to set */ int -CaBase::setNamespaces(XMLNamespaces* xmlns) +CaBase::setNamespaces(LIBSBML_CPP_NAMESPACE_QUALIFIER XMLNamespaces* xmlns) { if (xmlns == NULL) { @@ -1605,6 +1635,25 @@ CaBase::unsetMetaId () } +/* + * Unsets the id of this OMEX object. + */ +int +CaBase::unsetId () +{ + mId.erase(); + + if (mId.empty()) + { + return LIBCOMBINE_OPERATION_SUCCESS; + } + else + { + return LIBCOMBINE_OPERATION_FAILED; + } +} + + /* * Unsets the notes of this OMEX object. */ @@ -1623,7 +1672,7 @@ CaBase::unsetNotes () int CaBase::unsetAnnotation () { - XMLNode* empty = NULL; + LIBSBML_CPP_NAMESPACE_QUALIFIER XMLNode* empty = NULL; return setAnnotation(empty); } @@ -1634,9 +1683,7 @@ CaBase::unsetAnnotation () unsigned int CaBase::getLevel () const { - if (mCa != NULL) - return mCa->getLevel(); - else if (mCaNamespaces != NULL) + if (mCaNamespaces != NULL) return mCaNamespaces->getLevel(); else return OMEX_DEFAULT_LEVEL; @@ -1649,9 +1696,7 @@ CaBase::getLevel () const unsigned int CaBase::getVersion () const { - if (mCa != NULL) - return mCa->getVersion(); - else if (mCaNamespaces != NULL) + if (mCaNamespaces != NULL) return mCaNamespaces->getVersion(); else return OMEX_DEFAULT_VERSION; @@ -1681,7 +1726,7 @@ bool CaBase::hasValidLevelVersionNamespaceCombination() { int typecode = getTypeCode(); - XMLNamespaces *xmlns = getNamespaces(); + LIBSBML_CPP_NAMESPACE_QUALIFIER XMLNamespaces *xmlns = getNamespaces(); return hasValidLevelVersionNamespaceCombination(typecode, xmlns); } @@ -1779,7 +1824,7 @@ CaBase::matchesCoreCaNamespace(const CaBase * sb) const bool -CaBase::hasValidLevelVersionNamespaceCombination(int typecode, XMLNamespaces *xmlns) +CaBase::hasValidLevelVersionNamespaceCombination(int typecode, LIBSBML_CPP_NAMESPACE_QUALIFIER XMLNamespaces *xmlns) { @@ -1859,7 +1904,7 @@ CaBase::getCaNamespaces() const // initialize OMEX namespace if need be if (mCaNamespaces == NULL) - const_cast(this)->mCaNamespaces = new CaNamespaces(); + const_cast(this)->mCaNamespaces = new CaNamespaces(getLevel(), getVersion()); return mCaNamespaces; } /** @endcond */ @@ -1873,7 +1918,7 @@ char* CaBase::toCa () { ostringstream os; - XMLOutputStream stream(os, "UTF-8", false); + LIBSBML_CPP_NAMESPACE_QUALIFIER XMLOutputStream stream(os, "UTF-8", false); write(stream); @@ -1881,16 +1926,207 @@ CaBase::toCa () } +/** @cond doxygenLibomexInternal */ +int +CaBase::getAttribute(const std::string& attributeName, double& value) const +{ + return LIBCOMBINE_OPERATION_FAILED; +} +/** @endcond */ + + +/** @cond doxygenLibomexInternal */ +int +CaBase::getAttribute(const std::string& attributeName, bool& value) const +{ + return LIBCOMBINE_OPERATION_FAILED; +} +/** @endcond */ + + +/** @cond doxygenLibomexInternal */ +int +CaBase::getAttribute(const std::string& attributeName, int& value) const +{ + return LIBCOMBINE_OPERATION_FAILED; +} +/** @endcond */ + + +/** @cond doxygenLibomexInternal */ +int +CaBase::getAttribute(const std::string& attributeName, unsigned int& value) const +{ + return LIBCOMBINE_OPERATION_FAILED; +} +/** @endcond */ + + +/** @cond doxygenLibomexInternal */ +int +CaBase::getAttribute(const std::string& attributeName, std::string& value) const +{ + if (attributeName == "metaid") + { + value = getMetaId(); + return LIBCOMBINE_OPERATION_SUCCESS; + } + else if (attributeName == "id") + { + value = getId(); + return LIBCOMBINE_OPERATION_SUCCESS; + } + + return LIBCOMBINE_OPERATION_FAILED; +} +/** @endcond */ + + +/** @cond doxygenLibomexInternal */ +bool +CaBase::isSetAttribute(const std::string& attributeName) const +{ + bool value = false; + if (attributeName == "metaid") + { + value = isSetMetaId(); + } + else if (attributeName == "id") + { + value = isSetId(); + } + + return value; +} +/** @endcond */ + + +/** @cond doxygenLibomexInternal */ +int +CaBase::setAttribute(const std::string& attributeName, double value) +{ + return LIBCOMBINE_OPERATION_FAILED; +} +/** @endcond */ + + +/** @cond doxygenLibomexInternal */ +int +CaBase::setAttribute(const std::string& attributeName, bool value) +{ + return LIBCOMBINE_OPERATION_FAILED; +} +/** @endcond */ + + +/** @cond doxygenLibomexInternal */ +int +CaBase::setAttribute(const std::string& attributeName, int value) +{ + return LIBCOMBINE_OPERATION_FAILED; +} +/** @endcond */ + + +/** @cond doxygenLibomexInternal */ +int +CaBase::setAttribute(const std::string& attributeName, unsigned int value) +{ + return LIBCOMBINE_OPERATION_FAILED; +} +/** @endcond */ + + +/** @cond doxygenLibomexInternal */ +int +CaBase::setAttribute(const std::string& attributeName, const std::string& value) +{ + int return_value = LIBCOMBINE_OPERATION_FAILED; + if (attributeName == "metaid") + { + return_value = setMetaId(value); + } + else if (attributeName == "id") + { + return_value = setId(value); + } + + return return_value; +} +/** @endcond */ + + +/** @cond doxygenLibomexInternal */ +int +CaBase::unsetAttribute(const std::string& attributeName) +{ + int value = LIBCOMBINE_OPERATION_FAILED; + if (attributeName == "metaid") + { + value = unsetMetaId(); + } + else if (attributeName == "id") + { + value = unsetId(); + } + + return value; +} +/** @endcond */ + +/** @cond doxygenLibomexInternal */ +CaBase* +CaBase::createChildObject(const std::string& elementName) +{ + return NULL; +} +/** @endcond */ + +/** @cond doxygenLibomexInternal */ +int +CaBase::addChildObject(const std::string& elementName, const CaBase* element) +{ + return LIBCOMBINE_OPERATION_FAILED; +} +/** @endcond */ + +/** @cond doxygenLibomexInternal */ +CaBase* +CaBase::removeChildObject(const std::string& elementName, const std::string& id) +{ + return NULL; +} +/** @endcond */ + +/** @cond doxygenLibomexInternal */ + +unsigned int + CaBase::getNumObjects(const std::string& objectName) +{ + return 0; +} + + /** @endcond */ + + /** @cond doxygenLibomexInternal */ + +CaBase* +CaBase::getObject(const std::string& objectName, unsigned int index) +{ + return NULL; +} + + /** @endcond */ /** @cond doxygenLibomexInternal */ /* * Reads (initializes) this OMEX object by reading from XMLInputStream. */ void -CaBase::read (XMLInputStream& stream) +CaBase::read (LIBSBML_CPP_NAMESPACE_QUALIFIER XMLInputStream& stream) { if ( !stream.peek().isStart() ) return; - const XMLToken element = stream.next(); + const LIBSBML_CPP_NAMESPACE_QUALIFIER XMLToken element = stream.next(); int position = 0; setCaBaseFields( element ); @@ -1904,13 +2140,13 @@ CaBase::read (XMLInputStream& stream) * thus the MathML reader can find out what level/version * of OMEX it is parsing */ - if (element.getName() == "omex") + if (element.getName() == "OmexManifest") { // stream.setCaNamespaces(this->getCaNamespaces()); // need to check that any prefix on the omexns also occurs on element // remembering the horrible situation where the omexns might be declared // with more than one prefix - XMLNamespaces * xmlns = this->getCaNamespaces()->getNamespaces(); + LIBSBML_CPP_NAMESPACE_QUALIFIER XMLNamespaces * xmlns = this->getCaNamespaces()->getNamespaces(); if (xmlns != NULL) { int i = xmlns->getIndexByPrefix(element.getPrefix()); @@ -1937,7 +2173,7 @@ CaBase::read (XMLInputStream& stream) { unsigned int errorId = this->getErrorLog()->getError(n)->getErrorId(); - if ( errorId == CombineCaOmexManifestAllowedCoreAttributes + if ( errorId == CombineOmexManifestAllowedCoreAttributes || errorId == InvalidNamespaceOnCa) { errorLoggedAlready = true; @@ -1968,7 +2204,7 @@ CaBase::read (XMLInputStream& stream) checkDefaultNamespace(mCaNamespaces->getNamespaces(), element.getName()); if (!element.getPrefix().empty()) { - XMLNamespaces * prefixedNS = new XMLNamespaces(); + LIBSBML_CPP_NAMESPACE_QUALIFIER XMLNamespaces * prefixedNS = new LIBSBML_CPP_NAMESPACE_QUALIFIER XMLNamespaces(); prefixedNS->add(element.getURI(), element.getPrefix()); checkDefaultNamespace(prefixedNS, element.getName(), element.getPrefix()); delete prefixedNS; @@ -1989,7 +2225,7 @@ CaBase::read (XMLInputStream& stream) } setElementText(text); - const XMLToken& next = stream.peek(); + const LIBSBML_CPP_NAMESPACE_QUALIFIER XMLToken& next = stream.peek(); // Re-check stream.isGood() because stream.peek() could hit something. if ( !stream.isGood() ) break; @@ -2044,7 +2280,7 @@ CaBase::setElementText(const std::string &text) * Writes (serializes) this OMEX object by writing it to XMLOutputStream. */ void -CaBase::write (XMLOutputStream& stream) const +CaBase::write (LIBSBML_CPP_NAMESPACE_QUALIFIER XMLOutputStream& stream) const { stream.startElement( getElementName(), getPrefix() ); @@ -2065,7 +2301,7 @@ CaBase::write (XMLOutputStream& stream) const * implementation of this method as well. */ void -CaBase::writeElements (XMLOutputStream& stream) const +CaBase::writeElements (LIBSBML_CPP_NAMESPACE_QUALIFIER XMLOutputStream& stream) const { if ( mNotes != NULL ) stream << *mNotes; @@ -2083,7 +2319,7 @@ CaBase::writeElements (XMLOutputStream& stream) const * XMLInputStream or @c NULL if the token was not recognized. */ CaBase* -CaBase::createObject (XMLInputStream& stream) +CaBase::createObject (LIBSBML_CPP_NAMESPACE_QUALIFIER XMLInputStream& stream) { return NULL; } @@ -2100,7 +2336,7 @@ CaBase::createObject (XMLInputStream& stream) * @return true if the subclass read from the stream, false otherwise. */ bool -CaBase::readOtherXML (XMLInputStream& stream) +CaBase::readOtherXML (LIBSBML_CPP_NAMESPACE_QUALIFIER XMLInputStream& stream) { bool read = false; return read; @@ -2113,7 +2349,7 @@ CaBase::readOtherXML (XMLInputStream& stream) * @return true if read an element from the stream */ bool -CaBase::readAnnotation (XMLInputStream& stream) +CaBase::readAnnotation (LIBSBML_CPP_NAMESPACE_QUALIFIER XMLInputStream& stream) { const string& name = stream.peek().getName(); @@ -2130,7 +2366,7 @@ CaBase::readAnnotation (XMLInputStream& stream) } delete mAnnotation; - mAnnotation = new XMLNode(stream); + mAnnotation = new LIBSBML_CPP_NAMESPACE_QUALIFIER XMLNode(stream); checkAnnotation(); return true; } @@ -2145,7 +2381,7 @@ CaBase::readAnnotation (XMLInputStream& stream) * @return true if read a element from the stream */ bool -CaBase::readNotes (XMLInputStream& stream) +CaBase::readNotes (LIBSBML_CPP_NAMESPACE_QUALIFIER XMLInputStream& stream) { const string& name = stream.peek().getName(); @@ -2161,13 +2397,13 @@ CaBase::readNotes (XMLInputStream& stream) } delete mNotes; - mNotes = new XMLNode(stream); + mNotes = new LIBSBML_CPP_NAMESPACE_QUALIFIER XMLNode(stream); // // checks if the given default namespace (if any) is a valid // OMEX namespace // - const XMLNamespaces &xmlns = mNotes->getNamespaces(); + const LIBSBML_CPP_NAMESPACE_QUALIFIER XMLNamespaces &xmlns = mNotes->getNamespaces(); checkDefaultNamespace(&xmlns,"notes"); return true; @@ -2336,10 +2572,10 @@ CaBase::addExpectedAttributes(ExpectedAttributes& attributes) * parents implementation of this method as well. */ void -CaBase::readAttributes (const XMLAttributes& attributes, - const ExpectedAttributes& expectedAttributes) +CaBase::readAttributes (const LIBSBML_CPP_NAMESPACE_QUALIFIER XMLAttributes& attributes, + const LIBSBML_CPP_NAMESPACE_QUALIFIER ExpectedAttributes& expectedAttributes) { - const_cast(attributes).setErrorLog(getErrorLog()); + const_cast(attributes).setErrorLog(getErrorLog()); const unsigned int level = getLevel (); const unsigned int version = getVersion(); @@ -2371,7 +2607,7 @@ CaBase::readAttributes (const XMLAttributes& attributes, // if we happen to be on the omex element (document) then // getPrefix() and mURI have not been set and just return defaults // thus a prefix does not appear to come from the right place !!! - if (!prefix.empty() && getElementName() == "omex") + if (!prefix.empty() && getElementName() == "OmexManifest") { if (!expectedAttributes.hasAttribute(name)) { @@ -2412,7 +2648,7 @@ CaBase::getPrefix() const { std::string prefix = ""; - const XMLNamespaces *xmlns = getNamespaces(); + const LIBSBML_CPP_NAMESPACE_QUALIFIER XMLNamespaces *xmlns = getNamespaces(); string uri = getURI(); if(xmlns && mCa) { @@ -2431,7 +2667,7 @@ CaBase::getCaPrefix() const { std::string prefix = ""; - const XMLNamespaces *xmlns = getNamespaces(); + const LIBSBML_CPP_NAMESPACE_QUALIFIER XMLNamespaces *xmlns = getNamespaces(); if (xmlns == NULL) return getPrefix(); @@ -2476,7 +2712,7 @@ CaBase::getRootElement() * of this method as well. */ void -CaBase::writeAttributes (XMLOutputStream& stream) const +CaBase::writeAttributes (LIBSBML_CPP_NAMESPACE_QUALIFIER XMLOutputStream& stream) const { string omexPrefix = getCaPrefix(); if ( !mMetaId.empty() ) @@ -2495,7 +2731,7 @@ CaBase::writeAttributes (XMLOutputStream& stream) const * */ void -CaBase::writeXMLNS (XMLOutputStream& stream) const +CaBase::writeXMLNS (LIBSBML_CPP_NAMESPACE_QUALIFIER XMLOutputStream& stream) const { // do nothing. } @@ -2553,7 +2789,7 @@ int CaBase::removeFromParentAndDelete() /** @cond doxygenLibomexInternal */ const std::string -CaBase::checkMathMLNamespace(const XMLToken elem) +CaBase::checkMathMLNamespace(const LIBSBML_CPP_NAMESPACE_QUALIFIER XMLToken elem) { std::string prefix = ""; unsigned int match = 0; @@ -2599,7 +2835,7 @@ CaBase::checkMathMLNamespace(const XMLToken elem) /** @cond doxygenLibomexInternal */ void -CaBase::checkDefaultNamespace(const XMLNamespaces* xmlns, +CaBase::checkDefaultNamespace(const LIBSBML_CPP_NAMESPACE_QUALIFIER XMLNamespaces* xmlns, const std::string& elementName, const std::string& prefix) { @@ -2649,12 +2885,12 @@ CaBase::checkAnnotation() // checks if the given default namespace (if any) is a valid // OMEX namespace // - const XMLNamespaces &xmlns = mAnnotation->getNamespaces(); + const LIBSBML_CPP_NAMESPACE_QUALIFIER XMLNamespaces &xmlns = mAnnotation->getNamespaces(); checkDefaultNamespace(&xmlns,"annotation"); while (nNodes < mAnnotation->getNumChildren()) { - XMLNode topLevel = mAnnotation->getChild(nNodes); + LIBSBML_CPP_NAMESPACE_QUALIFIER XMLNode topLevel = mAnnotation->getChild(nNodes); // the top level must be an element (so it should be a start) if (topLevel.isStart() == false) @@ -2750,7 +2986,7 @@ CaBase::checkAnnotation() * an omex document, an error is logged. */ void -CaBase::checkXHTML(const XMLNode * xhtml) +CaBase::checkXHTML(const LIBSBML_CPP_NAMESPACE_QUALIFIER XMLNode * xhtml) { if (xhtml == NULL) return; @@ -2766,7 +3002,7 @@ CaBase::checkXHTML(const XMLNode * xhtml) } else // We shouldn't ever get to this point. { - logError(CaUnknownError); + logError(CaUnknown); return; } @@ -2789,7 +3025,7 @@ CaBase::checkXHTML(const XMLNode * xhtml) } } - XMLNamespaces* toplevelNS = (mCa) ? mCa->getNamespaces() : NULL; + LIBSBML_CPP_NAMESPACE_QUALIFIER XMLNamespaces* toplevelNS = (mCa) ? mCa->getNamespaces() : NULL; /* * namespace declaration is variable @@ -2897,14 +3133,14 @@ CaBase::checkCompatibility(const CaBase * object) const * roundtripping) declared on this OMEX (XML) element. */ void -CaBase::setCaBaseFields (const XMLToken& element) +CaBase::setCaBaseFields (const LIBSBML_CPP_NAMESPACE_QUALIFIER XMLToken& element) { mLine = element.getLine (); mColumn = element.getColumn(); if (element.getNamespaces().getLength() > 0) { - XMLNamespaces tmpxmlns(element.getNamespaces()); + LIBSBML_CPP_NAMESPACE_QUALIFIER XMLNamespaces tmpxmlns(element.getNamespaces()); setNamespaces(&tmpxmlns); } else @@ -2937,6 +3173,15 @@ CaBase::getElementNamespace() const #endif /* __cplusplus */ + +LIBCOMBINE_EXTERN +int +CaBase_getTypeCode (const CaBase_t *sb) +{ + return (sb != NULL) ? sb->getTypeCode() : OMEX_UNKNOWN; +} + + LIBCOMBINE_EXTERN const char * CaBase_getMetaId (CaBase_t *sb) diff --git a/dev/generated/src/omex/CaBase.h b/dev/generated/src/omex/CaBase.h index 57f2e08..d1f1672 100644 --- a/dev/generated/src/omex/CaBase.h +++ b/dev/generated/src/omex/CaBase.h @@ -7,7 +7,11 @@ * This file is part of libSBML. Please visit http://sbml.org for more * information about SBML, and the latest version of libSBML. * - * Copyright (C) 2013-2016 jointly by the following organizations: + * Copyright (C) 2019 jointly by the following organizations: + * 1. California Institute of Technology, Pasadena, CA, USA + * 2. University of Heidelberg, Heidelberg, Germany + * + * Copyright (C) 2013-2018 jointly by the following organizations: * 1. California Institute of Technology, Pasadena, CA, USA * 2. EMBL European Bioinformatics Institute (EMBL-EBI), Hinxton, UK * 3. University of Heidelberg, Heidelberg, Germany @@ -30,7 +34,7 @@ * available online as http://sbml.org/software/libsbml/license.html * ------------------------------------------------------------------------ --> * - * @class + * @class CaBase * @sbmlbrief{} TODO:Definition of the CaBase class. */ @@ -41,6 +45,7 @@ #include #include +#include #include #include #include @@ -58,6 +63,7 @@ #include #include +#include LIBSBML_CPP_NAMESPACE_BEGIN @@ -75,7 +81,6 @@ LIBSBML_CPP_NAMESPACE_END LIBCOMBINE_CPP_NAMESPACE_BEGIN -class CaVisitor; class CaOmexManifest; @@ -239,7 +244,7 @@ class LIBCOMBINE_EXTERN CaBase * @see unsetNotes() * @see SyntaxChecker::hasExpectedXHTMLSyntax(@if java XMLNode@endif) */ - XMLNode* getNotes(); + LIBSBML_CPP_NAMESPACE_QUALIFIER XMLNode* getNotes(); /** @@ -265,7 +270,7 @@ class LIBCOMBINE_EXTERN CaBase * @see unsetNotes() * @see SyntaxChecker::hasExpectedXHTMLSyntax(@if java XMLNode@endif) */ - const XMLNode* getNotes() const; + const LIBSBML_CPP_NAMESPACE_QUALIFIER XMLNode* getNotes() const; /** @@ -336,7 +341,7 @@ class LIBCOMBINE_EXTERN CaBase * @see appendAnnotation(const std::string& annotation) * @see unsetAnnotation() */ - XMLNode* getAnnotation (); + LIBSBML_CPP_NAMESPACE_QUALIFIER XMLNode* getAnnotation (); /** @@ -359,7 +364,7 @@ class LIBCOMBINE_EXTERN CaBase * @see appendAnnotation(const std::string& annotation) * @see unsetAnnotation() */ - const XMLNode* getAnnotation () const; + const LIBSBML_CPP_NAMESPACE_QUALIFIER XMLNode* getAnnotation () const; /** @@ -416,7 +421,7 @@ class LIBCOMBINE_EXTERN CaBase * @see getLevel() * @see getVersion() */ - virtual const XMLNamespaces* getNamespaces() const ; + virtual const LIBSBML_CPP_NAMESPACE_QUALIFIER XMLNamespaces* getNamespaces() const ; /** @@ -433,7 +438,7 @@ class LIBCOMBINE_EXTERN CaBase * @see getLevel() * @see getVersion() */ - virtual XMLNamespaces* getNamespaces(); + virtual LIBSBML_CPP_NAMESPACE_QUALIFIER XMLNamespaces* getNamespaces(); /** @@ -738,6 +743,15 @@ class LIBCOMBINE_EXTERN CaBase int setMetaId (const std::string& metaid); + /** + /** + * Sets the value of the "id" attribute of this OMEX object. + * + * @copydetails doc_set_id + */ + virtual int setId(const std::string& sid); + + /** * Sets the value of the "annotation" subelement of this OMEX object. * @@ -781,7 +795,7 @@ class LIBCOMBINE_EXTERN CaBase * @see appendAnnotation(const std::string& annotation) * @see unsetAnnotation() */ - virtual int setAnnotation (XMLNode* annotation); + virtual int setAnnotation (LIBSBML_CPP_NAMESPACE_QUALIFIER XMLNode* annotation); /** @@ -869,7 +883,7 @@ class LIBCOMBINE_EXTERN CaBase * @see appendAnnotation(const std::string& annotation) * @see unsetAnnotation() */ - virtual int appendAnnotation (const XMLNode* annotation); + virtual int appendAnnotation (const LIBSBML_CPP_NAMESPACE_QUALIFIER XMLNode* annotation); /** @@ -970,7 +984,7 @@ class LIBCOMBINE_EXTERN CaBase * @see removeTopLevelAnnotationElement(const std::string elementName, const std::string elementURI) * @see replaceTopLevelAnnotationElement(const std::string&) */ - int replaceTopLevelAnnotationElement(const XMLNode* annotation); + int replaceTopLevelAnnotationElement(const LIBSBML_CPP_NAMESPACE_QUALIFIER XMLNode* annotation); /** @@ -1044,7 +1058,7 @@ class LIBCOMBINE_EXTERN CaBase * @see unsetNotes() * @see SyntaxChecker::hasExpectedXHTMLSyntax(@if java XMLNode@endif) */ - int setNotes(const XMLNode* notes); + int setNotes(const LIBSBML_CPP_NAMESPACE_QUALIFIER XMLNode* notes); /** @@ -1141,7 +1155,7 @@ class LIBCOMBINE_EXTERN CaBase * @see unsetNotes() * @see SyntaxChecker::hasExpectedXHTMLSyntax(@if java XMLNode@endif) */ - int appendNotes(const XMLNode* notes); + int appendNotes(const LIBSBML_CPP_NAMESPACE_QUALIFIER XMLNode* notes); /** @@ -1252,7 +1266,7 @@ class LIBCOMBINE_EXTERN CaBase * @copydetails doc_returns_success_code * @li @omexconstant{LIBCOMBINE_OPERATION_SUCCESS, OperationReturnValues_t} */ - int setNamespaces(XMLNamespaces* xmlns); + int setNamespaces(LIBSBML_CPP_NAMESPACE_QUALIFIER XMLNamespaces* xmlns); /** @@ -1262,6 +1276,14 @@ class LIBCOMBINE_EXTERN CaBase int unsetMetaId (); + /** + * Unsets the value of the "id" attribute of this OMEX object. + * + * @copydetails doc_unset_id + */ + virtual int unsetId (); + + /** * Unsets the value of the "notes" subelement of this OMEX object. * @@ -1414,12 +1436,136 @@ class LIBCOMBINE_EXTERN CaBase // ------------------------------------------------------------------ + #ifndef SWIG + /** @cond doxygenLibomexInternal */ + + + virtual int getAttribute(const std::string& attributeName, double& value) const; + + /** @endcond */ + + /** @cond doxygenLibomexInternal */ + + virtual int getAttribute(const std::string& attributeName, bool& value) const; + + /** @endcond */ + + /** @cond doxygenLibomexInternal */ + + virtual int getAttribute(const std::string& attributeName, int& value) const; + + /** @endcond */ + + /** @cond doxygenLibomexInternal */ + + virtual int getAttribute(const std::string& attributeName, unsigned int& value) const; + + /** @endcond */ + + /** @cond doxygenLibomexInternal */ + + virtual int getAttribute(const std::string& attributeName, std::string& value) const; + + /** @endcond */ + +// virtual int getAttribute(const std::string& attributeName, const char * value) const; + + + virtual bool isSetAttribute(const std::string& attributeName) const; + + /** @endcond */ + + /** @cond doxygenLibomexInternal */ + + virtual int setAttribute(const std::string& attributeName, double value); + + /** @endcond */ + + /** @cond doxygenLibomexInternal */ + + virtual int setAttribute(const std::string& attributeName, bool value); + + /** @endcond */ + + /** @cond doxygenLibomexInternal */ + + virtual int setAttribute(const std::string& attributeName, int value); + + /** @endcond */ + + /** @cond doxygenLibomexInternal */ + + virtual int setAttribute(const std::string& attributeName, unsigned int value); + + /** @endcond */ + + /** @cond doxygenLibomexInternal */ + + virtual int setAttribute(const std::string& attributeName, const std::string& value); + + /** @endcond */ + + /** @cond doxygenLibomexInternal */ + +// virtual int setAttribute(const std::string& attributeName, const char* value); + + /** @endcond */ + + /** @cond doxygenLibomexInternal */ + + virtual int unsetAttribute(const std::string& attributeName); + + /** @endcond */ + + /** @cond doxygenLibomexInternal */ + + virtual CaBase* createChildObject(const std::string& elementName); + + /** @endcond */ + + /** @cond doxygenLibomexInternal */ + + virtual int addChildObject(const std::string& elementName, const CaBase* element); + + /** @endcond */ + + /** @cond doxygenLibomexInternal */ + + virtual CaBase* removeChildObject(const std::string& elementName, const std::string& id); + + /** @endcond */ + + /** @cond doxygenLibomexInternal */ + + virtual unsigned int getNumObjects(const std::string& objectName); + + /** @endcond */ + + /** @cond doxygenLibomexInternal */ + + virtual CaBase* getObject(const std::string& objectName, unsigned int index); + + /** @endcond */ + + /** @cond doxygenLibomexInternal */ + + template T getAttribute(const std::string& attributeName) + { + T result; + getAttribute(attributeName, result); + return result; + } + /** @endcond */ + +#endif /* SWIG */ + + /** @cond doxygenLibomexInternal */ /** * Reads (initializes) this OMEX object by reading from XMLInputStream. */ - void read (XMLInputStream& stream); + void read (LIBSBML_CPP_NAMESPACE_QUALIFIER XMLInputStream& stream); /** @endcond */ @@ -1427,7 +1573,7 @@ class LIBCOMBINE_EXTERN CaBase /** * Writes (serializes) this OMEX object by writing it to XMLOutputStream. */ - virtual void write (XMLOutputStream& stream) const; + virtual void write (LIBSBML_CPP_NAMESPACE_QUALIFIER XMLOutputStream& stream) const; /** @endcond */ @@ -1443,7 +1589,7 @@ class LIBCOMBINE_EXTERN CaBase * ... * @endif@~ */ - virtual void writeElements (XMLOutputStream& stream) const; + virtual void writeElements (LIBSBML_CPP_NAMESPACE_QUALIFIER XMLOutputStream& stream) const; /** @endcond */ @@ -1661,7 +1807,7 @@ class LIBCOMBINE_EXTERN CaBase * @return the OMEX object corresponding to next XMLToken in the * XMLInputStream or @c NULL if the token was not recognized. */ - virtual CaBase* createObject (XMLInputStream& stream); + virtual CaBase* createObject (LIBSBML_CPP_NAMESPACE_QUALIFIER XMLInputStream& stream); /** @@ -1678,7 +1824,7 @@ class LIBCOMBINE_EXTERN CaBase * @return @c true if the level, version and namespace values of this * OMEX object correspond to a valid set of values, @c false otherwise. */ - bool hasValidLevelVersionNamespaceCombination(int typecode, XMLNamespaces *xmlns); + bool hasValidLevelVersionNamespaceCombination(int typecode, LIBSBML_CPP_NAMESPACE_QUALIFIER XMLNamespaces *xmlns); /** @@ -1687,7 +1833,7 @@ class LIBCOMBINE_EXTERN CaBase * * @return true if the subclass read from the stream, false otherwise. */ - virtual bool readOtherXML (XMLInputStream& stream); + virtual bool readOtherXML (LIBSBML_CPP_NAMESPACE_QUALIFIER XMLInputStream& stream); /** @@ -1757,8 +1903,8 @@ class LIBCOMBINE_EXTERN CaBase * XMLAttributes set into their specific fields. Be sure to call your * parents implementation of this method as well. */ - virtual void readAttributes (const XMLAttributes& attributes, - const ExpectedAttributes& expectedAttributes); + virtual void readAttributes (const LIBSBML_CPP_NAMESPACE_QUALIFIER XMLAttributes& attributes, + const LIBSBML_CPP_NAMESPACE_QUALIFIER ExpectedAttributes& expectedAttributes); /** @@ -1775,7 +1921,7 @@ class LIBCOMBINE_EXTERN CaBase * Be sure to implement wirteXMLNS() function to write xmlns attributes. * */ - virtual void writeAttributes (XMLOutputStream& stream) const; + virtual void writeAttributes (LIBSBML_CPP_NAMESPACE_QUALIFIER XMLOutputStream& stream) const; /** @@ -1784,7 +1930,7 @@ class LIBCOMBINE_EXTERN CaBase * (if any) to the XMLOutputStream. * */ - virtual void writeXMLNS (XMLOutputStream& stream) const; + virtual void writeXMLNS (LIBSBML_CPP_NAMESPACE_QUALIFIER XMLOutputStream& stream) const; /** @@ -1798,7 +1944,7 @@ class LIBCOMBINE_EXTERN CaBase * Checks that the given default namespace in the given element is valid. * If the given default namespace is not valid, an error is logged. */ - void checkDefaultNamespace(const XMLNamespaces* xmlns, + void checkDefaultNamespace(const LIBSBML_CPP_NAMESPACE_QUALIFIER XMLNamespaces* xmlns, const std::string& elementName, const std::string& prefix = ""); /** @@ -1813,13 +1959,13 @@ class LIBCOMBINE_EXTERN CaBase * If the xhtml does not conform to the specification of valid xhtml within * an omex document, an error is logged. */ - void checkXHTML(const XMLNode *); + void checkXHTML(const LIBSBML_CPP_NAMESPACE_QUALIFIER XMLNode *); /** * Checks that the math ml ns has been declared */ - const std::string checkMathMLNamespace(const XMLToken elem); + const std::string checkMathMLNamespace(const LIBSBML_CPP_NAMESPACE_QUALIFIER XMLToken elem); /** * Sets the XML namespace to which this element belongs to. @@ -1872,8 +2018,9 @@ class LIBCOMBINE_EXTERN CaBase std::string mMetaId; - XMLNode* mNotes; - XMLNode* mAnnotation; + std::string mId; + LIBSBML_CPP_NAMESPACE_QUALIFIER XMLNode* mNotes; + LIBSBML_CPP_NAMESPACE_QUALIFIER XMLNode* mAnnotation; CaOmexManifest* mCa; CaNamespaces* mCaNamespaces; void* mUserData; @@ -1914,7 +2061,7 @@ class LIBCOMBINE_EXTERN CaBase * Stores the location (line and column) and any XML namespaces (for * roundtripping) declared on this OMEX (XML) element. */ - void setCaBaseFields (const XMLToken& element); + void setCaBaseFields (const LIBSBML_CPP_NAMESPACE_QUALIFIER XMLToken& element); /** @@ -1922,7 +2069,7 @@ class LIBCOMBINE_EXTERN CaBase * * @return true if read an element from the stream */ - bool readAnnotation (XMLInputStream& stream); + bool readAnnotation (LIBSBML_CPP_NAMESPACE_QUALIFIER XMLInputStream& stream); /** @@ -1930,7 +2077,7 @@ class LIBCOMBINE_EXTERN CaBase * * @return true if read a element from the stream */ - bool readNotes (XMLInputStream& stream); + bool readNotes (LIBSBML_CPP_NAMESPACE_QUALIFIER XMLInputStream& stream); /** @endcond */ diff --git a/dev/generated/src/omex/CaConstructorException.cpp b/dev/generated/src/omex/CaConstructorException.cpp index ddcc4ce..2112328 100644 --- a/dev/generated/src/omex/CaConstructorException.cpp +++ b/dev/generated/src/omex/CaConstructorException.cpp @@ -7,7 +7,11 @@ * This file is part of libSBML. Please visit http://sbml.org for more * information about SBML, and the latest version of libSBML. * - * Copyright (C) 2013-2016 jointly by the following organizations: + * Copyright (C) 2019 jointly by the following organizations: + * 1. California Institute of Technology, Pasadena, CA, USA + * 2. University of Heidelberg, Heidelberg, Germany + * + * Copyright (C) 2013-2018 jointly by the following organizations: * 1. California Institute of Technology, Pasadena, CA, USA * 2. EMBL European Bioinformatics Institute (EMBL-EBI), Hinxton, UK * 3. University of Heidelberg, Heidelberg, Germany diff --git a/dev/generated/src/omex/CaConstructorException.h b/dev/generated/src/omex/CaConstructorException.h index c0dba50..fd6955b 100644 --- a/dev/generated/src/omex/CaConstructorException.h +++ b/dev/generated/src/omex/CaConstructorException.h @@ -7,7 +7,11 @@ * This file is part of libSBML. Please visit http://sbml.org for more * information about SBML, and the latest version of libSBML. * - * Copyright (C) 2013-2016 jointly by the following organizations: + * Copyright (C) 2019 jointly by the following organizations: + * 1. California Institute of Technology, Pasadena, CA, USA + * 2. University of Heidelberg, Heidelberg, Germany + * + * Copyright (C) 2013-2018 jointly by the following organizations: * 1. California Institute of Technology, Pasadena, CA, USA * 2. EMBL European Bioinformatics Institute (EMBL-EBI), Hinxton, UK * 3. University of Heidelberg, Heidelberg, Germany @@ -30,7 +34,7 @@ * available online as http://sbml.org/software/libsbml/license.html * ------------------------------------------------------------------------ --> * - * @class + * @class CaConstructorException * @sbmlbrief{} TODO:Definition of the CaConstructorException class. */ diff --git a/dev/generated/src/omex/CaContent.cpp b/dev/generated/src/omex/CaContent.cpp index a5ba1a6..4b012d1 100644 --- a/dev/generated/src/omex/CaContent.cpp +++ b/dev/generated/src/omex/CaContent.cpp @@ -7,7 +7,11 @@ * This file is part of libSBML. Please visit http://sbml.org for more * information about SBML, and the latest version of libSBML. * - * Copyright (C) 2013-2016 jointly by the following organizations: + * Copyright (C) 2019 jointly by the following organizations: + * 1. California Institute of Technology, Pasadena, CA, USA + * 2. University of Heidelberg, Heidelberg, Germany + * + * Copyright (C) 2013-2018 jointly by the following organizations: * 1. California Institute of Technology, Pasadena, CA, USA * 2. EMBL European Bioinformatics Institute (EMBL-EBI), Hinxton, UK * 3. University of Heidelberg, Heidelberg, Germany @@ -56,7 +60,9 @@ CaContent::CaContent() , mFormat ("") , mMaster (false) , mIsSetMaster (false) + , mCrossRefs () { + connectToChild(); } @@ -69,8 +75,10 @@ CaContent::CaContent(CaNamespaces *omexns) , mFormat ("") , mMaster (false) , mIsSetMaster (false) + , mCrossRefs (omexns) { setElementNamespace(omexns->getURI()); + connectToChild(); } @@ -83,7 +91,9 @@ CaContent::CaContent(const CaContent& orig) , mFormat ( orig.mFormat ) , mMaster ( orig.mMaster ) , mIsSetMaster ( orig.mIsSetMaster ) + , mCrossRefs ( orig.mCrossRefs ) { + connectToChild(); } @@ -100,6 +110,8 @@ CaContent::operator=(const CaContent& rhs) mFormat = rhs.mFormat; mMaster = rhs.mMaster; mIsSetMaster = rhs.mIsSetMaster; + mCrossRefs = rhs.mCrossRefs; + connectToChild(); } return *this; @@ -276,6 +288,126 @@ CaContent::unsetMaster() } +/* + * Returns the CaListOfCrossRefs from this CaContent. + */ +const CaListOfCrossRefs* +CaContent::getListOfCrossRefs() const +{ + return &mCrossRefs; +} + + +/* + * Returns the CaListOfCrossRefs from this CaContent. + */ +CaListOfCrossRefs* +CaContent::getListOfCrossRefs() +{ + return &mCrossRefs; +} + + +/* + * Get a CaCrossRef from the CaContent. + */ +CaCrossRef* +CaContent::getCrossRef(unsigned int n) +{ + return mCrossRefs.get(n); +} + + +/* + * Get a CaCrossRef from the CaContent. + */ +const CaCrossRef* +CaContent::getCrossRef(unsigned int n) const +{ + return mCrossRefs.get(n); +} + + +/* + * Adds a copy of the given CaCrossRef to this CaContent. + */ +int +CaContent::addCrossRef(const CaCrossRef* ccr) +{ + if (ccr == NULL) + { + return LIBCOMBINE_OPERATION_FAILED; + } + else if (ccr->hasRequiredAttributes() == false) + { + return LIBCOMBINE_INVALID_OBJECT; + } + else if (getLevel() != ccr->getLevel()) + { + return LIBCOMBINE_LEVEL_MISMATCH; + } + else if (getVersion() != ccr->getVersion()) + { + return LIBCOMBINE_VERSION_MISMATCH; + } + else if (matchesRequiredCaNamespacesForAddition(static_cast(ccr)) == false) + { + return LIBCOMBINE_NAMESPACES_MISMATCH; + } + else + { + return mCrossRefs.append(ccr); + } +} + + +/* + * Get the number of CaCrossRef objects in this CaContent. + */ +unsigned int +CaContent::getNumCrossRefs() const +{ + return mCrossRefs.size(); +} + + +/* + * Creates a new CaCrossRef object, adds it to this CaContent object and + * returns the CaCrossRef object created. + */ +CaCrossRef* +CaContent::createCrossRef() +{ + CaCrossRef* ccr = NULL; + + try + { + ccr = new CaCrossRef(getCaNamespaces()); + } + catch (...) + { + } + + if (ccr != NULL) + { + mCrossRefs.appendAndOwn(ccr); + } + + return ccr; +} + + +/* + * Removes the nth CaCrossRef from this CaContent and returns a pointer to it. + */ +CaCrossRef* +CaContent::removeCrossRef(unsigned int n) +{ + return mCrossRefs.remove(n); +} + + /* * Returns the XML element name of this CaContent object. */ @@ -331,6 +463,11 @@ CaContent::writeElements(LIBSBML_CPP_NAMESPACE_QUALIFIER XMLOutputStream& stream) const { CaBase::writeElements(stream); + + for (unsigned int i = 0; i < getNumCrossRefs(); i++) + { + getCrossRef(i)->write(stream); + } } /** @endcond */ @@ -361,6 +498,467 @@ void CaContent::setCaOmexManifest(CaOmexManifest* d) { CaBase::setCaOmexManifest(d); + + mCrossRefs.setCaOmexManifest(d); +} + +/** @endcond */ + + + +/** @cond doxygenlibCombineInternal */ + +/* + * Connects to child elements + */ +void +CaContent::connectToChild() +{ + CaBase::connectToChild(); + + mCrossRefs.connectToParent(this); +} + +/** @endcond */ + + + +/** @cond doxygenlibCombineInternal */ + +/* + * Gets the value of the "attributeName" attribute of this CaContent. + */ +int +CaContent::getAttribute(const std::string& attributeName, bool& value) const +{ + int return_value = CaBase::getAttribute(attributeName, value); + + if (return_value == LIBCOMBINE_OPERATION_SUCCESS) + { + return return_value; + } + + if (attributeName == "master") + { + value = getMaster(); + return_value = LIBCOMBINE_OPERATION_SUCCESS; + } + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenlibCombineInternal */ + +/* + * Gets the value of the "attributeName" attribute of this CaContent. + */ +int +CaContent::getAttribute(const std::string& attributeName, int& value) const +{ + int return_value = CaBase::getAttribute(attributeName, value); + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenlibCombineInternal */ + +/* + * Gets the value of the "attributeName" attribute of this CaContent. + */ +int +CaContent::getAttribute(const std::string& attributeName, double& value) const +{ + int return_value = CaBase::getAttribute(attributeName, value); + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenlibCombineInternal */ + +/* + * Gets the value of the "attributeName" attribute of this CaContent. + */ +int +CaContent::getAttribute(const std::string& attributeName, + unsigned int& value) const +{ + int return_value = CaBase::getAttribute(attributeName, value); + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenlibCombineInternal */ + +/* + * Gets the value of the "attributeName" attribute of this CaContent. + */ +int +CaContent::getAttribute(const std::string& attributeName, + std::string& value) const +{ + int return_value = CaBase::getAttribute(attributeName, value); + + if (return_value == LIBCOMBINE_OPERATION_SUCCESS) + { + return return_value; + } + + if (attributeName == "location") + { + value = getLocation(); + return_value = LIBCOMBINE_OPERATION_SUCCESS; + } + else if (attributeName == "format") + { + value = getFormat(); + return_value = LIBCOMBINE_OPERATION_SUCCESS; + } + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenlibCombineInternal */ + +/* + * Predicate returning @c true if this CaContent's attribute "attributeName" is + * set. + */ +bool +CaContent::isSetAttribute(const std::string& attributeName) const +{ + bool value = CaBase::isSetAttribute(attributeName); + + if (attributeName == "location") + { + value = isSetLocation(); + } + else if (attributeName == "format") + { + value = isSetFormat(); + } + else if (attributeName == "master") + { + value = isSetMaster(); + } + + return value; +} + +/** @endcond */ + + + +/** @cond doxygenlibCombineInternal */ + +/* + * Sets the value of the "attributeName" attribute of this CaContent. + */ +int +CaContent::setAttribute(const std::string& attributeName, bool value) +{ + int return_value = CaBase::setAttribute(attributeName, value); + + if (attributeName == "master") + { + return_value = setMaster(value); + } + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenlibCombineInternal */ + +/* + * Sets the value of the "attributeName" attribute of this CaContent. + */ +int +CaContent::setAttribute(const std::string& attributeName, int value) +{ + int return_value = CaBase::setAttribute(attributeName, value); + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenlibCombineInternal */ + +/* + * Sets the value of the "attributeName" attribute of this CaContent. + */ +int +CaContent::setAttribute(const std::string& attributeName, double value) +{ + int return_value = CaBase::setAttribute(attributeName, value); + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenlibCombineInternal */ + +/* + * Sets the value of the "attributeName" attribute of this CaContent. + */ +int +CaContent::setAttribute(const std::string& attributeName, unsigned int value) +{ + int return_value = CaBase::setAttribute(attributeName, value); + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenlibCombineInternal */ + +/* + * Sets the value of the "attributeName" attribute of this CaContent. + */ +int +CaContent::setAttribute(const std::string& attributeName, + const std::string& value) +{ + int return_value = CaBase::setAttribute(attributeName, value); + + if (attributeName == "location") + { + return_value = setLocation(value); + } + else if (attributeName == "format") + { + return_value = setFormat(value); + } + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenlibCombineInternal */ + +/* + * Unsets the value of the "attributeName" attribute of this CaContent. + */ +int +CaContent::unsetAttribute(const std::string& attributeName) +{ + int value = CaBase::unsetAttribute(attributeName); + + if (attributeName == "location") + { + value = unsetLocation(); + } + else if (attributeName == "format") + { + value = unsetFormat(); + } + else if (attributeName == "master") + { + value = unsetMaster(); + } + + return value; +} + +/** @endcond */ + + + +/** @cond doxygenlibCombineInternal */ + +/* + * Creates and returns an new "elementName" object in this CaContent. + */ +CaBase* +CaContent::createChildObject(const std::string& elementName) +{ + CaBase* obj = NULL; + + if (elementName == "crossRef") + { + return createCrossRef(); + } + + return obj; +} + +/** @endcond */ + + + +/** @cond doxygenlibCombineInternal */ + +/* + * Adds a new "elementName" object to this CaContent. + */ +int +CaContent::addChildObject(const std::string& elementName, + const CaBase* element) +{ + if (elementName == "crossRef" && element->getTypeCode() == + LIB_COMBINE_CROSSREF) + { + return addCrossRef((const CaCrossRef*)(element)); + } + + return LIBSBML_OPERATION_FAILED; +} + +/** @endcond */ + + + +/** @cond doxygenlibCombineInternal */ + +/* + * Removes and returns the new "elementName" object with the given id in this + * CaContent. + */ +CaBase* +CaContent::removeChildObject(const std::string& elementName, + const std::string& id) +{ + if (elementName == "crossRef") + { + for (unsigned int i = 0; i < getNumCrossRefs(); i++) + { + if (getCrossRef(i)->getId() == id) + { + return removeCrossRef(i); + } + } + } + + return NULL; +} + +/** @endcond */ + + + +/** @cond doxygenlibCombineInternal */ + +/* + * Returns the number of "elementName" in this CaContent. + */ +unsigned int +CaContent::getNumObjects(const std::string& elementName) +{ + unsigned int n = 0; + + if (elementName == "crossRef") + { + return getNumCrossRefs(); + } + + return n; +} + +/** @endcond */ + + + +/** @cond doxygenlibCombineInternal */ + +/* + * Returns the nth object of "objectName" in this CaContent. + */ +CaBase* +CaContent::getObject(const std::string& elementName, unsigned int index) +{ + CaBase* obj = NULL; + + if (elementName == "crossRef") + { + return getCrossRef(index); + } + + return obj; +} + +/** @endcond */ + + +/* + * Returns the first child element that has the given @p id in the model-wide + * SId namespace, or @c NULL if no such object is found. + */ +CaBase* +CaContent::getElementBySId(const std::string& id) +{ + if (id.empty()) + { + return NULL; + } + + CaBase* obj = NULL; + + obj = mCrossRefs.getElementBySId(id); + + if (obj != NULL) + { + return obj; + } + + return obj; +} + + + +/** @cond doxygenlibCombineInternal */ + +/* + * Creates a new object from the next XMLToken on the XMLInputStream + */ +CaBase* +CaContent::createObject(LIBSBML_CPP_NAMESPACE_QUALIFIER XMLInputStream& stream) +{ + CaBase* obj = NULL; + + const std::string& name = stream.peek().getName(); + + if (name == "crossRef") + { + obj = mCrossRefs.createObject(stream); + } + + connectToChild(); + + return obj; } /** @endcond */ @@ -407,7 +1005,8 @@ CaContent::readAttributes( bool assigned = false; CaErrorLog* log = getErrorLog(); - if (static_cast(getParentCaObject())->size() < 2) + if (log && getParentCaObject() && + static_cast(getParentCaObject())->size() < 2) { numErrs = log->getNumErrors(); for (int n = numErrs-1; n >= 0; n--) @@ -416,23 +1015,26 @@ CaContent::readAttributes( { const std::string details = log->getError(n)->getMessage(); log->remove(CaUnknownCoreAttribute); - log->logError(CombineCaOmexManifestLOContentsAllowedCoreAttributes, - level, version, details); + log->logError(CaUnknown, level, version, details); } } } CaBase::readAttributes(attributes, expectedAttributes); - numErrs = log->getNumErrors(); - for (int n = numErrs-1; n >= 0; n--) + if (log) { - if (log->getError(n)->getErrorId() == CaUnknownCoreAttribute) + numErrs = log->getNumErrors(); + + for (int n = numErrs-1; n >= 0; n--) { - const std::string details = log->getError(n)->getMessage(); - log->remove(CaUnknownCoreAttribute); - log->logError(CombineCaContentAllowedAttributes, level, version, - details); + if (log->getError(n)->getErrorId() == CaUnknownCoreAttribute) + { + const std::string details = log->getError(n)->getMessage(); + log->remove(CaUnknownCoreAttribute); + log->logError(CombineContentAllowedAttributes, level, version, details, + getLine(), getColumn()); + } } } @@ -453,7 +1055,7 @@ CaContent::readAttributes( { std::string message = "Combine attribute 'location' is missing from the " " element."; - log->logError(CombineCaContentAllowedAttributes, level, version, message); + log->logError(CombineContentAllowedAttributes, level, version, message); } // @@ -473,14 +1075,25 @@ CaContent::readAttributes( { std::string message = "Combine attribute 'format' is missing from the " " element."; - log->logError(CombineCaContentAllowedAttributes, level, version, message); + log->logError(CombineContentAllowedAttributes, level, version, message); } // // master bool (use = "optional" ) // + numErrs = log->getNumErrors(); mIsSetMaster = attributes.readInto("master", mMaster); + + if (mIsSetMaster == false) + { + if (log->getNumErrors() == numErrs + 1 && + log->contains(XMLAttributeTypeMismatch)) + { + log->remove(XMLAttributeTypeMismatch); + log->logError(CombineContentMasterMustBeBoolean, level, version); + } + } } /** @endcond */ @@ -569,7 +1182,7 @@ CaContent_free(CaContent_t* cc) * Returns the value of the "location" attribute of this CaContent_t. */ LIBCOMBINE_EXTERN -const char * +char * CaContent_getLocation(const CaContent_t * cc) { if (cc == NULL) @@ -586,7 +1199,7 @@ CaContent_getLocation(const CaContent_t * cc) * Returns the value of the "format" attribute of this CaContent_t. */ LIBCOMBINE_EXTERN -const char * +char * CaContent_getFormat(const CaContent_t * cc) { if (cc == NULL) @@ -610,7 +1223,8 @@ CaContent_getMaster(const CaContent_t * cc) /* - * Predicate returning @c 1 if this CaContent_t's "location" attribute is set. + * Predicate returning @c 1 (true) if this CaContent_t's "location" attribute + * is set. */ LIBCOMBINE_EXTERN int @@ -621,7 +1235,8 @@ CaContent_isSetLocation(const CaContent_t * cc) /* - * Predicate returning @c 1 if this CaContent_t's "format" attribute is set. + * Predicate returning @c 1 (true) if this CaContent_t's "format" attribute is + * set. */ LIBCOMBINE_EXTERN int @@ -632,7 +1247,8 @@ CaContent_isSetFormat(const CaContent_t * cc) /* - * Predicate returning @c 1 if this CaContent_t's "master" attribute is set. + * Predicate returning @c 1 (true) if this CaContent_t's "master" attribute is + * set. */ LIBCOMBINE_EXTERN int @@ -709,8 +1325,76 @@ CaContent_unsetMaster(CaContent_t * cc) /* - * Predicate returning @c 1 if all the required attributes for this CaContent_t - * object have been set. + * Returns a ListOf_t * containing CaCrossRef_t objects from this CaContent_t. + */ +LIBCOMBINE_EXTERN +CaListOf_t* +CaContent_getListOfCrossRefs(CaContent_t* cc) +{ + return (cc != NULL) ? cc->getListOfCrossRefs() : NULL; +} + + +/* + * Get a CaCrossRef_t from the CaContent_t. + */ +LIBCOMBINE_EXTERN +CaCrossRef_t* +CaContent_getCrossRef(CaContent_t* cc, unsigned int n) +{ + return (cc != NULL) ? cc->getCrossRef(n) : NULL; +} + + +/* + * Adds a copy of the given CaCrossRef_t to this CaContent_t. + */ +LIBCOMBINE_EXTERN +int +CaContent_addCrossRef(CaContent_t* cc, const CaCrossRef_t* ccr) +{ + return (cc != NULL) ? cc->addCrossRef(ccr) : LIBCOMBINE_INVALID_OBJECT; +} + + +/* + * Get the number of CaCrossRef_t objects in this CaContent_t. + */ +LIBCOMBINE_EXTERN +unsigned int +CaContent_getNumCrossRefs(CaContent_t* cc) +{ + return (cc != NULL) ? cc->getNumCrossRefs() : OMEX_INT_MAX; +} + + +/* + * Creates a new CaCrossRef_t object, adds it to this CaContent_t object and + * returns the CaCrossRef_t object created. + */ +LIBCOMBINE_EXTERN +CaCrossRef_t* +CaContent_createCrossRef(CaContent_t* cc) +{ + return (cc != NULL) ? cc->createCrossRef() : NULL; +} + + +/* + * Removes the nth CaCrossRef_t from this CaContent_t and returns a pointer to + * it. + */ +LIBCOMBINE_EXTERN +CaCrossRef_t* +CaContent_removeCrossRef(CaContent_t* cc, unsigned int n) +{ + return (cc != NULL) ? cc->removeCrossRef(n) : NULL; +} + + +/* + * Predicate returning @c 1 (true) if all the required attributes for this + * CaContent_t object have been set. */ LIBCOMBINE_EXTERN int diff --git a/dev/generated/src/omex/CaContent.h b/dev/generated/src/omex/CaContent.h index c01f460..13c32b4 100644 --- a/dev/generated/src/omex/CaContent.h +++ b/dev/generated/src/omex/CaContent.h @@ -7,7 +7,11 @@ * This file is part of libSBML. Please visit http://sbml.org for more * information about SBML, and the latest version of libSBML. * - * Copyright (C) 2013-2016 jointly by the following organizations: + * Copyright (C) 2019 jointly by the following organizations: + * 1. California Institute of Technology, Pasadena, CA, USA + * 2. University of Heidelberg, Heidelberg, Germany + * + * Copyright (C) 2013-2018 jointly by the following organizations: * 1. California Institute of Technology, Pasadena, CA, USA * 2. EMBL European Bioinformatics Institute (EMBL-EBI), Hinxton, UK * 3. University of Heidelberg, Heidelberg, Germany @@ -50,6 +54,7 @@ #include +#include #include @@ -66,6 +71,7 @@ class LIBCOMBINE_EXTERN CaContent : public CaBase std::string mFormat; bool mMaster; bool mIsSetMaster; + CaListOfCrossRefs mCrossRefs; /** @endcond */ @@ -82,11 +88,7 @@ class LIBCOMBINE_EXTERN CaContent : public CaBase * * @param omexns the CaNamespaces object. * - * @throws OMEXConstructorException - * Thrown if the given @p level and @p version combination, or this kind of - * OMEX object, are either invalid or mismatched with respect to the parent - * CaOmexManifest object. - * @copydetails doc_note_setting_lv + * @copydetails doc_note_setting_lv_pkg */ CaContent(CaNamespaces *omexns); @@ -181,10 +183,11 @@ class LIBCOMBINE_EXTERN CaContent : public CaBase * * @param location std::string& value of the "location" attribute to be set. * - * @copydetails doc_returns_success_code + * @copydetails doc_returns_one_success_code * @li @omexconstant{LIBCOMBINE_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @omexconstant{LIBCOMBINE_INVALID_ATTRIBUTE_VALUE, - * OperationReturnValues_t} + * + * Calling this function with @p location = @c NULL or an empty string is + * equivalent to calling unsetLocation(). */ int setLocation(const std::string& location); @@ -194,10 +197,11 @@ class LIBCOMBINE_EXTERN CaContent : public CaBase * * @param format std::string& value of the "format" attribute to be set. * - * @copydetails doc_returns_success_code + * @copydetails doc_returns_one_success_code * @li @omexconstant{LIBCOMBINE_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @omexconstant{LIBCOMBINE_INVALID_ATTRIBUTE_VALUE, - * OperationReturnValues_t} + * + * Calling this function with @p format = @c NULL or an empty string is + * equivalent to calling unsetFormat(). */ int setFormat(const std::string& format); @@ -245,6 +249,163 @@ class LIBCOMBINE_EXTERN CaContent : public CaBase int unsetMaster(); + /** + * Returns the CaListOfCrossRefs from this CaContent. + * + * @return the CaListOfCrossRefs from this CaContent. + * + * @copydetails doc_returned_unowned_pointer + * + * @see addCrossRef(const CaCrossRef* object) + * @see createCrossRef() + * @see getCrossRef(const std::string& sid) + * @see getCrossRef(unsigned int n) + * @see getNumCrossRefs() + * @see removeCrossRef(const std::string& sid) + * @see removeCrossRef(unsigned int n) + */ + const CaListOfCrossRefs* getListOfCrossRefs() const; + + + /** + * Returns the CaListOfCrossRefs from this CaContent. + * + * @return the CaListOfCrossRefs from this CaContent. + * + * @copydetails doc_returned_unowned_pointer + * + * @see addCrossRef(const CaCrossRef* object) + * @see createCrossRef() + * @see getCrossRef(const std::string& sid) + * @see getCrossRef(unsigned int n) + * @see getNumCrossRefs() + * @see removeCrossRef(const std::string& sid) + * @see removeCrossRef(unsigned int n) + */ + CaListOfCrossRefs* getListOfCrossRefs(); + + + /** + * Get a CaCrossRef from the CaContent. + * + * @param n an unsigned int representing the index of the CaCrossRef to + * retrieve. + * + * @return the nth CaCrossRef in the CaListOfCrossRefs within this CaContent. + * + * @copydetails doc_returned_unowned_pointer + * + * @see addCrossRef(const CaCrossRef* object) + * @see createCrossRef() + * @see getCrossRef(const std::string& sid) + * @see getNumCrossRefs() + * @see removeCrossRef(const std::string& sid) + * @see removeCrossRef(unsigned int n) + */ + CaCrossRef* getCrossRef(unsigned int n); + + + /** + * Get a CaCrossRef from the CaContent. + * + * @param n an unsigned int representing the index of the CaCrossRef to + * retrieve. + * + * @return the nth CaCrossRef in the CaListOfCrossRefs within this CaContent. + * + * @copydetails doc_returned_unowned_pointer + * + * @see addCrossRef(const CaCrossRef* object) + * @see createCrossRef() + * @see getCrossRef(const std::string& sid) + * @see getNumCrossRefs() + * @see removeCrossRef(const std::string& sid) + * @see removeCrossRef(unsigned int n) + */ + const CaCrossRef* getCrossRef(unsigned int n) const; + + + /** + * Adds a copy of the given CaCrossRef to this CaContent. + * + * @param ccr the CaCrossRef object to add. + * + * @copydetails doc_returns_success_code + * @li @omexconstant{LIBCOMBINE_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @omexconstant{LIBCOMBINE_OPERATION_FAILED, OperationReturnValues_t} + * @li @omexconstant{LIBCOMBINE_INVALID_OBJECT, OperationReturnValues_t} + * @li @omexconstant{LIBCOMBINE_LEVEL_MISMATCH, OperationReturnValues_t} + * @li @omexconstant{LIBCOMBINE_VERSION_MISMATCH, OperationReturnValues_t} + * @li @omexconstant{LIBCOMBINE_PKG_VERSION_MISMATCH, + * OperationReturnValues_t} + * @li @omexconstant{LIBCOMBINE_DUPLICATE_OBJECT_ID, OperationReturnValues_t} + * + * @copydetails doc_note_object_is_copied + * + * @see createCrossRef() + * @see getCrossRef(const std::string& sid) + * @see getCrossRef(unsigned int n) + * @see getNumCrossRefs() + * @see removeCrossRef(const std::string& sid) + * @see removeCrossRef(unsigned int n) + */ + int addCrossRef(const CaCrossRef* ccr); + + + /** + * Get the number of CaCrossRef objects in this CaContent. + * + * @return the number of CaCrossRef objects in this CaContent. + * + * @see addCrossRef(const CaCrossRef* object) + * @see createCrossRef() + * @see getCrossRef(const std::string& sid) + * @see getCrossRef(unsigned int n) + * @see removeCrossRef(const std::string& sid) + * @see removeCrossRef(unsigned int n) + */ + unsigned int getNumCrossRefs() const; + + + /** + * Creates a new CaCrossRef object, adds it to this CaContent object and + * returns the CaCrossRef object created. + * + * @return a new CaCrossRef object instance. + * + * @copydetails doc_returned_unowned_pointer + * + * @see addCrossRef(const CaCrossRef* object) + * @see getCrossRef(const std::string& sid) + * @see getCrossRef(unsigned int n) + * @see getNumCrossRefs() + * @see removeCrossRef(const std::string& sid) + * @see removeCrossRef(unsigned int n) + */ + CaCrossRef* createCrossRef(); + + + /** + * Removes the nth CaCrossRef from this CaContent and returns a pointer to + * it. + * + * @param n an unsigned int representing the index of the CaCrossRef to + * remove. + * + * @return a pointer to the nth CaCrossRef in this CaContent. + * + * @copydetails doc_returned_owned_pointer + * + * @see addCrossRef(const CaCrossRef* object) + * @see createCrossRef() + * @see getCrossRef(const std::string& sid) + * @see getCrossRef(unsigned int n) + * @see getNumCrossRefs() + * @see removeCrossRef(const std::string& sid) + */ + CaCrossRef* removeCrossRef(unsigned int n); + + /** * Returns the XML element name of this CaContent object. * @@ -261,8 +422,7 @@ class LIBCOMBINE_EXTERN CaContent : public CaBase * @copydetails doc_what_are_typecodes * * @return the OMEX type code for this object: - * - * @omexconstant{LIB_COMBINE_CONTENT, OMEXCombineTypeCode_t} + * @omexconstant{LIB_COMBINE_CONTENT, CaTypeCode_t}. * * @copydetails doc_warning_typecodes_not_unique * @@ -320,9 +480,372 @@ class LIBCOMBINE_EXTERN CaContent : public CaBase /** @endcond */ + + /** @cond doxygenlibCombineInternal */ + + /** + * Connects to child elements + */ + virtual void connectToChild(); + + /** @endcond */ + + + + + #ifndef SWIG + + + + /** @cond doxygenlibCombineInternal */ + + /** + * Gets the value of the "attributeName" attribute of this CaContent. + * + * @param attributeName, the name of the attribute to retrieve. + * + * @param value, the address of the value to record. + * + * @copydetails doc_returns_success_code + * @li @omexconstant{LIBCOMBINE_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @omexconstant{LIBCOMBINE_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int getAttribute(const std::string& attributeName, bool& value) + const; + + /** @endcond */ + + + + /** @cond doxygenlibCombineInternal */ + + /** + * Gets the value of the "attributeName" attribute of this CaContent. + * + * @param attributeName, the name of the attribute to retrieve. + * + * @param value, the address of the value to record. + * + * @copydetails doc_returns_success_code + * @li @omexconstant{LIBCOMBINE_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @omexconstant{LIBCOMBINE_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int getAttribute(const std::string& attributeName, int& value) const; + + /** @endcond */ + + + + /** @cond doxygenlibCombineInternal */ + + /** + * Gets the value of the "attributeName" attribute of this CaContent. + * + * @param attributeName, the name of the attribute to retrieve. + * + * @param value, the address of the value to record. + * + * @copydetails doc_returns_success_code + * @li @omexconstant{LIBCOMBINE_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @omexconstant{LIBCOMBINE_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int getAttribute(const std::string& attributeName, + double& value) const; + + /** @endcond */ + + + + /** @cond doxygenlibCombineInternal */ + + /** + * Gets the value of the "attributeName" attribute of this CaContent. + * + * @param attributeName, the name of the attribute to retrieve. + * + * @param value, the address of the value to record. + * + * @copydetails doc_returns_success_code + * @li @omexconstant{LIBCOMBINE_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @omexconstant{LIBCOMBINE_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int getAttribute(const std::string& attributeName, + unsigned int& value) const; + + /** @endcond */ + + + + /** @cond doxygenlibCombineInternal */ + + /** + * Gets the value of the "attributeName" attribute of this CaContent. + * + * @param attributeName, the name of the attribute to retrieve. + * + * @param value, the address of the value to record. + * + * @copydetails doc_returns_success_code + * @li @omexconstant{LIBCOMBINE_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @omexconstant{LIBCOMBINE_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int getAttribute(const std::string& attributeName, + std::string& value) const; + + /** @endcond */ + + + + /** @cond doxygenlibCombineInternal */ + + /** + * Predicate returning @c true if this CaContent's attribute "attributeName" + * is set. + * + * @param attributeName, the name of the attribute to query. + * + * @return @c true if this CaContent's attribute "attributeName" has been + * set, otherwise @c false is returned. + */ + virtual bool isSetAttribute(const std::string& attributeName) const; + + /** @endcond */ + + + + /** @cond doxygenlibCombineInternal */ + + /** + * Sets the value of the "attributeName" attribute of this CaContent. + * + * @param attributeName, the name of the attribute to set. + * + * @param value, the value of the attribute to set. + * + * @copydetails doc_returns_success_code + * @li @omexconstant{LIBCOMBINE_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @omexconstant{LIBCOMBINE_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int setAttribute(const std::string& attributeName, bool value); + + /** @endcond */ + + + + /** @cond doxygenlibCombineInternal */ + + /** + * Sets the value of the "attributeName" attribute of this CaContent. + * + * @param attributeName, the name of the attribute to set. + * + * @param value, the value of the attribute to set. + * + * @copydetails doc_returns_success_code + * @li @omexconstant{LIBCOMBINE_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @omexconstant{LIBCOMBINE_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int setAttribute(const std::string& attributeName, int value); + + /** @endcond */ + + + + /** @cond doxygenlibCombineInternal */ + + /** + * Sets the value of the "attributeName" attribute of this CaContent. + * + * @param attributeName, the name of the attribute to set. + * + * @param value, the value of the attribute to set. + * + * @copydetails doc_returns_success_code + * @li @omexconstant{LIBCOMBINE_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @omexconstant{LIBCOMBINE_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int setAttribute(const std::string& attributeName, double value); + + /** @endcond */ + + + + /** @cond doxygenlibCombineInternal */ + + /** + * Sets the value of the "attributeName" attribute of this CaContent. + * + * @param attributeName, the name of the attribute to set. + * + * @param value, the value of the attribute to set. + * + * @copydetails doc_returns_success_code + * @li @omexconstant{LIBCOMBINE_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @omexconstant{LIBCOMBINE_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int setAttribute(const std::string& attributeName, + unsigned int value); + + /** @endcond */ + + + + /** @cond doxygenlibCombineInternal */ + + /** + * Sets the value of the "attributeName" attribute of this CaContent. + * + * @param attributeName, the name of the attribute to set. + * + * @param value, the value of the attribute to set. + * + * @copydetails doc_returns_success_code + * @li @omexconstant{LIBCOMBINE_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @omexconstant{LIBCOMBINE_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int setAttribute(const std::string& attributeName, + const std::string& value); + + /** @endcond */ + + + + /** @cond doxygenlibCombineInternal */ + + /** + * Unsets the value of the "attributeName" attribute of this CaContent. + * + * @param attributeName, the name of the attribute to query. + * + * @copydetails doc_returns_success_code + * @li @omexconstant{LIBCOMBINE_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @omexconstant{LIBCOMBINE_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int unsetAttribute(const std::string& attributeName); + + /** @endcond */ + + + + /** @cond doxygenlibCombineInternal */ + + /** + * Creates and returns an new "elementName" object in this CaContent. + * + * @param elementName, the name of the element to create. + * + * @return pointer to the element created. + */ + virtual CaBase* createChildObject(const std::string& elementName); + + /** @endcond */ + + + + /** @cond doxygenlibCombineInternal */ + + /** + * Adds a new "elementName" object to this CaContent. + * + * @param elementName, the name of the element to create. + * + * @param element, pointer to the element to be added. + * + * @copydetails doc_returns_success_code + * @li @omexconstant{LIBCOMBINE_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @omexconstant{LIBCOMBINE_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int addChildObject(const std::string& elementName, + const CaBase* element); + + /** @endcond */ + + + + /** @cond doxygenlibCombineInternal */ + + /** + * Removes and returns the new "elementName" object with the given id in this + * CaContent. + * + * @param elementName, the name of the element to remove. + * + * @param id, the id of the element to remove. + * + * @return pointer to the element removed. + */ + virtual CaBase* removeChildObject(const std::string& elementName, + const std::string& id); + + /** @endcond */ + + + + /** @cond doxygenlibCombineInternal */ + + /** + * Returns the number of "elementName" in this CaContent. + * + * @param elementName, the name of the element to get number of. + * + * @return unsigned int number of elements. + */ + virtual unsigned int getNumObjects(const std::string& elementName); + + /** @endcond */ + + + + /** @cond doxygenlibCombineInternal */ + + /** + * Returns the nth object of "objectName" in this CaContent. + * + * @param elementName, the name of the element to get number of. + * + * @param index, unsigned int the index of the object to retrieve. + * + * @return pointer to the object. + */ + virtual CaBase* getObject(const std::string& elementName, unsigned int + index); + + /** @endcond */ + + + + + #endif /* !SWIG */ + + + /** + * Returns the first child element that has the given @p id in the model-wide + * SId namespace, or @c NULL if no such object is found. + * + * @param id a string representing the id attribute of the object to + * retrieve. + * + * @return a pointer to the CaBase element with the given @p id. If no such + * object is found, this method returns @c NULL. + */ + virtual CaBase* getElementBySId(const std::string& id); + + protected: + /** @cond doxygenlibCombineInternal */ + + /** + * Creates a new object from the next XMLToken on the XMLInputStream + */ + virtual CaBase* createObject(LIBSBML_CPP_NAMESPACE_QUALIFIER XMLInputStream& + stream); + + /** @endcond */ + + + /** @cond doxygenlibCombineInternal */ /** @@ -405,6 +928,8 @@ CaContent_create(); * * @return a (deep) copy of this CaContent_t object. * + * @copydetails doc_returned_owned_pointer + * * @memberof CaContent_t */ LIBCOMBINE_EXTERN @@ -432,10 +957,12 @@ CaContent_free(CaContent_t* cc); * @return the value of the "location" attribute of this CaContent_t as a * pointer to a string. * + * @copydetails doc_returned_owned_char + * * @memberof CaContent_t */ LIBCOMBINE_EXTERN -const char * +char * CaContent_getLocation(const CaContent_t * cc); @@ -447,10 +974,12 @@ CaContent_getLocation(const CaContent_t * cc); * @return the value of the "format" attribute of this CaContent_t as a pointer * to a string. * + * @copydetails doc_returned_owned_char + * * @memberof CaContent_t */ LIBCOMBINE_EXTERN -const char * +char * CaContent_getFormat(const CaContent_t * cc); @@ -470,12 +999,13 @@ CaContent_getMaster(const CaContent_t * cc); /** - * Predicate returning @c 1 if this CaContent_t's "location" attribute is set. + * Predicate returning @c 1 (true) if this CaContent_t's "location" attribute + * is set. * * @param cc the CaContent_t structure. * - * @return @c 1 if this CaContent_t's "location" attribute has been set, - * otherwise @c 0 is returned. + * @return @c 1 (true) if this CaContent_t's "location" attribute has been set, + * otherwise @c 0 (false) is returned. * * @memberof CaContent_t */ @@ -485,12 +1015,13 @@ CaContent_isSetLocation(const CaContent_t * cc); /** - * Predicate returning @c 1 if this CaContent_t's "format" attribute is set. + * Predicate returning @c 1 (true) if this CaContent_t's "format" attribute is + * set. * * @param cc the CaContent_t structure. * - * @return @c 1 if this CaContent_t's "format" attribute has been set, - * otherwise @c 0 is returned. + * @return @c 1 (true) if this CaContent_t's "format" attribute has been set, + * otherwise @c 0 (false) is returned. * * @memberof CaContent_t */ @@ -500,12 +1031,13 @@ CaContent_isSetFormat(const CaContent_t * cc); /** - * Predicate returning @c 1 if this CaContent_t's "master" attribute is set. + * Predicate returning @c 1 (true) if this CaContent_t's "master" attribute is + * set. * * @param cc the CaContent_t structure. * - * @return @c 1 if this CaContent_t's "master" attribute has been set, - * otherwise @c 0 is returned. + * @return @c 1 (true) if this CaContent_t's "master" attribute has been set, + * otherwise @c 0 (false) is returned. * * @memberof CaContent_t */ @@ -523,8 +1055,10 @@ CaContent_isSetMaster(const CaContent_t * cc); * * @copydetails doc_returns_success_code * @li @omexconstant{LIBCOMBINE_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @omexconstant{LIBCOMBINE_INVALID_ATTRIBUTE_VALUE, - * OperationReturnValues_t} + * @li @omexconstant{LIBCOMBINE_INVALID_OBJECT, OperationReturnValues_t} + * + * Calling this function with @p location = @c NULL or an empty string is + * equivalent to calling CaContent_unsetLocation(). * * @memberof CaContent_t */ @@ -542,8 +1076,10 @@ CaContent_setLocation(CaContent_t * cc, const char * location); * * @copydetails doc_returns_success_code * @li @omexconstant{LIBCOMBINE_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @omexconstant{LIBCOMBINE_INVALID_ATTRIBUTE_VALUE, - * OperationReturnValues_t} + * @li @omexconstant{LIBCOMBINE_INVALID_OBJECT, OperationReturnValues_t} + * + * Calling this function with @p format = @c NULL or an empty string is + * equivalent to calling CaContent_unsetFormat(). * * @memberof CaContent_t */ @@ -563,6 +1099,7 @@ CaContent_setFormat(CaContent_t * cc, const char * format); * @li @omexconstant{LIBCOMBINE_OPERATION_SUCCESS, OperationReturnValues_t} * @li @omexconstant{LIBCOMBINE_INVALID_ATTRIBUTE_VALUE, * OperationReturnValues_t} + * @li @omexconstant{LIBCOMBINE_INVALID_OBJECT, OperationReturnValues_t} * * @memberof CaContent_t */ @@ -579,6 +1116,7 @@ CaContent_setMaster(CaContent_t * cc, int master); * @copydetails doc_returns_success_code * @li @omexconstant{LIBCOMBINE_OPERATION_SUCCESS, OperationReturnValues_t} * @li @omexconstant{LIBCOMBINE_OPERATION_FAILED, OperationReturnValues_t} + * @li @omexconstant{LIBCOMBINE_INVALID_OBJECT, OperationReturnValues_t} * * @memberof CaContent_t */ @@ -595,6 +1133,7 @@ CaContent_unsetLocation(CaContent_t * cc); * @copydetails doc_returns_success_code * @li @omexconstant{LIBCOMBINE_OPERATION_SUCCESS, OperationReturnValues_t} * @li @omexconstant{LIBCOMBINE_OPERATION_FAILED, OperationReturnValues_t} + * @li @omexconstant{LIBCOMBINE_INVALID_OBJECT, OperationReturnValues_t} * * @memberof CaContent_t */ @@ -611,6 +1150,7 @@ CaContent_unsetFormat(CaContent_t * cc); * @copydetails doc_returns_success_code * @li @omexconstant{LIBCOMBINE_OPERATION_SUCCESS, OperationReturnValues_t} * @li @omexconstant{LIBCOMBINE_OPERATION_FAILED, OperationReturnValues_t} + * @li @omexconstant{LIBCOMBINE_INVALID_OBJECT, OperationReturnValues_t} * * @memberof CaContent_t */ @@ -620,13 +1160,132 @@ CaContent_unsetMaster(CaContent_t * cc); /** - * Predicate returning @c 1 if all the required attributes for this CaContent_t - * object have been set. + * Returns a ListOf_t * containing CaCrossRef_t objects from this CaContent_t. + * + * @param cc the CaContent_t structure whose CaListOfCrossRefs is sought. + * + * @return the CaListOfCrossRefs from this CaContent_t as a ListOf_t *. + * + * @copydetails doc_returned_unowned_pointer + * + * @see CaContent_addCrossRef() + * @see CaContent_createCrossRef() + * @see CaContent_getCrossRefById() + * @see CaContent_getCrossRef() + * @see CaContent_getNumCrossRefs() + * @see CaContent_removeCrossRefById() + * @see CaContent_removeCrossRef() + * + * @memberof CaContent_t + */ +LIBCOMBINE_EXTERN +CaListOf_t* +CaContent_getListOfCrossRefs(CaContent_t* cc); + + +/** + * Get a CaCrossRef_t from the CaContent_t. + * + * @param cc the CaContent_t structure to search. + * + * @param n an unsigned int representing the index of the CaCrossRef_t to + * retrieve. + * + * @return the nth CaCrossRef_t in the CaListOfCrossRefs within this CaContent. + * + * @copydetails doc_returned_unowned_pointer + * + * @memberof CaContent_t + */ +LIBCOMBINE_EXTERN +CaCrossRef_t* +CaContent_getCrossRef(CaContent_t* cc, unsigned int n); + + +/** + * Adds a copy of the given CaCrossRef_t to this CaContent_t. + * + * @param cc the CaContent_t structure to which the CaCrossRef_t should be + * added. + * + * @param ccr the CaCrossRef_t object to add. + * + * @copydetails doc_returns_success_code + * @li @omexconstant{LIBCOMBINE_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @omexconstant{LIBCOMBINE_OPERATION_FAILED, OperationReturnValues_t} + * @li @omexconstant{LIBCOMBINE_INVALID_OBJECT, OperationReturnValues_t} + * @li @omexconstant{LIBCOMBINE_LEVEL_MISMATCH, OperationReturnValues_t} + * @li @omexconstant{LIBCOMBINE_VERSION_MISMATCH, OperationReturnValues_t} + * @li @omexconstant{LIBCOMBINE_PKG_VERSION_MISMATCH, OperationReturnValues_t} + * @li @omexconstant{LIBCOMBINE_DUPLICATE_OBJECT_ID, OperationReturnValues_t} + * + * @memberof CaContent_t + */ +LIBCOMBINE_EXTERN +int +CaContent_addCrossRef(CaContent_t* cc, const CaCrossRef_t* ccr); + + +/** + * Get the number of CaCrossRef_t objects in this CaContent_t. + * + * @param cc the CaContent_t structure to query. + * + * @return the number of CaCrossRef_t objects in this CaContent_t. + * + * @memberof CaContent_t + */ +LIBCOMBINE_EXTERN +unsigned int +CaContent_getNumCrossRefs(CaContent_t* cc); + + +/** + * Creates a new CaCrossRef_t object, adds it to this CaContent_t object and + * returns the CaCrossRef_t object created. + * + * @param cc the CaContent_t structure to which the CaCrossRef_t should be + * added. + * + * @return a new CaCrossRef_t object instance. + * + * @copydetails doc_returned_unowned_pointer + * + * @memberof CaContent_t + */ +LIBCOMBINE_EXTERN +CaCrossRef_t* +CaContent_createCrossRef(CaContent_t* cc); + + +/** + * Removes the nth CaCrossRef_t from this CaContent_t and returns a pointer to + * it. + * + * @param cc the CaContent_t structure to search. + * + * @param n an unsigned int representing the index of the CaCrossRef_t to + * remove. + * + * @return a pointer to the nth CaCrossRef_t in this CaContent_t. + * + * @copydetails doc_returned_owned_pointer + * + * @memberof CaContent_t + */ +LIBCOMBINE_EXTERN +CaCrossRef_t* +CaContent_removeCrossRef(CaContent_t* cc, unsigned int n); + + +/** + * Predicate returning @c 1 (true) if all the required attributes for this + * CaContent_t object have been set. * * @param cc the CaContent_t structure. * - * @return @c 1 to indicate that all the required attributes of this - * CaContent_t have been set, otherwise @c 0 is returned. + * @return @c 1 (true) to indicate that all the required attributes of this + * CaContent_t have been set, otherwise @c 0 (false) is returned. * * * @note The required attributes for the CaContent_t object are: diff --git a/dev/generated/src/omex/CaCrossRef.cpp b/dev/generated/src/omex/CaCrossRef.cpp new file mode 100644 index 0000000..fa9d4ea --- /dev/null +++ b/dev/generated/src/omex/CaCrossRef.cpp @@ -0,0 +1,721 @@ +/** + * @file CaCrossRef.cpp + * @brief Implementation of the CaCrossRef class. + * @author DEVISER + * + * + */ +#include +#include +#include + + +using namespace std; + + + +LIBCOMBINE_CPP_NAMESPACE_BEGIN + + + + +#ifdef __cplusplus + + +/* + * Creates a new CaCrossRef instance. + */ +CaCrossRef::CaCrossRef() + : CaBase(1, 1) + , mLocation ("") +{ +} + + +/* + * Creates a new CaCrossRef using the given CaNamespaces object @p omexns. + */ +CaCrossRef::CaCrossRef(CaNamespaces *omexns) + : CaBase(omexns) + , mLocation ("") +{ + setElementNamespace(omexns->getURI()); +} + + +/* + * Copy constructor for CaCrossRef. + */ +CaCrossRef::CaCrossRef(const CaCrossRef& orig) + : CaBase( orig ) + , mLocation ( orig.mLocation ) +{ +} + + +/* + * Assignment operator for CaCrossRef. + */ +CaCrossRef& +CaCrossRef::operator=(const CaCrossRef& rhs) +{ + if (&rhs != this) + { + CaBase::operator=(rhs); + mLocation = rhs.mLocation; + } + + return *this; +} + + +/* + * Creates and returns a deep copy of this CaCrossRef object. + */ +CaCrossRef* +CaCrossRef::clone() const +{ + return new CaCrossRef(*this); +} + + +/* + * Destructor for CaCrossRef. + */ +CaCrossRef::~CaCrossRef() +{ +} + + +/* + * Returns the value of the "location" attribute of this CaCrossRef. + */ +const std::string& +CaCrossRef::getLocation() const +{ + return mLocation; +} + + +/* + * Predicate returning @c true if this CaCrossRef's "location" attribute is + * set. + */ +bool +CaCrossRef::isSetLocation() const +{ + return (mLocation.empty() == false); +} + + +/* + * Sets the value of the "location" attribute of this CaCrossRef. + */ +int +CaCrossRef::setLocation(const std::string& location) +{ + mLocation = location; + return LIBCOMBINE_OPERATION_SUCCESS; +} + + +/* + * Unsets the value of the "location" attribute of this CaCrossRef. + */ +int +CaCrossRef::unsetLocation() +{ + mLocation.erase(); + + if (mLocation.empty() == true) + { + return LIBCOMBINE_OPERATION_SUCCESS; + } + else + { + return LIBCOMBINE_OPERATION_FAILED; + } +} + + +/* + * Returns the XML element name of this CaCrossRef object. + */ +const std::string& +CaCrossRef::getElementName() const +{ + static const string name = "crossRef"; + return name; +} + + +/* + * Returns the libCombine type code for this CaCrossRef object. + */ +int +CaCrossRef::getTypeCode() const +{ + return LIB_COMBINE_CROSSREF; +} + + +/* + * Predicate returning @c true if all the required attributes for this + * CaCrossRef object have been set. + */ +bool +CaCrossRef::hasRequiredAttributes() const +{ + bool allPresent = true; + + if (isSetLocation() == false) + { + allPresent = false; + } + + return allPresent; +} + + + +/** @cond doxygenlibCombineInternal */ + +/* + * Write any contained elements + */ +void +CaCrossRef::writeElements(LIBSBML_CPP_NAMESPACE_QUALIFIER XMLOutputStream& + stream) const +{ + CaBase::writeElements(stream); +} + +/** @endcond */ + + + +/** @cond doxygenlibCombineInternal */ + +/* + * Accepts the given CaVisitor + */ +bool +CaCrossRef::accept(CaVisitor& v) const +{ + return false; +} + +/** @endcond */ + + + +/** @cond doxygenlibCombineInternal */ + +/* + * Sets the parent CaOmexManifest + */ +void +CaCrossRef::setCaOmexManifest(CaOmexManifest* d) +{ + CaBase::setCaOmexManifest(d); +} + +/** @endcond */ + + + +/** @cond doxygenlibCombineInternal */ + +/* + * Gets the value of the "attributeName" attribute of this CaCrossRef. + */ +int +CaCrossRef::getAttribute(const std::string& attributeName, bool& value) const +{ + int return_value = CaBase::getAttribute(attributeName, value); + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenlibCombineInternal */ + +/* + * Gets the value of the "attributeName" attribute of this CaCrossRef. + */ +int +CaCrossRef::getAttribute(const std::string& attributeName, int& value) const +{ + int return_value = CaBase::getAttribute(attributeName, value); + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenlibCombineInternal */ + +/* + * Gets the value of the "attributeName" attribute of this CaCrossRef. + */ +int +CaCrossRef::getAttribute(const std::string& attributeName, + double& value) const +{ + int return_value = CaBase::getAttribute(attributeName, value); + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenlibCombineInternal */ + +/* + * Gets the value of the "attributeName" attribute of this CaCrossRef. + */ +int +CaCrossRef::getAttribute(const std::string& attributeName, + unsigned int& value) const +{ + int return_value = CaBase::getAttribute(attributeName, value); + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenlibCombineInternal */ + +/* + * Gets the value of the "attributeName" attribute of this CaCrossRef. + */ +int +CaCrossRef::getAttribute(const std::string& attributeName, + std::string& value) const +{ + int return_value = CaBase::getAttribute(attributeName, value); + + if (return_value == LIBCOMBINE_OPERATION_SUCCESS) + { + return return_value; + } + + if (attributeName == "location") + { + value = getLocation(); + return_value = LIBCOMBINE_OPERATION_SUCCESS; + } + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenlibCombineInternal */ + +/* + * Predicate returning @c true if this CaCrossRef's attribute "attributeName" + * is set. + */ +bool +CaCrossRef::isSetAttribute(const std::string& attributeName) const +{ + bool value = CaBase::isSetAttribute(attributeName); + + if (attributeName == "location") + { + value = isSetLocation(); + } + + return value; +} + +/** @endcond */ + + + +/** @cond doxygenlibCombineInternal */ + +/* + * Sets the value of the "attributeName" attribute of this CaCrossRef. + */ +int +CaCrossRef::setAttribute(const std::string& attributeName, bool value) +{ + int return_value = CaBase::setAttribute(attributeName, value); + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenlibCombineInternal */ + +/* + * Sets the value of the "attributeName" attribute of this CaCrossRef. + */ +int +CaCrossRef::setAttribute(const std::string& attributeName, int value) +{ + int return_value = CaBase::setAttribute(attributeName, value); + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenlibCombineInternal */ + +/* + * Sets the value of the "attributeName" attribute of this CaCrossRef. + */ +int +CaCrossRef::setAttribute(const std::string& attributeName, double value) +{ + int return_value = CaBase::setAttribute(attributeName, value); + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenlibCombineInternal */ + +/* + * Sets the value of the "attributeName" attribute of this CaCrossRef. + */ +int +CaCrossRef::setAttribute(const std::string& attributeName, unsigned int value) +{ + int return_value = CaBase::setAttribute(attributeName, value); + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenlibCombineInternal */ + +/* + * Sets the value of the "attributeName" attribute of this CaCrossRef. + */ +int +CaCrossRef::setAttribute(const std::string& attributeName, + const std::string& value) +{ + int return_value = CaBase::setAttribute(attributeName, value); + + if (attributeName == "location") + { + return_value = setLocation(value); + } + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenlibCombineInternal */ + +/* + * Unsets the value of the "attributeName" attribute of this CaCrossRef. + */ +int +CaCrossRef::unsetAttribute(const std::string& attributeName) +{ + int value = CaBase::unsetAttribute(attributeName); + + if (attributeName == "location") + { + value = unsetLocation(); + } + + return value; +} + +/** @endcond */ + + + +/** @cond doxygenlibCombineInternal */ + +/* + * Adds the expected attributes for this element + */ +void +CaCrossRef::addExpectedAttributes(LIBSBML_CPP_NAMESPACE_QUALIFIER + ExpectedAttributes& attributes) +{ + CaBase::addExpectedAttributes(attributes); + + attributes.add("location"); +} + +/** @endcond */ + + + +/** @cond doxygenlibCombineInternal */ + +/* + * Reads the expected attributes into the member data variables + */ +void +CaCrossRef::readAttributes( + const LIBSBML_CPP_NAMESPACE_QUALIFIER XMLAttributes& + attributes, + const LIBSBML_CPP_NAMESPACE_QUALIFIER + ExpectedAttributes& expectedAttributes) +{ + unsigned int level = getLevel(); + unsigned int version = getVersion(); + unsigned int numErrs; + bool assigned = false; + CaErrorLog* log = getErrorLog(); + + if (log && getParentCaObject() && + static_cast(getParentCaObject())->size() < 2) + { + numErrs = log->getNumErrors(); + for (int n = numErrs-1; n >= 0; n--) + { + if (log->getError(n)->getErrorId() == CaUnknownCoreAttribute) + { + const std::string details = log->getError(n)->getMessage(); + log->remove(CaUnknownCoreAttribute); + log->logError(CaUnknown, level, version, details); + } + } + } + + CaBase::readAttributes(attributes, expectedAttributes); + + if (log) + { + numErrs = log->getNumErrors(); + + for (int n = numErrs-1; n >= 0; n--) + { + if (log->getError(n)->getErrorId() == CaUnknownCoreAttribute) + { + const std::string details = log->getError(n)->getMessage(); + log->remove(CaUnknownCoreAttribute); + log->logError(CombineCrossRefAllowedAttributes, level, version, + details, getLine(), getColumn()); + } + } + } + + // + // location string (use = "required" ) + // + + assigned = attributes.readInto("location", mLocation); + + if (assigned == true) + { + if (mLocation.empty() == true) + { + logEmptyString(mLocation, level, version, ""); + } + } + else + { + std::string message = "Combine attribute 'location' is missing from the " + " element."; + log->logError(CombineCrossRefAllowedAttributes, level, version, message); + } +} + +/** @endcond */ + + + +/** @cond doxygenlibCombineInternal */ + +/* + * Writes the attributes to the stream + */ +void +CaCrossRef::writeAttributes(LIBSBML_CPP_NAMESPACE_QUALIFIER XMLOutputStream& + stream) const +{ + CaBase::writeAttributes(stream); + + if (isSetLocation() == true) + { + stream.writeAttribute("location", getPrefix(), mLocation); + } +} + +/** @endcond */ + + + + +#endif /* __cplusplus */ + + +/* + * Creates a new CaCrossRef_t instance. + */ +LIBCOMBINE_EXTERN +CaCrossRef_t * +CaCrossRef_create() +{ + return new CaCrossRef(); +} + + +/* + * Creates and returns a deep copy of this CaCrossRef_t object. + */ +LIBCOMBINE_EXTERN +CaCrossRef_t* +CaCrossRef_clone(const CaCrossRef_t* ccr) +{ + if (ccr != NULL) + { + return static_cast(ccr->clone()); + } + else + { + return NULL; + } +} + + +/* + * Frees this CaCrossRef_t object. + */ +LIBCOMBINE_EXTERN +void +CaCrossRef_free(CaCrossRef_t* ccr) +{ + if (ccr != NULL) + { + delete ccr; + } +} + + +/* + * Returns the value of the "location" attribute of this CaCrossRef_t. + */ +LIBCOMBINE_EXTERN +char * +CaCrossRef_getLocation(const CaCrossRef_t * ccr) +{ + if (ccr == NULL) + { + return NULL; + } + + return ccr->getLocation().empty() ? NULL : + safe_strdup(ccr->getLocation().c_str()); +} + + +/* + * Predicate returning @c 1 (true) if this CaCrossRef_t's "location" attribute + * is set. + */ +LIBCOMBINE_EXTERN +int +CaCrossRef_isSetLocation(const CaCrossRef_t * ccr) +{ + return (ccr != NULL) ? static_cast(ccr->isSetLocation()) : 0; +} + + +/* + * Sets the value of the "location" attribute of this CaCrossRef_t. + */ +LIBCOMBINE_EXTERN +int +CaCrossRef_setLocation(CaCrossRef_t * ccr, const char * location) +{ + return (ccr != NULL) ? ccr->setLocation(location) : + LIBCOMBINE_INVALID_OBJECT; +} + + +/* + * Unsets the value of the "location" attribute of this CaCrossRef_t. + */ +LIBCOMBINE_EXTERN +int +CaCrossRef_unsetLocation(CaCrossRef_t * ccr) +{ + return (ccr != NULL) ? ccr->unsetLocation() : LIBCOMBINE_INVALID_OBJECT; +} + + +/* + * Predicate returning @c 1 (true) if all the required attributes for this + * CaCrossRef_t object have been set. + */ +LIBCOMBINE_EXTERN +int +CaCrossRef_hasRequiredAttributes(const CaCrossRef_t * ccr) +{ + return (ccr != NULL) ? static_cast(ccr->hasRequiredAttributes()) : 0; +} + + + + +LIBCOMBINE_CPP_NAMESPACE_END + + diff --git a/dev/generated/src/omex/CaCrossRef.h b/dev/generated/src/omex/CaCrossRef.h new file mode 100644 index 0000000..7d264ea --- /dev/null +++ b/dev/generated/src/omex/CaCrossRef.h @@ -0,0 +1,694 @@ +/** + * @file CaCrossRef.h + * @brief Definition of the CaCrossRef class. + * @author DEVISER + * + * + * + * @class CaCrossRef + * @sbmlbrief{combine} TODO:Definition of the CaCrossRef class. + */ + + +#ifndef CaCrossRef_H__ +#define CaCrossRef_H__ + + +#include +#include + + +#ifdef __cplusplus + + +#include + + +#include +#include + + +LIBCOMBINE_CPP_NAMESPACE_BEGIN + + +class LIBCOMBINE_EXTERN CaCrossRef : public CaBase +{ +protected: + + /** @cond doxygenlibCombineInternal */ + + std::string mLocation; + + /** @endcond */ + +public: + + /** + * Creates a new CaCrossRef instance. + */ + CaCrossRef(); + + + /** + * Creates a new CaCrossRef using the given CaNamespaces object @p omexns. + * + * @param omexns the CaNamespaces object. + * + * @copydetails doc_note_setting_lv_pkg + */ + CaCrossRef(CaNamespaces *omexns); + + + /** + * Copy constructor for CaCrossRef. + * + * @param orig the CaCrossRef instance to copy. + */ + CaCrossRef(const CaCrossRef& orig); + + + /** + * Assignment operator for CaCrossRef. + * + * @param rhs the CaCrossRef object whose values are to be used as the basis + * of the assignment. + */ + CaCrossRef& operator=(const CaCrossRef& rhs); + + + /** + * Creates and returns a deep copy of this CaCrossRef object. + * + * @return a (deep) copy of this CaCrossRef object. + */ + virtual CaCrossRef* clone() const; + + + /** + * Destructor for CaCrossRef. + */ + virtual ~CaCrossRef(); + + + /** + * Returns the value of the "location" attribute of this CaCrossRef. + * + * @return the value of the "location" attribute of this CaCrossRef as a + * string. + */ + const std::string& getLocation() const; + + + /** + * Predicate returning @c true if this CaCrossRef's "location" attribute is + * set. + * + * @return @c true if this CaCrossRef's "location" attribute has been set, + * otherwise @c false is returned. + */ + bool isSetLocation() const; + + + /** + * Sets the value of the "location" attribute of this CaCrossRef. + * + * @param location std::string& value of the "location" attribute to be set. + * + * @copydetails doc_returns_one_success_code + * @li @omexconstant{LIBCOMBINE_OPERATION_SUCCESS, OperationReturnValues_t} + * + * Calling this function with @p location = @c NULL or an empty string is + * equivalent to calling unsetLocation(). + */ + int setLocation(const std::string& location); + + + /** + * Unsets the value of the "location" attribute of this CaCrossRef. + * + * @copydetails doc_returns_success_code + * @li @omexconstant{LIBCOMBINE_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @omexconstant{LIBCOMBINE_OPERATION_FAILED, OperationReturnValues_t} + */ + int unsetLocation(); + + + /** + * Returns the XML element name of this CaCrossRef object. + * + * For CaCrossRef, the XML element name is always @c "crossRef". + * + * @return the name of this element, i.e. @c "crossRef". + */ + virtual const std::string& getElementName() const; + + + /** + * Returns the libCombine type code for this CaCrossRef object. + * + * @copydetails doc_what_are_typecodes + * + * @return the OMEX type code for this object: + * @omexconstant{LIB_COMBINE_CROSSREF, CaTypeCode_t}. + * + * @copydetails doc_warning_typecodes_not_unique + * + * @see getElementName() + */ + virtual int getTypeCode() const; + + + /** + * Predicate returning @c true if all the required attributes for this + * CaCrossRef object have been set. + * + * @return @c true to indicate that all the required attributes of this + * CaCrossRef have been set, otherwise @c false is returned. + * + * + * @note The required attributes for the CaCrossRef object are: + * @li "location" + */ + virtual bool hasRequiredAttributes() const; + + + + /** @cond doxygenlibCombineInternal */ + + /** + * Write any contained elements + */ + virtual void writeElements(LIBSBML_CPP_NAMESPACE_QUALIFIER XMLOutputStream& + stream) const; + + /** @endcond */ + + + + /** @cond doxygenlibCombineInternal */ + + /** + * Accepts the given CaVisitor + */ + virtual bool accept(CaVisitor& v) const; + + /** @endcond */ + + + + /** @cond doxygenlibCombineInternal */ + + /** + * Sets the parent CaOmexManifest + */ + virtual void setCaOmexManifest(CaOmexManifest* d); + + /** @endcond */ + + + + + #ifndef SWIG + + + + /** @cond doxygenlibCombineInternal */ + + /** + * Gets the value of the "attributeName" attribute of this CaCrossRef. + * + * @param attributeName, the name of the attribute to retrieve. + * + * @param value, the address of the value to record. + * + * @copydetails doc_returns_success_code + * @li @omexconstant{LIBCOMBINE_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @omexconstant{LIBCOMBINE_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int getAttribute(const std::string& attributeName, bool& value) + const; + + /** @endcond */ + + + + /** @cond doxygenlibCombineInternal */ + + /** + * Gets the value of the "attributeName" attribute of this CaCrossRef. + * + * @param attributeName, the name of the attribute to retrieve. + * + * @param value, the address of the value to record. + * + * @copydetails doc_returns_success_code + * @li @omexconstant{LIBCOMBINE_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @omexconstant{LIBCOMBINE_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int getAttribute(const std::string& attributeName, int& value) const; + + /** @endcond */ + + + + /** @cond doxygenlibCombineInternal */ + + /** + * Gets the value of the "attributeName" attribute of this CaCrossRef. + * + * @param attributeName, the name of the attribute to retrieve. + * + * @param value, the address of the value to record. + * + * @copydetails doc_returns_success_code + * @li @omexconstant{LIBCOMBINE_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @omexconstant{LIBCOMBINE_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int getAttribute(const std::string& attributeName, + double& value) const; + + /** @endcond */ + + + + /** @cond doxygenlibCombineInternal */ + + /** + * Gets the value of the "attributeName" attribute of this CaCrossRef. + * + * @param attributeName, the name of the attribute to retrieve. + * + * @param value, the address of the value to record. + * + * @copydetails doc_returns_success_code + * @li @omexconstant{LIBCOMBINE_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @omexconstant{LIBCOMBINE_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int getAttribute(const std::string& attributeName, + unsigned int& value) const; + + /** @endcond */ + + + + /** @cond doxygenlibCombineInternal */ + + /** + * Gets the value of the "attributeName" attribute of this CaCrossRef. + * + * @param attributeName, the name of the attribute to retrieve. + * + * @param value, the address of the value to record. + * + * @copydetails doc_returns_success_code + * @li @omexconstant{LIBCOMBINE_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @omexconstant{LIBCOMBINE_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int getAttribute(const std::string& attributeName, + std::string& value) const; + + /** @endcond */ + + + + /** @cond doxygenlibCombineInternal */ + + /** + * Predicate returning @c true if this CaCrossRef's attribute "attributeName" + * is set. + * + * @param attributeName, the name of the attribute to query. + * + * @return @c true if this CaCrossRef's attribute "attributeName" has been + * set, otherwise @c false is returned. + */ + virtual bool isSetAttribute(const std::string& attributeName) const; + + /** @endcond */ + + + + /** @cond doxygenlibCombineInternal */ + + /** + * Sets the value of the "attributeName" attribute of this CaCrossRef. + * + * @param attributeName, the name of the attribute to set. + * + * @param value, the value of the attribute to set. + * + * @copydetails doc_returns_success_code + * @li @omexconstant{LIBCOMBINE_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @omexconstant{LIBCOMBINE_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int setAttribute(const std::string& attributeName, bool value); + + /** @endcond */ + + + + /** @cond doxygenlibCombineInternal */ + + /** + * Sets the value of the "attributeName" attribute of this CaCrossRef. + * + * @param attributeName, the name of the attribute to set. + * + * @param value, the value of the attribute to set. + * + * @copydetails doc_returns_success_code + * @li @omexconstant{LIBCOMBINE_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @omexconstant{LIBCOMBINE_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int setAttribute(const std::string& attributeName, int value); + + /** @endcond */ + + + + /** @cond doxygenlibCombineInternal */ + + /** + * Sets the value of the "attributeName" attribute of this CaCrossRef. + * + * @param attributeName, the name of the attribute to set. + * + * @param value, the value of the attribute to set. + * + * @copydetails doc_returns_success_code + * @li @omexconstant{LIBCOMBINE_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @omexconstant{LIBCOMBINE_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int setAttribute(const std::string& attributeName, double value); + + /** @endcond */ + + + + /** @cond doxygenlibCombineInternal */ + + /** + * Sets the value of the "attributeName" attribute of this CaCrossRef. + * + * @param attributeName, the name of the attribute to set. + * + * @param value, the value of the attribute to set. + * + * @copydetails doc_returns_success_code + * @li @omexconstant{LIBCOMBINE_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @omexconstant{LIBCOMBINE_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int setAttribute(const std::string& attributeName, + unsigned int value); + + /** @endcond */ + + + + /** @cond doxygenlibCombineInternal */ + + /** + * Sets the value of the "attributeName" attribute of this CaCrossRef. + * + * @param attributeName, the name of the attribute to set. + * + * @param value, the value of the attribute to set. + * + * @copydetails doc_returns_success_code + * @li @omexconstant{LIBCOMBINE_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @omexconstant{LIBCOMBINE_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int setAttribute(const std::string& attributeName, + const std::string& value); + + /** @endcond */ + + + + /** @cond doxygenlibCombineInternal */ + + /** + * Unsets the value of the "attributeName" attribute of this CaCrossRef. + * + * @param attributeName, the name of the attribute to query. + * + * @copydetails doc_returns_success_code + * @li @omexconstant{LIBCOMBINE_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @omexconstant{LIBCOMBINE_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int unsetAttribute(const std::string& attributeName); + + /** @endcond */ + + + + + #endif /* !SWIG */ + + +protected: + + + /** @cond doxygenlibCombineInternal */ + + /** + * Adds the expected attributes for this element + */ + virtual void addExpectedAttributes(LIBSBML_CPP_NAMESPACE_QUALIFIER + ExpectedAttributes& attributes); + + /** @endcond */ + + + + /** @cond doxygenlibCombineInternal */ + + /** + * Reads the expected attributes into the member data variables + */ + virtual void readAttributes( + const LIBSBML_CPP_NAMESPACE_QUALIFIER + XMLAttributes& attributes, + const LIBSBML_CPP_NAMESPACE_QUALIFIER + ExpectedAttributes& expectedAttributes); + + /** @endcond */ + + + + /** @cond doxygenlibCombineInternal */ + + /** + * Writes the attributes to the stream + */ + virtual void writeAttributes(LIBSBML_CPP_NAMESPACE_QUALIFIER XMLOutputStream& + stream) const; + + /** @endcond */ + + +}; + + + +LIBCOMBINE_CPP_NAMESPACE_END + + + + +#endif /* __cplusplus */ + + + + +#ifndef SWIG + + + + +LIBCOMBINE_CPP_NAMESPACE_BEGIN + + + + +BEGIN_C_DECLS + + +/** + * Creates a new CaCrossRef_t instance. + * + * @memberof CaCrossRef_t + */ +LIBCOMBINE_EXTERN +CaCrossRef_t * +CaCrossRef_create(); + + +/** + * Creates and returns a deep copy of this CaCrossRef_t object. + * + * @param ccr the CaCrossRef_t structure. + * + * @return a (deep) copy of this CaCrossRef_t object. + * + * @copydetails doc_returned_owned_pointer + * + * @memberof CaCrossRef_t + */ +LIBCOMBINE_EXTERN +CaCrossRef_t* +CaCrossRef_clone(const CaCrossRef_t* ccr); + + +/** + * Frees this CaCrossRef_t object. + * + * @param ccr the CaCrossRef_t structure. + * + * @memberof CaCrossRef_t + */ +LIBCOMBINE_EXTERN +void +CaCrossRef_free(CaCrossRef_t* ccr); + + +/** + * Returns the value of the "location" attribute of this CaCrossRef_t. + * + * @param ccr the CaCrossRef_t structure whose location is sought. + * + * @return the value of the "location" attribute of this CaCrossRef_t as a + * pointer to a string. + * + * @copydetails doc_returned_owned_char + * + * @memberof CaCrossRef_t + */ +LIBCOMBINE_EXTERN +char * +CaCrossRef_getLocation(const CaCrossRef_t * ccr); + + +/** + * Predicate returning @c 1 (true) if this CaCrossRef_t's "location" attribute + * is set. + * + * @param ccr the CaCrossRef_t structure. + * + * @return @c 1 (true) if this CaCrossRef_t's "location" attribute has been + * set, otherwise @c 0 (false) is returned. + * + * @memberof CaCrossRef_t + */ +LIBCOMBINE_EXTERN +int +CaCrossRef_isSetLocation(const CaCrossRef_t * ccr); + + +/** + * Sets the value of the "location" attribute of this CaCrossRef_t. + * + * @param ccr the CaCrossRef_t structure. + * + * @param location const char * value of the "location" attribute to be set. + * + * @copydetails doc_returns_success_code + * @li @omexconstant{LIBCOMBINE_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @omexconstant{LIBCOMBINE_INVALID_OBJECT, OperationReturnValues_t} + * + * Calling this function with @p location = @c NULL or an empty string is + * equivalent to calling CaCrossRef_unsetLocation(). + * + * @memberof CaCrossRef_t + */ +LIBCOMBINE_EXTERN +int +CaCrossRef_setLocation(CaCrossRef_t * ccr, const char * location); + + +/** + * Unsets the value of the "location" attribute of this CaCrossRef_t. + * + * @param ccr the CaCrossRef_t structure. + * + * @copydetails doc_returns_success_code + * @li @omexconstant{LIBCOMBINE_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @omexconstant{LIBCOMBINE_OPERATION_FAILED, OperationReturnValues_t} + * @li @omexconstant{LIBCOMBINE_INVALID_OBJECT, OperationReturnValues_t} + * + * @memberof CaCrossRef_t + */ +LIBCOMBINE_EXTERN +int +CaCrossRef_unsetLocation(CaCrossRef_t * ccr); + + +/** + * Predicate returning @c 1 (true) if all the required attributes for this + * CaCrossRef_t object have been set. + * + * @param ccr the CaCrossRef_t structure. + * + * @return @c 1 (true) to indicate that all the required attributes of this + * CaCrossRef_t have been set, otherwise @c 0 (false) is returned. + * + * + * @note The required attributes for the CaCrossRef_t object are: + * @li "location" + * + * @memberof CaCrossRef_t + */ +LIBCOMBINE_EXTERN +int +CaCrossRef_hasRequiredAttributes(const CaCrossRef_t * ccr); + + + + +END_C_DECLS + + + + +LIBCOMBINE_CPP_NAMESPACE_END + + + + +#endif /* !SWIG */ + + + + +#endif /* !CaCrossRef_H__ */ + + diff --git a/dev/generated/src/omex/CaError.cpp b/dev/generated/src/omex/CaError.cpp index cd864b7..477e480 100644 --- a/dev/generated/src/omex/CaError.cpp +++ b/dev/generated/src/omex/CaError.cpp @@ -7,7 +7,11 @@ * This file is part of libSBML. Please visit http://sbml.org for more * information about SBML, and the latest version of libSBML. * - * Copyright (C) 2013-2016 jointly by the following organizations: + * Copyright (C) 2019 jointly by the following organizations: + * 1. California Institute of Technology, Pasadena, CA, USA + * 2. University of Heidelberg, Heidelberg, Germany + * + * Copyright (C) 2013-2018 jointly by the following organizations: * 1. California Institute of Technology, Pasadena, CA, USA * 2. EMBL European Bioinformatics Institute (EMBL-EBI), Hinxton, UK * 3. University of Heidelberg, Heidelberg, Germany @@ -192,7 +196,7 @@ CaError::CaError ( const unsigned int errorId } } - if ( index == 0 && mErrorId != CaUnknownError ) + if ( index == 0 && mErrorId != CaUnknown ) { // The id is in the range of error numbers that are supposed to be in // the OMEX layer, but it's NOT in our table. This is an internal error. diff --git a/dev/generated/src/omex/CaError.h b/dev/generated/src/omex/CaError.h index 5dbb629..6926dc0 100644 --- a/dev/generated/src/omex/CaError.h +++ b/dev/generated/src/omex/CaError.h @@ -7,7 +7,11 @@ * This file is part of libSBML. Please visit http://sbml.org for more * information about SBML, and the latest version of libSBML. * - * Copyright (C) 2013-2016 jointly by the following organizations: + * Copyright (C) 2019 jointly by the following organizations: + * 1. California Institute of Technology, Pasadena, CA, USA + * 2. University of Heidelberg, Heidelberg, Germany + * + * Copyright (C) 2013-2018 jointly by the following organizations: * 1. California Institute of Technology, Pasadena, CA, USA * 2. EMBL European Bioinformatics Institute (EMBL-EBI), Hinxton, UK * 3. University of Heidelberg, Heidelberg, Germany @@ -49,7 +53,7 @@ BEGIN_C_DECLS */ typedef enum { - CaUnknownError = 10000 /*!< Encountered unknown internal libCombine error. */ + CaUnknown = 10000 /*!< Encountered unknown internal libCombine error. */ , CaNotUTF8 = 10001 /*!< File does not use UTF-8 encoding. */ , CaUnrecognizedElement = 10002 /*!< Encountered unrecognized element. */ , CaNotSchemaConformant = 10003 /*!< Document does not conform to the OMEX XML schema. */ @@ -72,17 +76,20 @@ typedef enum , InvalidNamespaceOnCa = 20101 , AllowedAttributes = 20102 , CaEmptyListElement = 20103 -, CombineCaContentAllowedCoreAttributes = 20201 -, CombineCaContentAllowedCoreElements = 20202 -, CombineCaContentAllowedAttributes = 20203 -, CombineCaContentLocationMustBeString = 20204 -, CombineCaContentFormatMustBeString = 20205 -, CombineCaContentMasterMustBeBoolean = 20206 -, CombineCaOmexManifestAllowedCoreAttributes = 20301 -, CombineCaOmexManifestAllowedCoreElements = 20302 -, CombineCaOmexManifestAllowedElements = 20303 -, CombineCaOmexManifestLOContentsAllowedCoreElements = 20304 -, CombineCaOmexManifestLOContentsAllowedCoreAttributes = 20305 +, CombineContentAllowedCoreAttributes = 20201 +, CombineContentAllowedCoreElements = 20202 +, CombineContentAllowedAttributes = 20203 +, CombineContentAllowedElements = 20204 +, CombineContentLocationMustBeString = 20205 +, CombineContentFormatMustBeString = 20206 +, CombineContentMasterMustBeBoolean = 20207 +, CombineOmexManifestAllowedCoreAttributes = 20301 +, CombineOmexManifestAllowedCoreElements = 20302 +, CombineOmexManifestAllowedElements = 20303 +, CombineCrossRefAllowedCoreAttributes = 20401 +, CombineCrossRefAllowedCoreElements = 20402 +, CombineCrossRefAllowedAttributes = 20403 +, CombineCrossRefLocationMustBeString = 20404 , CaUnknownCoreAttribute = 99994 /*!< Encountered an unknown attribute in the OMEX Core namespace. */ , CaCodesUpperBound = 99999 /*!< Upper boundary of libCombine-specific diagnostic codes. */ } CaErrorCode_t; diff --git a/dev/generated/src/omex/CaErrorLog.cpp b/dev/generated/src/omex/CaErrorLog.cpp index a340652..53e4db2 100644 --- a/dev/generated/src/omex/CaErrorLog.cpp +++ b/dev/generated/src/omex/CaErrorLog.cpp @@ -7,7 +7,11 @@ * This file is part of libSBML. Please visit http://sbml.org for more * information about SBML, and the latest version of libSBML. * - * Copyright (C) 2013-2016 jointly by the following organizations: + * Copyright (C) 2019 jointly by the following organizations: + * 1. California Institute of Technology, Pasadena, CA, USA + * 2. University of Heidelberg, Heidelberg, Germany + * + * Copyright (C) 2013-2018 jointly by the following organizations: * 1. California Institute of Technology, Pasadena, CA, USA * 2. EMBL European Bioinformatics Institute (EMBL-EBI), Hinxton, UK * 3. University of Heidelberg, Heidelberg, Germany diff --git a/dev/generated/src/omex/CaErrorLog.h b/dev/generated/src/omex/CaErrorLog.h index de2c540..b898292 100644 --- a/dev/generated/src/omex/CaErrorLog.h +++ b/dev/generated/src/omex/CaErrorLog.h @@ -7,7 +7,11 @@ * This file is part of libSBML. Please visit http://sbml.org for more * information about SBML, and the latest version of libSBML. * - * Copyright (C) 2013-2016 jointly by the following organizations: + * Copyright (C) 2019 jointly by the following organizations: + * 1. California Institute of Technology, Pasadena, CA, USA + * 2. University of Heidelberg, Heidelberg, Germany + * + * Copyright (C) 2013-2018 jointly by the following organizations: * 1. California Institute of Technology, Pasadena, CA, USA * 2. EMBL European Bioinformatics Institute (EMBL-EBI), Hinxton, UK * 3. University of Heidelberg, Heidelberg, Germany @@ -30,7 +34,7 @@ * available online as http://sbml.org/software/libsbml/license.html * ------------------------------------------------------------------------ --> * - * @class + * @class CaErrorLog * @sbmlbrief{} TODO:Definition of the CaErrorLog class. */ diff --git a/dev/generated/src/omex/CaErrorTable.h b/dev/generated/src/omex/CaErrorTable.h index c799148..b10b7c5 100644 --- a/dev/generated/src/omex/CaErrorTable.h +++ b/dev/generated/src/omex/CaErrorTable.h @@ -7,7 +7,11 @@ * This file is part of libSBML. Please visit http://sbml.org for more * information about SBML, and the latest version of libSBML. * - * Copyright (C) 2013-2016 jointly by the following organizations: + * Copyright (C) 2019 jointly by the following organizations: + * 1. California Institute of Technology, Pasadena, CA, USA + * 2. University of Heidelberg, Heidelberg, Germany + * + * Copyright (C) 2013-2018 jointly by the following organizations: * 1. California Institute of Technology, Pasadena, CA, USA * 2. EMBL European Bioinformatics Institute (EMBL-EBI), Hinxton, UK * 3. University of Heidelberg, Heidelberg, Germany @@ -59,7 +63,7 @@ typedef struct { static const omexErrorTableEntry omexErrorTable[] = { // 10000 - { CaUnknownError, + { CaUnknown, "Encountered unknown internal libCombine error", LIBCOMBINE_CAT_INTERNAL, LIBCOMBINE_SEV_FATAL, @@ -325,7 +329,7 @@ static const omexErrorTableEntry omexErrorTable[] = }, // 20201 - { CombineCaContentAllowedCoreAttributes, + { CombineContentAllowedCoreAttributes, "Core attributes allowed on .", LIBCOMBINE_CAT_GENERAL_CONSISTENCY, LIBCOMBINE_SEV_ERROR, @@ -337,7 +341,7 @@ static const omexErrorTableEntry omexErrorTable[] = }, // 20202 - { CombineCaContentAllowedCoreElements, + { CombineContentAllowedCoreElements, "Core elements allowed on .", LIBCOMBINE_CAT_GENERAL_CONSISTENCY, LIBCOMBINE_SEV_ERROR, @@ -349,7 +353,7 @@ static const omexErrorTableEntry omexErrorTable[] = }, // 20203 - { CombineCaContentAllowedAttributes, + { CombineContentAllowedAttributes, "Attributes allowed on .", LIBCOMBINE_CAT_GENERAL_CONSISTENCY, LIBCOMBINE_SEV_ERROR, @@ -362,8 +366,20 @@ static const omexErrorTableEntry omexErrorTable[] = }, // 20204 - { CombineCaContentLocationMustBeString, - "Location attribute must be String.", + { CombineContentAllowedElements, + "Elements allowed on .", + LIBCOMBINE_CAT_GENERAL_CONSISTENCY, + LIBCOMBINE_SEV_ERROR, + "A object may contain one and only one instance of the " + " element. No other elements from the SBML Level 3 Combine " + "Archive namespaces are permitted on a object. ", + { "L3V1 Combine V1 Section" + } + }, + + // 20205 + { CombineContentLocationMustBeString, + "The 'location' attribute must be String.", LIBCOMBINE_CAT_GENERAL_CONSISTENCY, LIBCOMBINE_SEV_ERROR, "The attribute 'combine:location' on a must have a value of data " @@ -372,9 +388,9 @@ static const omexErrorTableEntry omexErrorTable[] = } }, - // 20205 - { CombineCaContentFormatMustBeString, - "Format attribute must be String.", + // 20206 + { CombineContentFormatMustBeString, + "The 'format' attribute must be String.", LIBCOMBINE_CAT_GENERAL_CONSISTENCY, LIBCOMBINE_SEV_ERROR, "The attribute 'combine:format' on a must have a value of data " @@ -383,9 +399,9 @@ static const omexErrorTableEntry omexErrorTable[] = } }, - // 20206 - { CombineCaContentMasterMustBeBoolean, - "Master attribute must be Boolean.", + // 20207 + { CombineContentMasterMustBeBoolean, + "The 'master' attribute must be Boolean.", LIBCOMBINE_CAT_GENERAL_CONSISTENCY, LIBCOMBINE_SEV_ERROR, "The attribute 'combine:master' on a must have a value of data " @@ -395,7 +411,7 @@ static const omexErrorTableEntry omexErrorTable[] = }, // 20301 - { CombineCaOmexManifestAllowedCoreAttributes, + { CombineOmexManifestAllowedCoreAttributes, "Core attributes allowed on .", LIBCOMBINE_CAT_GENERAL_CONSISTENCY, LIBCOMBINE_SEV_ERROR, @@ -407,7 +423,7 @@ static const omexErrorTableEntry omexErrorTable[] = }, // 20302 - { CombineCaOmexManifestAllowedCoreElements, + { CombineOmexManifestAllowedCoreElements, "Core elements allowed on .", LIBCOMBINE_CAT_GENERAL_CONSISTENCY, LIBCOMBINE_SEV_ERROR, @@ -419,7 +435,7 @@ static const omexErrorTableEntry omexErrorTable[] = }, // 20303 - { CombineCaOmexManifestAllowedElements, + { CombineOmexManifestAllowedElements, "Elements allowed on .", LIBCOMBINE_CAT_GENERAL_CONSISTENCY, LIBCOMBINE_SEV_ERROR, @@ -430,26 +446,49 @@ static const omexErrorTableEntry omexErrorTable[] = } }, - // 20304 - { CombineCaOmexManifestLOContentsAllowedCoreElements, - "Core elements allowed on .", + // 20401 + { CombineCrossRefAllowedCoreAttributes, + "Core attributes allowed on .", LIBCOMBINE_CAT_GENERAL_CONSISTENCY, LIBCOMBINE_SEV_ERROR, - "Apart from the general notes and annotations subobjects permitted on all " - "SBML objects, a container object may only contain " - " objects.", + "A object may have the optional SBML Level 3 Core attributes " + "'metaid' and 'sboTerm'. No other attributes from the SBML Level 3 Core " + "namespaces are permitted on a .", { "L3V1 Combine V1 Section" } }, - // 20305 - { CombineCaOmexManifestLOContentsAllowedCoreAttributes, - "Core attributes allowed on .", + // 20402 + { CombineCrossRefAllowedCoreElements, + "Core elements allowed on .", LIBCOMBINE_CAT_GENERAL_CONSISTENCY, LIBCOMBINE_SEV_ERROR, - "A object may have the optional SBML Level 3 Core " - "attributes 'metaid' and 'sboTerm'. No other attributes from the SBML Level " - "3 Core namespaces are permitted on a object.", + "A object may have the optional SBML Level 3 Core subobjects for " + "notes and annotations. No other elements from the SBML Level 3 Core " + "namespaces are permitted on a .", + { "L3V1 Combine V1 Section" + } + }, + + // 20403 + { CombineCrossRefAllowedAttributes, + "Attributes allowed on .", + LIBCOMBINE_CAT_GENERAL_CONSISTENCY, + LIBCOMBINE_SEV_ERROR, + "A object must have the required attribute 'combine:location'. " + "No other attributes from the SBML Level 3 Combine Archive namespaces are " + "permitted on a object. ", + { "L3V1 Combine V1 Section" + } + }, + + // 20404 + { CombineCrossRefLocationMustBeString, + "The 'location' attribute must be String.", + LIBCOMBINE_CAT_GENERAL_CONSISTENCY, + LIBCOMBINE_SEV_ERROR, + "The attribute 'combine:location' on a must have a value of data " + "type 'string'.", { "L3V1 Combine V1 Section" } }, diff --git a/dev/generated/src/omex/CaListOf.cpp b/dev/generated/src/omex/CaListOf.cpp index f58efba..d53c1b7 100644 --- a/dev/generated/src/omex/CaListOf.cpp +++ b/dev/generated/src/omex/CaListOf.cpp @@ -7,7 +7,11 @@ * This file is part of libSBML. Please visit http://sbml.org for more * information about SBML, and the latest version of libSBML. * - * Copyright (C) 2013-2016 jointly by the following organizations: + * Copyright (C) 2019 jointly by the following organizations: + * 1. California Institute of Technology, Pasadena, CA, USA + * 2. University of Heidelberg, Heidelberg, Germany + * + * Copyright (C) 2013-2018 jointly by the following organizations: * 1. California Institute of Technology, Pasadena, CA, USA * 2. EMBL European Bioinformatics Institute (EMBL-EBI), Hinxton, UK * 3. University of Heidelberg, Heidelberg, Germany diff --git a/dev/generated/src/omex/CaListOf.h b/dev/generated/src/omex/CaListOf.h index 3eb1a26..068959b 100644 --- a/dev/generated/src/omex/CaListOf.h +++ b/dev/generated/src/omex/CaListOf.h @@ -7,7 +7,11 @@ * This file is part of libSBML. Please visit http://sbml.org for more * information about SBML, and the latest version of libSBML. * - * Copyright (C) 2013-2016 jointly by the following organizations: + * Copyright (C) 2019 jointly by the following organizations: + * 1. California Institute of Technology, Pasadena, CA, USA + * 2. University of Heidelberg, Heidelberg, Germany + * + * Copyright (C) 2013-2018 jointly by the following organizations: * 1. California Institute of Technology, Pasadena, CA, USA * 2. EMBL European Bioinformatics Institute (EMBL-EBI), Hinxton, UK * 3. University of Heidelberg, Heidelberg, Germany @@ -30,7 +34,7 @@ * available online as http://sbml.org/software/libsbml/license.html * ------------------------------------------------------------------------ --> * - * @class + * @class CaListOf * @sbmlbrief{} TODO:Definition of the CaListOf class. */ diff --git a/dev/generated/src/omex/CaListOfContents.cpp b/dev/generated/src/omex/CaListOfContents.cpp index 983d9c5..80a4546 100644 --- a/dev/generated/src/omex/CaListOfContents.cpp +++ b/dev/generated/src/omex/CaListOfContents.cpp @@ -7,7 +7,11 @@ * This file is part of libSBML. Please visit http://sbml.org for more * information about SBML, and the latest version of libSBML. * - * Copyright (C) 2013-2016 jointly by the following organizations: + * Copyright (C) 2019 jointly by the following organizations: + * 1. California Institute of Technology, Pasadena, CA, USA + * 2. University of Heidelberg, Heidelberg, Germany + * + * Copyright (C) 2013-2018 jointly by the following organizations: * 1. California Institute of Technology, Pasadena, CA, USA * 2. EMBL European Bioinformatics Institute (EMBL-EBI), Hinxton, UK * 3. University of Heidelberg, Heidelberg, Germany @@ -329,9 +333,9 @@ CaListOfContents::writeXMLNS(LIBSBML_CPP_NAMESPACE_QUALIFIER XMLOutputStream& { const LIBSBML_CPP_NAMESPACE_QUALIFIER XMLNamespaces* thisxmlns = getNamespaces(); - if (thisxmlns && thisxmlns->hasURI(OMEX_XMLNS_L1V1)) + if (thisxmlns && thisxmlns->hasURI(OMEX_XMLNS_L3V1)) { - xmlns.add(OMEX_XMLNS_L1V1, prefix); + xmlns.add(OMEX_XMLNS_L3V1, prefix); } } @@ -350,7 +354,7 @@ CaListOfContents::writeXMLNS(LIBSBML_CPP_NAMESPACE_QUALIFIER XMLOutputStream& * Get a CaContent_t from the CaListOf_t. */ LIBCOMBINE_EXTERN -const CaContent_t* +CaContent_t* CaListOfContents_getContent(CaListOf_t* clo, unsigned int n) { if (clo == NULL) @@ -366,7 +370,7 @@ CaListOfContents_getContent(CaListOf_t* clo, unsigned int n) * Get a CaContent_t from the CaListOf_t based on its identifier. */ LIBCOMBINE_EXTERN -const CaContent_t* +CaContent_t* CaListOfContents_getById(CaListOf_t* clo, const char *sid) { if (clo == NULL) diff --git a/dev/generated/src/omex/CaListOfContents.h b/dev/generated/src/omex/CaListOfContents.h index c87f68c..b92a6fc 100644 --- a/dev/generated/src/omex/CaListOfContents.h +++ b/dev/generated/src/omex/CaListOfContents.h @@ -7,7 +7,11 @@ * This file is part of libSBML. Please visit http://sbml.org for more * information about SBML, and the latest version of libSBML. * - * Copyright (C) 2013-2016 jointly by the following organizations: + * Copyright (C) 2019 jointly by the following organizations: + * 1. California Institute of Technology, Pasadena, CA, USA + * 2. University of Heidelberg, Heidelberg, Germany + * + * Copyright (C) 2013-2018 jointly by the following organizations: * 1. California Institute of Technology, Pasadena, CA, USA * 2. EMBL European Bioinformatics Institute (EMBL-EBI), Hinxton, UK * 3. University of Heidelberg, Heidelberg, Germany @@ -74,11 +78,7 @@ class LIBCOMBINE_EXTERN CaListOfContents : public CaListOf * * @param omexns the CaNamespaces object. * - * @throws OMEXConstructorException - * Thrown if the given @p level and @p version combination, or this kind of - * OMEX object, are either invalid or mismatched with respect to the parent - * CaOmexManifest object. - * @copydetails doc_note_setting_lv + * @copydetails doc_note_setting_lv_pkg */ CaListOfContents(CaNamespaces *omexns); @@ -122,7 +122,14 @@ class LIBCOMBINE_EXTERN CaListOfContents : public CaListOf * * @return the nth CaContent in this CaListOfContents. * - * @see size() + * @copydetails doc_returned_unowned_pointer + * + * @see addContent(const CaContent* object) + * @see createContent() + * @see get(const std::string& sid) + * @see getNumContents() + * @see remove(const std::string& sid) + * @see remove(unsigned int n) */ virtual CaContent* get(unsigned int n); @@ -135,7 +142,14 @@ class LIBCOMBINE_EXTERN CaListOfContents : public CaListOf * * @return the nth CaContent in this CaListOfContents. * - * @see size() + * @copydetails doc_returned_unowned_pointer + * + * @see addContent(const CaContent* object) + * @see createContent() + * @see get(const std::string& sid) + * @see getNumContents() + * @see remove(const std::string& sid) + * @see remove(unsigned int n) */ virtual const CaContent* get(unsigned int n) const; @@ -146,10 +160,17 @@ class LIBCOMBINE_EXTERN CaListOfContents : public CaListOf * @param sid a string representing the identifier of the CaContent to * retrieve. * - * @return the CaContent in this CaListOfContents with the given id or NULL - * if no such CaContent exists. + * @return the CaContent in this CaListOfContents with the given @p sid or + * @c NULL if no such CaContent exists. + * + * @copydetails doc_returned_unowned_pointer * - * @see size() + * @see addContent(const CaContent* object) + * @see createContent() + * @see get(unsigned int n) + * @see getNumContents() + * @see remove(const std::string& sid) + * @see remove(unsigned int n) */ virtual CaContent* get(const std::string& sid); @@ -160,10 +181,17 @@ class LIBCOMBINE_EXTERN CaListOfContents : public CaListOf * @param sid a string representing the identifier of the CaContent to * retrieve. * - * @return the CaContent in this CaListOfContents with the given id or NULL - * if no such CaContent exists. + * @return the CaContent in this CaListOfContents with the given @p sid or + * @c NULL if no such CaContent exists. + * + * @copydetails doc_returned_unowned_pointer * - * @see size() + * @see addContent(const CaContent* object) + * @see createContent() + * @see get(unsigned int n) + * @see getNumContents() + * @see remove(const std::string& sid) + * @see remove(unsigned int n) */ virtual const CaContent* get(const std::string& sid) const; @@ -177,10 +205,14 @@ class LIBCOMBINE_EXTERN CaListOfContents : public CaListOf * * @return a pointer to the nth CaContent in this CaListOfContents. * - * @see size() + * @copydetails doc_returned_owned_pointer * - * @note the caller owns the returned object and is responsible for deleting - * it. + * @see addContent(const CaContent* object) + * @see createContent() + * @see get(const std::string& sid) + * @see get(unsigned int n) + * @see getNumContents() + * @see remove(const std::string& sid) */ virtual CaContent* remove(unsigned int n); @@ -195,8 +227,14 @@ class LIBCOMBINE_EXTERN CaListOfContents : public CaListOf * @return the CaContent in this CaListOfContents based on the identifier or * NULL if no such CaContent exists. * - * @note the caller owns the returned object and is responsible for deleting - * it. + * @copydetails doc_returned_owned_pointer + * + * @see addContent(const CaContent* object) + * @see createContent() + * @see get(const std::string& sid) + * @see get(unsigned int n) + * @see getNumContents() + * @see remove(unsigned int n) */ virtual CaContent* remove(const std::string& sid); @@ -209,10 +247,21 @@ class LIBCOMBINE_EXTERN CaListOfContents : public CaListOf * @copydetails doc_returns_success_code * @li @omexconstant{LIBCOMBINE_OPERATION_SUCCESS, OperationReturnValues_t} * @li @omexconstant{LIBCOMBINE_OPERATION_FAILED, OperationReturnValues_t} + * @li @omexconstant{LIBCOMBINE_INVALID_OBJECT, OperationReturnValues_t} + * @li @omexconstant{LIBCOMBINE_LEVEL_MISMATCH, OperationReturnValues_t} + * @li @omexconstant{LIBCOMBINE_VERSION_MISMATCH, OperationReturnValues_t} + * @li @omexconstant{LIBCOMBINE_PKG_VERSION_MISMATCH, + * OperationReturnValues_t} + * @li @omexconstant{LIBCOMBINE_DUPLICATE_OBJECT_ID, OperationReturnValues_t} * * @copydetails doc_note_object_is_copied * * @see createContent() + * @see get(const std::string& sid) + * @see get(unsigned int n) + * @see getNumContents() + * @see remove(const std::string& sid) + * @see remove(unsigned int n) */ int addContent(const CaContent* cc); @@ -221,6 +270,13 @@ class LIBCOMBINE_EXTERN CaListOfContents : public CaListOf * Get the number of CaContent objects in this CaListOfContents. * * @return the number of CaContent objects in this CaListOfContents. + * + * @see addContent(const CaContent* object) + * @see createContent() + * @see get(const std::string& sid) + * @see get(unsigned int n) + * @see remove(const std::string& sid) + * @see remove(unsigned int n) */ unsigned int getNumContents() const; @@ -231,7 +287,14 @@ class LIBCOMBINE_EXTERN CaListOfContents : public CaListOf * * @return a new CaContent object instance. * - * @see addContent(const CaContent* cc) + * @copydetails doc_returned_unowned_pointer + * + * @see addContent(const CaContent* object) + * @see get(const std::string& sid) + * @see get(unsigned int n) + * @see getNumContents() + * @see remove(const std::string& sid) + * @see remove(unsigned int n) */ CaContent* createContent(); @@ -252,8 +315,7 @@ class LIBCOMBINE_EXTERN CaListOfContents : public CaListOf * @copydetails doc_what_are_typecodes * * @return the OMEX type code for this object: - * - * @omexconstant{OMEX_LIST_OF, OMEXTypeCode_t} + * @omexconstant{OMEX_LIST_OF, CaTypeCode_t}. * * @copydetails doc_warning_typecodes_not_unique */ @@ -268,8 +330,7 @@ class LIBCOMBINE_EXTERN CaListOfContents : public CaListOf * * @return the OMEX typecode for the objects contained in this * CaListOfContents: - * - * @omexconstant{LIB_COMBINE_CONTENT, OMEXCombineTypeCode_t} + * @omexconstant{LIB_COMBINE_CONTENT, CaTypeCode_t}. * * @copydetails doc_warning_typecodes_not_unique * @@ -278,6 +339,16 @@ class LIBCOMBINE_EXTERN CaListOfContents : public CaListOf virtual int getItemTypeCode() const; + + + #ifndef SWIG + + + + + #endif /* !SWIG */ + + protected: @@ -342,10 +413,12 @@ BEGIN_C_DECLS * * @return the nth CaContent_t in this CaListOf_t. * - * @memberof CaContent_t + * @copydetails doc_returned_unowned_pointer + * + * @memberof CaListOfContents_t */ LIBCOMBINE_EXTERN -const CaContent_t* +CaContent_t* CaListOfContents_getContent(CaListOf_t* clo, unsigned int n); @@ -357,13 +430,15 @@ CaListOfContents_getContent(CaListOf_t* clo, unsigned int n); * @param sid a string representing the identifier of the CaContent_t to * retrieve. * - * @return the CaContent_t in this CaListOf_t with the given id or NULL if no - * such CaContent_t exists. + * @return the CaContent_t in this CaListOf_t with the given @p sid or @c NULL + * if no such CaContent_t exists. + * + * @copydetails doc_returned_unowned_pointer * - * @memberof CaContent_t + * @memberof CaListOfContents_t */ LIBCOMBINE_EXTERN -const CaContent_t* +CaContent_t* CaListOfContents_getById(CaListOf_t* clo, const char *sid); @@ -378,7 +453,9 @@ CaListOfContents_getById(CaListOf_t* clo, const char *sid); * * @return a pointer to the nth CaContent_t in this CaListOf_t. * - * @memberof CaContent_t + * @copydetails doc_returned_owned_pointer + * + * @memberof CaListOfContents_t */ LIBCOMBINE_EXTERN CaContent_t* @@ -397,7 +474,9 @@ CaListOfContents_remove(CaListOf_t* clo, unsigned int n); * @return the CaContent_t in this CaListOf_t based on the identifier or NULL * if no such CaContent_t exists. * - * @memberof CaContent_t + * @copydetails doc_returned_owned_pointer + * + * @memberof CaListOfContents_t */ LIBCOMBINE_EXTERN CaContent_t* diff --git a/dev/generated/src/omex/CaListOfCrossRefs.cpp b/dev/generated/src/omex/CaListOfCrossRefs.cpp new file mode 100644 index 0000000..43bfb6c --- /dev/null +++ b/dev/generated/src/omex/CaListOfCrossRefs.cpp @@ -0,0 +1,425 @@ +/** + * @file CaListOfCrossRefs.cpp + * @brief Implementation of the CaListOfCrossRefs class. + * @author DEVISER + * + * + */ +#include +#include + + +using namespace std; + + + +LIBCOMBINE_CPP_NAMESPACE_BEGIN + + + + +#ifdef __cplusplus + + +/* + * Creates a new CaListOfCrossRefs instance. + */ +CaListOfCrossRefs::CaListOfCrossRefs() + : CaListOf(1, 1) +{ +} + + +/* + * Creates a new CaListOfCrossRefs using the given CaNamespaces object @p + * omexns. + */ +CaListOfCrossRefs::CaListOfCrossRefs(CaNamespaces *omexns) + : CaListOf(omexns) +{ + setElementNamespace(omexns->getURI()); +} + + +/* + * Copy constructor for CaListOfCrossRefs. + */ +CaListOfCrossRefs::CaListOfCrossRefs(const CaListOfCrossRefs& orig) + : CaListOf( orig ) +{ +} + + +/* + * Assignment operator for CaListOfCrossRefs. + */ +CaListOfCrossRefs& +CaListOfCrossRefs::operator=(const CaListOfCrossRefs& rhs) +{ + if (&rhs != this) + { + CaListOf::operator=(rhs); + } + + return *this; +} + + +/* + * Creates and returns a deep copy of this CaListOfCrossRefs object. + */ +CaListOfCrossRefs* +CaListOfCrossRefs::clone() const +{ + return new CaListOfCrossRefs(*this); +} + + +/* + * Destructor for CaListOfCrossRefs. + */ +CaListOfCrossRefs::~CaListOfCrossRefs() +{ +} + + +/* + * Get a CaCrossRef from the CaListOfCrossRefs. + */ +CaCrossRef* +CaListOfCrossRefs::get(unsigned int n) +{ + return static_cast(CaListOf::get(n)); +} + + +/* + * Get a CaCrossRef from the CaListOfCrossRefs. + */ +const CaCrossRef* +CaListOfCrossRefs::get(unsigned int n) const +{ + return static_cast(CaListOf::get(n)); +} + + +/* + * Get a CaCrossRef from the CaListOfCrossRefs based on its identifier. + */ +CaCrossRef* +CaListOfCrossRefs::get(const std::string& sid) +{ + return const_cast(static_cast(*this).get(sid)); +} + + +/* + * Get a CaCrossRef from the CaListOfCrossRefs based on its identifier. + */ +const CaCrossRef* +CaListOfCrossRefs::get(const std::string& sid) const +{ + vector::const_iterator result; + result = find_if(mItems.begin(), mItems.end(), CaIdEq(sid)); + return (result == mItems.end()) ? 0 : static_cast + (*result); +} + + +/* + * Removes the nth CaCrossRef from this CaListOfCrossRefs and returns a pointer + * to it. + */ +CaCrossRef* +CaListOfCrossRefs::remove(unsigned int n) +{ + return static_cast(CaListOf::remove(n)); +} + + +/* + * Removes the CaCrossRef from this CaListOfCrossRefs based on its identifier + * and returns a pointer to it. + */ +CaCrossRef* +CaListOfCrossRefs::remove(const std::string& sid) +{ + CaBase* item = NULL; + vector::iterator result; + + result = find_if(mItems.begin(), mItems.end(), CaIdEq(sid)); + + if (result != mItems.end()) + { + item = *result; + mItems.erase(result); + } + + return static_cast (item); +} + + +/* + * Adds a copy of the given CaCrossRef to this CaListOfCrossRefs. + */ +int +CaListOfCrossRefs::addCrossRef(const CaCrossRef* ccr) +{ + if (ccr == NULL) + { + return LIBCOMBINE_OPERATION_FAILED; + } + else if (ccr->hasRequiredAttributes() == false) + { + return LIBCOMBINE_INVALID_OBJECT; + } + else if (getLevel() != ccr->getLevel()) + { + return LIBCOMBINE_LEVEL_MISMATCH; + } + else if (getVersion() != ccr->getVersion()) + { + return LIBCOMBINE_VERSION_MISMATCH; + } + else if (matchesRequiredCaNamespacesForAddition(static_cast(ccr)) == false) + { + return LIBCOMBINE_NAMESPACES_MISMATCH; + } + else + { + return append(ccr); + } +} + + +/* + * Get the number of CaCrossRef objects in this CaListOfCrossRefs. + */ +unsigned int +CaListOfCrossRefs::getNumCrossRefs() const +{ + return size(); +} + + +/* + * Creates a new CaCrossRef object, adds it to this CaListOfCrossRefs object + * and returns the CaCrossRef object created. + */ +CaCrossRef* +CaListOfCrossRefs::createCrossRef() +{ + CaCrossRef* ccr = NULL; + + try + { + ccr = new CaCrossRef(getCaNamespaces()); + } + catch (...) + { + } + + if (ccr != NULL) + { + appendAndOwn(ccr); + } + + return ccr; +} + + +/* + * Returns the XML element name of this CaListOfCrossRefs object. + */ +const std::string& +CaListOfCrossRefs::getElementName() const +{ + static const string name = "listOfCrossRefs"; + return name; +} + + +/* + * Returns the libCombine type code for this CaListOfCrossRefs object. + */ +int +CaListOfCrossRefs::getTypeCode() const +{ + return OMEX_LIST_OF; +} + + +/* + * Returns the libOMEX type code for the OMEX objects contained in this + * CaListOfCrossRefs object. + */ +int +CaListOfCrossRefs::getItemTypeCode() const +{ + return LIB_COMBINE_CROSSREF; +} + + + +/** @cond doxygenlibCombineInternal */ + +/* + * Creates a new CaCrossRef in this CaListOfCrossRefs + */ +CaBase* +CaListOfCrossRefs::createObject(LIBSBML_CPP_NAMESPACE_QUALIFIER XMLInputStream& + stream) +{ + const std::string& name = stream.peek().getName(); + CaBase* object = NULL; + + if (name == "crossRef") + { + object = new CaCrossRef(getCaNamespaces()); + appendAndOwn(object); + } + + return object; +} + +/** @endcond */ + + + +/** @cond doxygenlibCombineInternal */ + +/* + * Writes the namespace for the Combine package + */ +void +CaListOfCrossRefs::writeXMLNS(LIBSBML_CPP_NAMESPACE_QUALIFIER XMLOutputStream& + stream) const +{ + LIBSBML_CPP_NAMESPACE_QUALIFIER XMLNamespaces xmlns; + std::string prefix = getPrefix(); + + if (prefix.empty()) + { + const LIBSBML_CPP_NAMESPACE_QUALIFIER XMLNamespaces* thisxmlns = + getNamespaces(); + if (thisxmlns && thisxmlns->hasURI(OMEX_XMLNS_L3V1)) + { + xmlns.add(OMEX_XMLNS_L3V1, prefix); + } + } + + stream << xmlns; +} + +/** @endcond */ + + + + +#endif /* __cplusplus */ + + +/* + * Get a CaCrossRef_t from the CaListOf_t. + */ +LIBCOMBINE_EXTERN +CaCrossRef_t* +CaListOfCrossRefs_getCrossRef(CaListOf_t* clo, unsigned int n) +{ + if (clo == NULL) + { + return NULL; + } + + return static_cast (clo)->get(n); +} + + +/* + * Get a CaCrossRef_t from the CaListOf_t based on its identifier. + */ +LIBCOMBINE_EXTERN +CaCrossRef_t* +CaListOfCrossRefs_getById(CaListOf_t* clo, const char *sid) +{ + if (clo == NULL) + { + return NULL; + } + + return (sid != NULL) ? static_cast (clo)->get(sid) : + NULL; +} + + +/* + * Removes the nth CaCrossRef_t from this CaListOf_t and returns a pointer to + * it. + */ +LIBCOMBINE_EXTERN +CaCrossRef_t* +CaListOfCrossRefs_remove(CaListOf_t* clo, unsigned int n) +{ + if (clo == NULL) + { + return NULL; + } + + return static_cast (clo)->remove(n); +} + + +/* + * Removes the CaCrossRef_t from this CaListOf_t based on its identifier and + * returns a pointer to it. + */ +LIBCOMBINE_EXTERN +CaCrossRef_t* +CaListOfCrossRefs_removeById(CaListOf_t* clo, const char* sid) +{ + if (clo == NULL) + { + return NULL; + } + + return (sid != NULL) ? static_cast (clo)->remove(sid) : + NULL; +} + + + + +LIBCOMBINE_CPP_NAMESPACE_END + + diff --git a/dev/generated/src/omex/CaListOfCrossRefs.h b/dev/generated/src/omex/CaListOfCrossRefs.h new file mode 100644 index 0000000..158ee06 --- /dev/null +++ b/dev/generated/src/omex/CaListOfCrossRefs.h @@ -0,0 +1,506 @@ +/** + * @file CaListOfCrossRefs.h + * @brief Definition of the CaListOfCrossRefs class. + * @author DEVISER + * + * + * + * @class CaListOfCrossRefs + * @sbmlbrief{combine} TODO:Definition of the CaListOfCrossRefs class. + */ + + +#ifndef CaListOfCrossRefs_H__ +#define CaListOfCrossRefs_H__ + + +#include +#include + + +#ifdef __cplusplus + + +#include + + +#include +#include +#include + + +LIBCOMBINE_CPP_NAMESPACE_BEGIN + + +class LIBCOMBINE_EXTERN CaListOfCrossRefs : public CaListOf +{ + +public: + + /** + * Creates a new CaListOfCrossRefs instance. + */ + CaListOfCrossRefs(); + + + /** + * Creates a new CaListOfCrossRefs using the given CaNamespaces object @p + * omexns. + * + * @param omexns the CaNamespaces object. + * + * @copydetails doc_note_setting_lv_pkg + */ + CaListOfCrossRefs(CaNamespaces *omexns); + + + /** + * Copy constructor for CaListOfCrossRefs. + * + * @param orig the CaListOfCrossRefs instance to copy. + */ + CaListOfCrossRefs(const CaListOfCrossRefs& orig); + + + /** + * Assignment operator for CaListOfCrossRefs. + * + * @param rhs the CaListOfCrossRefs object whose values are to be used as the + * basis of the assignment. + */ + CaListOfCrossRefs& operator=(const CaListOfCrossRefs& rhs); + + + /** + * Creates and returns a deep copy of this CaListOfCrossRefs object. + * + * @return a (deep) copy of this CaListOfCrossRefs object. + */ + virtual CaListOfCrossRefs* clone() const; + + + /** + * Destructor for CaListOfCrossRefs. + */ + virtual ~CaListOfCrossRefs(); + + + /** + * Get a CaCrossRef from the CaListOfCrossRefs. + * + * @param n an unsigned int representing the index of the CaCrossRef to + * retrieve. + * + * @return the nth CaCrossRef in this CaListOfCrossRefs. + * + * @copydetails doc_returned_unowned_pointer + * + * @see addCrossRef(const CaCrossRef* object) + * @see createCrossRef() + * @see get(const std::string& sid) + * @see getNumCrossRefs() + * @see remove(const std::string& sid) + * @see remove(unsigned int n) + */ + virtual CaCrossRef* get(unsigned int n); + + + /** + * Get a CaCrossRef from the CaListOfCrossRefs. + * + * @param n an unsigned int representing the index of the CaCrossRef to + * retrieve. + * + * @return the nth CaCrossRef in this CaListOfCrossRefs. + * + * @copydetails doc_returned_unowned_pointer + * + * @see addCrossRef(const CaCrossRef* object) + * @see createCrossRef() + * @see get(const std::string& sid) + * @see getNumCrossRefs() + * @see remove(const std::string& sid) + * @see remove(unsigned int n) + */ + virtual const CaCrossRef* get(unsigned int n) const; + + + /** + * Get a CaCrossRef from the CaListOfCrossRefs based on its identifier. + * + * @param sid a string representing the identifier of the CaCrossRef to + * retrieve. + * + * @return the CaCrossRef in this CaListOfCrossRefs with the given @p sid or + * @c NULL if no such CaCrossRef exists. + * + * @copydetails doc_returned_unowned_pointer + * + * @see addCrossRef(const CaCrossRef* object) + * @see createCrossRef() + * @see get(unsigned int n) + * @see getNumCrossRefs() + * @see remove(const std::string& sid) + * @see remove(unsigned int n) + */ + virtual CaCrossRef* get(const std::string& sid); + + + /** + * Get a CaCrossRef from the CaListOfCrossRefs based on its identifier. + * + * @param sid a string representing the identifier of the CaCrossRef to + * retrieve. + * + * @return the CaCrossRef in this CaListOfCrossRefs with the given @p sid or + * @c NULL if no such CaCrossRef exists. + * + * @copydetails doc_returned_unowned_pointer + * + * @see addCrossRef(const CaCrossRef* object) + * @see createCrossRef() + * @see get(unsigned int n) + * @see getNumCrossRefs() + * @see remove(const std::string& sid) + * @see remove(unsigned int n) + */ + virtual const CaCrossRef* get(const std::string& sid) const; + + + /** + * Removes the nth CaCrossRef from this CaListOfCrossRefs and returns a + * pointer to it. + * + * @param n an unsigned int representing the index of the CaCrossRef to + * remove. + * + * @return a pointer to the nth CaCrossRef in this CaListOfCrossRefs. + * + * @copydetails doc_returned_owned_pointer + * + * @see addCrossRef(const CaCrossRef* object) + * @see createCrossRef() + * @see get(const std::string& sid) + * @see get(unsigned int n) + * @see getNumCrossRefs() + * @see remove(const std::string& sid) + */ + virtual CaCrossRef* remove(unsigned int n); + + + /** + * Removes the CaCrossRef from this CaListOfCrossRefs based on its identifier + * and returns a pointer to it. + * + * @param sid a string representing the identifier of the CaCrossRef to + * remove. + * + * @return the CaCrossRef in this CaListOfCrossRefs based on the identifier + * or NULL if no such CaCrossRef exists. + * + * @copydetails doc_returned_owned_pointer + * + * @see addCrossRef(const CaCrossRef* object) + * @see createCrossRef() + * @see get(const std::string& sid) + * @see get(unsigned int n) + * @see getNumCrossRefs() + * @see remove(unsigned int n) + */ + virtual CaCrossRef* remove(const std::string& sid); + + + /** + * Adds a copy of the given CaCrossRef to this CaListOfCrossRefs. + * + * @param ccr the CaCrossRef object to add. + * + * @copydetails doc_returns_success_code + * @li @omexconstant{LIBCOMBINE_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @omexconstant{LIBCOMBINE_OPERATION_FAILED, OperationReturnValues_t} + * @li @omexconstant{LIBCOMBINE_INVALID_OBJECT, OperationReturnValues_t} + * @li @omexconstant{LIBCOMBINE_LEVEL_MISMATCH, OperationReturnValues_t} + * @li @omexconstant{LIBCOMBINE_VERSION_MISMATCH, OperationReturnValues_t} + * @li @omexconstant{LIBCOMBINE_PKG_VERSION_MISMATCH, + * OperationReturnValues_t} + * @li @omexconstant{LIBCOMBINE_DUPLICATE_OBJECT_ID, OperationReturnValues_t} + * + * @copydetails doc_note_object_is_copied + * + * @see createCrossRef() + * @see get(const std::string& sid) + * @see get(unsigned int n) + * @see getNumCrossRefs() + * @see remove(const std::string& sid) + * @see remove(unsigned int n) + */ + int addCrossRef(const CaCrossRef* ccr); + + + /** + * Get the number of CaCrossRef objects in this CaListOfCrossRefs. + * + * @return the number of CaCrossRef objects in this CaListOfCrossRefs. + * + * @see addCrossRef(const CaCrossRef* object) + * @see createCrossRef() + * @see get(const std::string& sid) + * @see get(unsigned int n) + * @see remove(const std::string& sid) + * @see remove(unsigned int n) + */ + unsigned int getNumCrossRefs() const; + + + /** + * Creates a new CaCrossRef object, adds it to this CaListOfCrossRefs object + * and returns the CaCrossRef object created. + * + * @return a new CaCrossRef object instance. + * + * @copydetails doc_returned_unowned_pointer + * + * @see addCrossRef(const CaCrossRef* object) + * @see get(const std::string& sid) + * @see get(unsigned int n) + * @see getNumCrossRefs() + * @see remove(const std::string& sid) + * @see remove(unsigned int n) + */ + CaCrossRef* createCrossRef(); + + + /** + * Returns the XML element name of this CaListOfCrossRefs object. + * + * For CaListOfCrossRefs, the XML element name is always + * @c "listOfCrossRefs". + * + * @return the name of this element, i.e. @c "listOfCrossRefs". + */ + virtual const std::string& getElementName() const; + + + /** + * Returns the libCombine type code for this CaListOfCrossRefs object. + * + * @copydetails doc_what_are_typecodes + * + * @return the OMEX type code for this object: + * @omexconstant{OMEX_LIST_OF, CaTypeCode_t}. + * + * @copydetails doc_warning_typecodes_not_unique + */ + virtual int getTypeCode() const; + + + /** + * Returns the libOMEX type code for the OMEX objects contained in this + * CaListOfCrossRefs object. + * + * @copydetails doc_what_are_typecodes + * + * @return the OMEX typecode for the objects contained in this + * CaListOfCrossRefs: + * @omexconstant{LIB_COMBINE_CROSSREF, CaTypeCode_t}. + * + * @copydetails doc_warning_typecodes_not_unique + * + * @see getElementName() + */ + virtual int getItemTypeCode() const; + + + + + #ifndef SWIG + + + + + #endif /* !SWIG */ + + +protected: + + + /** @cond doxygenlibCombineInternal */ + + /** + * Creates a new CaCrossRef in this CaListOfCrossRefs + */ + virtual CaBase* createObject(LIBSBML_CPP_NAMESPACE_QUALIFIER XMLInputStream& + stream); + + /** @endcond */ + + + friend class CaContent; + + /** @cond doxygenlibCombineInternal */ + + /** + * Writes the namespace for the Combine package + */ + virtual void writeXMLNS(LIBSBML_CPP_NAMESPACE_QUALIFIER XMLOutputStream& + stream) const; + + /** @endcond */ + + +}; + + + +LIBCOMBINE_CPP_NAMESPACE_END + + + + +#endif /* __cplusplus */ + + + + +#ifndef SWIG + + + + +LIBCOMBINE_CPP_NAMESPACE_BEGIN + + + + +BEGIN_C_DECLS + + +/** + * Get a CaCrossRef_t from the CaListOf_t. + * + * @param clo the CaListOf_t structure to search. + * + * @param n an unsigned int representing the index of the CaCrossRef_t to + * retrieve. + * + * @return the nth CaCrossRef_t in this CaListOf_t. + * + * @copydetails doc_returned_unowned_pointer + * + * @memberof CaListOfCrossRefs_t + */ +LIBCOMBINE_EXTERN +CaCrossRef_t* +CaListOfCrossRefs_getCrossRef(CaListOf_t* clo, unsigned int n); + + +/** + * Get a CaCrossRef_t from the CaListOf_t based on its identifier. + * + * @param clo the CaListOf_t structure to search. + * + * @param sid a string representing the identifier of the CaCrossRef_t to + * retrieve. + * + * @return the CaCrossRef_t in this CaListOf_t with the given @p sid or @c NULL + * if no such CaCrossRef_t exists. + * + * @copydetails doc_returned_unowned_pointer + * + * @memberof CaListOfCrossRefs_t + */ +LIBCOMBINE_EXTERN +CaCrossRef_t* +CaListOfCrossRefs_getById(CaListOf_t* clo, const char *sid); + + +/** + * Removes the nth CaCrossRef_t from this CaListOf_t and returns a pointer to + * it. + * + * @param clo the CaListOf_t structure to search. + * + * @param n an unsigned int representing the index of the CaCrossRef_t to + * remove. + * + * @return a pointer to the nth CaCrossRef_t in this CaListOf_t. + * + * @copydetails doc_returned_owned_pointer + * + * @memberof CaListOfCrossRefs_t + */ +LIBCOMBINE_EXTERN +CaCrossRef_t* +CaListOfCrossRefs_remove(CaListOf_t* clo, unsigned int n); + + +/** + * Removes the CaCrossRef_t from this CaListOf_t based on its identifier and + * returns a pointer to it. + * + * @param clo the CaListOf_t structure to search. + * + * @param sid a string representing the identifier of the CaCrossRef_t to + * remove. + * + * @return the CaCrossRef_t in this CaListOf_t based on the identifier or NULL + * if no such CaCrossRef_t exists. + * + * @copydetails doc_returned_owned_pointer + * + * @memberof CaListOfCrossRefs_t + */ +LIBCOMBINE_EXTERN +CaCrossRef_t* +CaListOfCrossRefs_removeById(CaListOf_t* clo, const char* sid); + + + + +END_C_DECLS + + + + +LIBCOMBINE_CPP_NAMESPACE_END + + + + +#endif /* !SWIG */ + + + + +#endif /* !CaListOfCrossRefs_H__ */ + + diff --git a/dev/generated/src/omex/CaNamespaces.cpp b/dev/generated/src/omex/CaNamespaces.cpp index 01eb957..eaf510b 100644 --- a/dev/generated/src/omex/CaNamespaces.cpp +++ b/dev/generated/src/omex/CaNamespaces.cpp @@ -7,7 +7,11 @@ * This file is part of libSBML. Please visit http://sbml.org for more * information about SBML, and the latest version of libSBML. * - * Copyright (C) 2013-2016 jointly by the following organizations: + * Copyright (C) 2019 jointly by the following organizations: + * 1. California Institute of Technology, Pasadena, CA, USA + * 2. University of Heidelberg, Heidelberg, Germany + * + * Copyright (C) 2013-2018 jointly by the following organizations: * 1. California Institute of Technology, Pasadena, CA, USA * 2. EMBL European Bioinformatics Institute (EMBL-EBI), Hinxton, UK * 3. University of Heidelberg, Heidelberg, Germany @@ -56,11 +60,11 @@ CaNamespaces::initCaNamespace() switch (mLevel) { - case 1: + case 0: default: switch (mVersion) { - case 1: + case 0: default: mNamespaces->add(OMEX_XMLNS_L1V1); break; @@ -112,7 +116,7 @@ const List * CaNamespaces::getSupportedNamespaces() { List *result = new List(); - result->add(new CaNamespaces(1,1)); + result->add(new CaNamespaces(0,0)); return result; } @@ -168,11 +172,11 @@ CaNamespaces::getCaNamespaceURI(unsigned int level, std::string uri = ""; switch (level) { - case 1: + case 0: default: switch (version) { - case 1: + case 0: default: uri = OMEX_XMLNS_L1V1; break; @@ -330,10 +334,10 @@ CaNamespaces::isValidCombination() switch (getLevel()) { - case 1: + case 0: switch (version) { - case 1: + case 0: // the namespaces contains the omex namespaces // check it is the correct ns for the level/version if (omexDeclared) diff --git a/dev/generated/src/omex/CaNamespaces.h b/dev/generated/src/omex/CaNamespaces.h index 9a0bec5..1884364 100644 --- a/dev/generated/src/omex/CaNamespaces.h +++ b/dev/generated/src/omex/CaNamespaces.h @@ -7,7 +7,11 @@ * This file is part of libSBML. Please visit http://sbml.org for more * information about SBML, and the latest version of libSBML. * - * Copyright (C) 2013-2016 jointly by the following organizations: + * Copyright (C) 2019 jointly by the following organizations: + * 1. California Institute of Technology, Pasadena, CA, USA + * 2. University of Heidelberg, Heidelberg, Germany + * + * Copyright (C) 2013-2018 jointly by the following organizations: * 1. California Institute of Technology, Pasadena, CA, USA * 2. EMBL European Bioinformatics Institute (EMBL-EBI), Hinxton, UK * 3. University of Heidelberg, Heidelberg, Germany @@ -30,7 +34,7 @@ * available online as http://sbml.org/software/libsbml/license.html * ------------------------------------------------------------------------ --> * - * @class + * @class CaNamespaces * @sbmlbrief{} TODO:Definition of the CaNamespaces class. */ @@ -47,13 +51,13 @@ #ifdef __cplusplus namespace LIBCOMBINE_CPP_NAMESPACE { - const unsigned int OMEX_DEFAULT_LEVEL = 1; - const unsigned int OMEX_DEFAULT_VERSION = 1; + const unsigned int OMEX_DEFAULT_LEVEL = 0; + const unsigned int OMEX_DEFAULT_VERSION = 0; const char* const OMEX_XMLNS_L1V1 = "http://identifiers.org/combine.specifications/omex-manifest"; } #else -static const unsigned int OMEX_DEFAULT_LEVEL = 1; -static const unsigned int OMEX_DEFAULT_VERSION = 1; +static const unsigned int OMEX_DEFAULT_LEVEL = 0; +static const unsigned int OMEX_DEFAULT_VERSION = 0; static const char* const OMEX_XMLNS_L1V1 = "http://identifiers.org/combine.specifications/omex-manifest"; #endif diff --git a/dev/generated/src/omex/CaOmexManifest.cpp b/dev/generated/src/omex/CaOmexManifest.cpp index 6c3c731..68cd5dd 100644 --- a/dev/generated/src/omex/CaOmexManifest.cpp +++ b/dev/generated/src/omex/CaOmexManifest.cpp @@ -7,7 +7,11 @@ * This file is part of libSBML. Please visit http://sbml.org for more * information about SBML, and the latest version of libSBML. * - * Copyright (C) 2013-2016 jointly by the following organizations: + * Copyright (C) 2019 jointly by the following organizations: + * 1. California Institute of Technology, Pasadena, CA, USA + * 2. University of Heidelberg, Heidelberg, Germany + * + * Copyright (C) 2013-2018 jointly by the following organizations: * 1. California Institute of Technology, Pasadena, CA, USA * 2. EMBL European Bioinformatics Institute (EMBL-EBI), Hinxton, UK * 3. University of Heidelberg, Heidelberg, Germany @@ -262,19 +266,6 @@ CaOmexManifest::getTypeCode() const } -/* - * Predicate returning @c true if all the required elements for this - * CaOmexManifest object have been set. - */ -bool -CaOmexManifest::hasRequiredElements() const -{ - bool allPresent = true; - - return allPresent; -} - - /** @cond doxygenlibCombineInternal */ @@ -287,9 +278,9 @@ CaOmexManifest::writeElements(LIBSBML_CPP_NAMESPACE_QUALIFIER XMLOutputStream& { CaBase::writeElements(stream); - if (getNumContents() > 0) + for (unsigned int i = 0; i < getNumContents(); i++) { - mContents.write(stream); + getContent(i)->write(stream); } } @@ -345,6 +336,334 @@ CaOmexManifest::connectToChild() /** @endcond */ + +/** @cond doxygenlibCombineInternal */ + +/* + * Gets the value of the "attributeName" attribute of this CaOmexManifest. + */ +int +CaOmexManifest::getAttribute(const std::string& attributeName, + bool& value) const +{ + int return_value = CaBase::getAttribute(attributeName, value); + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenlibCombineInternal */ + +/* + * Gets the value of the "attributeName" attribute of this CaOmexManifest. + */ +int +CaOmexManifest::getAttribute(const std::string& attributeName, + int& value) const +{ + int return_value = CaBase::getAttribute(attributeName, value); + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenlibCombineInternal */ + +/* + * Gets the value of the "attributeName" attribute of this CaOmexManifest. + */ +int +CaOmexManifest::getAttribute(const std::string& attributeName, + double& value) const +{ + int return_value = CaBase::getAttribute(attributeName, value); + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenlibCombineInternal */ + +/* + * Gets the value of the "attributeName" attribute of this CaOmexManifest. + */ +int +CaOmexManifest::getAttribute(const std::string& attributeName, + unsigned int& value) const +{ + int return_value = CaBase::getAttribute(attributeName, value); + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenlibCombineInternal */ + +/* + * Gets the value of the "attributeName" attribute of this CaOmexManifest. + */ +int +CaOmexManifest::getAttribute(const std::string& attributeName, + std::string& value) const +{ + int return_value = CaBase::getAttribute(attributeName, value); + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenlibCombineInternal */ + +/* + * Predicate returning @c true if this CaOmexManifest's attribute + * "attributeName" is set. + */ +bool +CaOmexManifest::isSetAttribute(const std::string& attributeName) const +{ + bool value = CaBase::isSetAttribute(attributeName); + + return value; +} + +/** @endcond */ + + + +/** @cond doxygenlibCombineInternal */ + +/* + * Sets the value of the "attributeName" attribute of this CaOmexManifest. + */ +int +CaOmexManifest::setAttribute(const std::string& attributeName, bool value) +{ + int return_value = CaBase::setAttribute(attributeName, value); + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenlibCombineInternal */ + +/* + * Sets the value of the "attributeName" attribute of this CaOmexManifest. + */ +int +CaOmexManifest::setAttribute(const std::string& attributeName, int value) +{ + int return_value = CaBase::setAttribute(attributeName, value); + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenlibCombineInternal */ + +/* + * Sets the value of the "attributeName" attribute of this CaOmexManifest. + */ +int +CaOmexManifest::setAttribute(const std::string& attributeName, double value) +{ + int return_value = CaBase::setAttribute(attributeName, value); + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenlibCombineInternal */ + +/* + * Sets the value of the "attributeName" attribute of this CaOmexManifest. + */ +int +CaOmexManifest::setAttribute(const std::string& attributeName, + unsigned int value) +{ + int return_value = CaBase::setAttribute(attributeName, value); + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenlibCombineInternal */ + +/* + * Sets the value of the "attributeName" attribute of this CaOmexManifest. + */ +int +CaOmexManifest::setAttribute(const std::string& attributeName, + const std::string& value) +{ + int return_value = CaBase::setAttribute(attributeName, value); + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenlibCombineInternal */ + +/* + * Unsets the value of the "attributeName" attribute of this CaOmexManifest. + */ +int +CaOmexManifest::unsetAttribute(const std::string& attributeName) +{ + int value = CaBase::unsetAttribute(attributeName); + + return value; +} + +/** @endcond */ + + + +/** @cond doxygenlibCombineInternal */ + +/* + * Creates and returns an new "elementName" object in this CaOmexManifest. + */ +CaBase* +CaOmexManifest::createChildObject(const std::string& elementName) +{ + CaBase* obj = NULL; + + if (elementName == "content") + { + return createContent(); + } + + return obj; +} + +/** @endcond */ + + + +/** @cond doxygenlibCombineInternal */ + +/* + * Adds a new "elementName" object to this CaOmexManifest. + */ +int +CaOmexManifest::addChildObject(const std::string& elementName, + const CaBase* element) +{ + if (elementName == "content" && element->getTypeCode() == + LIB_COMBINE_CONTENT) + { + return addContent((const CaContent*)(element)); + } + + return LIBSBML_OPERATION_FAILED; +} + +/** @endcond */ + + + +/** @cond doxygenlibCombineInternal */ + +/* + * Removes and returns the new "elementName" object with the given id in this + * CaOmexManifest. + */ +CaBase* +CaOmexManifest::removeChildObject(const std::string& elementName, + const std::string& id) +{ + if (elementName == "content") + { + for (unsigned int i = 0; i < getNumContents(); i++) + { + if (getContent(i)->getId() == id) + { + return removeContent(i); + } + } + } + + return NULL; +} + +/** @endcond */ + + + +/** @cond doxygenlibCombineInternal */ + +/* + * Returns the number of "elementName" in this CaOmexManifest. + */ +unsigned int +CaOmexManifest::getNumObjects(const std::string& elementName) +{ + unsigned int n = 0; + + if (elementName == "content") + { + return getNumContents(); + } + + return n; +} + +/** @endcond */ + + + +/** @cond doxygenlibCombineInternal */ + +/* + * Returns the nth object of "objectName" in this CaOmexManifest. + */ +CaBase* +CaOmexManifest::getObject(const std::string& elementName, unsigned int index) +{ + CaBase* obj = NULL; + + if (elementName == "content") + { + return getContent(index); + } + + return obj; +} + +/** @endcond */ + + /* * Returns the first child element that has the given @p id in the model-wide * SId namespace, or @c NULL if no such object is found. @@ -465,7 +784,10 @@ CaOmexManifest::createObject(LIBSBML_CPP_NAMESPACE_QUALIFIER XMLInputStream& const std::string& name = stream.peek().getName(); - obj = mContents.createObject(stream); + if (name == "content") + { + obj = mContents.createObject(stream); + } connectToChild(); @@ -492,9 +814,9 @@ CaOmexManifest::writeXMLNS(LIBSBML_CPP_NAMESPACE_QUALIFIER XMLOutputStream& { const LIBSBML_CPP_NAMESPACE_QUALIFIER XMLNamespaces* thisxmlns = getNamespaces(); - if (thisxmlns && thisxmlns->hasURI(OMEX_XMLNS_L1V1)) + if (thisxmlns && thisxmlns->hasURI(OMEX_XMLNS_L3V1)) { - xmlns.add(OMEX_XMLNS_L1V1, prefix); + xmlns.add(OMEX_XMLNS_L3V1, prefix); } } @@ -553,7 +875,7 @@ CaOmexManifest_free(CaOmexManifest_t* com) /* - * Returns a ListOf_t* containing CaContent_t objects from this + * Returns a ListOf_t * containing CaContent_t objects from this * CaOmexManifest_t. */ LIBCOMBINE_EXTERN @@ -568,7 +890,7 @@ CaOmexManifest_getListOfContents(CaOmexManifest_t* com) * Get a CaContent_t from the CaOmexManifest_t. */ LIBCOMBINE_EXTERN -const CaContent_t* +CaContent_t* CaOmexManifest_getContent(CaOmexManifest_t* com, unsigned int n) { return (com != NULL) ? com->getContent(n) : NULL; @@ -621,18 +943,6 @@ CaOmexManifest_removeContent(CaOmexManifest_t* com, unsigned int n) } -/* - * Predicate returning @c 1 if all the required elements for this - * CaOmexManifest_t object have been set. - */ -LIBCOMBINE_EXTERN -int -CaOmexManifest_hasRequiredElements(const CaOmexManifest_t * com) -{ - return (com != NULL) ? static_cast(com->hasRequiredElements()) : 0; -} - - LIBCOMBINE_CPP_NAMESPACE_END diff --git a/dev/generated/src/omex/CaOmexManifest.h b/dev/generated/src/omex/CaOmexManifest.h index 54a2ad5..e528a5e 100644 --- a/dev/generated/src/omex/CaOmexManifest.h +++ b/dev/generated/src/omex/CaOmexManifest.h @@ -7,7 +7,11 @@ * This file is part of libSBML. Please visit http://sbml.org for more * information about SBML, and the latest version of libSBML. * - * Copyright (C) 2013-2016 jointly by the following organizations: + * Copyright (C) 2019 jointly by the following organizations: + * 1. California Institute of Technology, Pasadena, CA, USA + * 2. University of Heidelberg, Heidelberg, Germany + * + * Copyright (C) 2013-2018 jointly by the following organizations: * 1. California Institute of Technology, Pasadena, CA, USA * 2. EMBL European Bioinformatics Institute (EMBL-EBI), Hinxton, UK * 3. University of Heidelberg, Heidelberg, Germany @@ -83,11 +87,7 @@ class LIBCOMBINE_EXTERN CaOmexManifest : public CaBase * * @param omexns the CaNamespaces object. * - * @throws OMEXConstructorException - * Thrown if the given @p level and @p version combination, or this kind of - * OMEX object, are either invalid or mismatched with respect to the parent - * CaOmexManifest object. - * @copydetails doc_note_setting_lv + * @copydetails doc_note_setting_lv_pkg */ CaOmexManifest(CaNamespaces *omexns); @@ -127,6 +127,16 @@ class LIBCOMBINE_EXTERN CaOmexManifest : public CaBase * Returns the CaListOfContents from this CaOmexManifest. * * @return the CaListOfContents from this CaOmexManifest. + * + * @copydetails doc_returned_unowned_pointer + * + * @see addContent(const CaContent* object) + * @see createContent() + * @see getContent(const std::string& sid) + * @see getContent(unsigned int n) + * @see getNumContents() + * @see removeContent(const std::string& sid) + * @see removeContent(unsigned int n) */ const CaListOfContents* getListOfContents() const; @@ -135,6 +145,16 @@ class LIBCOMBINE_EXTERN CaOmexManifest : public CaBase * Returns the CaListOfContents from this CaOmexManifest. * * @return the CaListOfContents from this CaOmexManifest. + * + * @copydetails doc_returned_unowned_pointer + * + * @see addContent(const CaContent* object) + * @see createContent() + * @see getContent(const std::string& sid) + * @see getContent(unsigned int n) + * @see getNumContents() + * @see removeContent(const std::string& sid) + * @see removeContent(unsigned int n) */ CaListOfContents* getListOfContents(); @@ -148,7 +168,14 @@ class LIBCOMBINE_EXTERN CaOmexManifest : public CaBase * @return the nth CaContent in the CaListOfContents within this * CaOmexManifest. * + * @copydetails doc_returned_unowned_pointer + * + * @see addContent(const CaContent* object) + * @see createContent() + * @see getContent(const std::string& sid) * @see getNumContents() + * @see removeContent(const std::string& sid) + * @see removeContent(unsigned int n) */ CaContent* getContent(unsigned int n); @@ -162,7 +189,14 @@ class LIBCOMBINE_EXTERN CaOmexManifest : public CaBase * @return the nth CaContent in the CaListOfContents within this * CaOmexManifest. * + * @copydetails doc_returned_unowned_pointer + * + * @see addContent(const CaContent* object) + * @see createContent() + * @see getContent(const std::string& sid) * @see getNumContents() + * @see removeContent(const std::string& sid) + * @see removeContent(unsigned int n) */ const CaContent* getContent(unsigned int n) const; @@ -175,10 +209,21 @@ class LIBCOMBINE_EXTERN CaOmexManifest : public CaBase * @copydetails doc_returns_success_code * @li @omexconstant{LIBCOMBINE_OPERATION_SUCCESS, OperationReturnValues_t} * @li @omexconstant{LIBCOMBINE_OPERATION_FAILED, OperationReturnValues_t} + * @li @omexconstant{LIBCOMBINE_INVALID_OBJECT, OperationReturnValues_t} + * @li @omexconstant{LIBCOMBINE_LEVEL_MISMATCH, OperationReturnValues_t} + * @li @omexconstant{LIBCOMBINE_VERSION_MISMATCH, OperationReturnValues_t} + * @li @omexconstant{LIBCOMBINE_PKG_VERSION_MISMATCH, + * OperationReturnValues_t} + * @li @omexconstant{LIBCOMBINE_DUPLICATE_OBJECT_ID, OperationReturnValues_t} * * @copydetails doc_note_object_is_copied * * @see createContent() + * @see getContent(const std::string& sid) + * @see getContent(unsigned int n) + * @see getNumContents() + * @see removeContent(const std::string& sid) + * @see removeContent(unsigned int n) */ int addContent(const CaContent* cc); @@ -187,6 +232,13 @@ class LIBCOMBINE_EXTERN CaOmexManifest : public CaBase * Get the number of CaContent objects in this CaOmexManifest. * * @return the number of CaContent objects in this CaOmexManifest. + * + * @see addContent(const CaContent* object) + * @see createContent() + * @see getContent(const std::string& sid) + * @see getContent(unsigned int n) + * @see removeContent(const std::string& sid) + * @see removeContent(unsigned int n) */ unsigned int getNumContents() const; @@ -197,7 +249,14 @@ class LIBCOMBINE_EXTERN CaOmexManifest : public CaBase * * @return a new CaContent object instance. * - * @see addContent(const CaContent* cc) + * @copydetails doc_returned_unowned_pointer + * + * @see addContent(const CaContent* object) + * @see getContent(const std::string& sid) + * @see getContent(unsigned int n) + * @see getNumContents() + * @see removeContent(const std::string& sid) + * @see removeContent(unsigned int n) */ CaContent* createContent(); @@ -211,10 +270,14 @@ class LIBCOMBINE_EXTERN CaOmexManifest : public CaBase * * @return a pointer to the nth CaContent in this CaOmexManifest. * - * @see getNumContents + * @copydetails doc_returned_owned_pointer * - * @note the caller owns the returned object and is responsible for deleting - * it. + * @see addContent(const CaContent* object) + * @see createContent() + * @see getContent(const std::string& sid) + * @see getContent(unsigned int n) + * @see getNumContents() + * @see removeContent(const std::string& sid) */ CaContent* removeContent(unsigned int n); @@ -235,8 +298,7 @@ class LIBCOMBINE_EXTERN CaOmexManifest : public CaBase * @copydetails doc_what_are_typecodes * * @return the OMEX type code for this object: - * - * @omexconstant{LIB_COMBINE_OMEXMANIFEST, OMEXCombineTypeCode_t} + * @omexconstant{LIB_COMBINE_OMEXMANIFEST, CaTypeCode_t}. * * @copydetails doc_warning_typecodes_not_unique * @@ -245,19 +307,6 @@ class LIBCOMBINE_EXTERN CaOmexManifest : public CaBase virtual int getTypeCode() const; - /** - * Predicate returning @c true if all the required elements for this - * CaOmexManifest object have been set. - * - * @return @c true to indicate that all the required elements of this - * CaOmexManifest have been set, otherwise @c false is returned. - * - * - * @note The required elements for the CaOmexManifest object are: - */ - virtual bool hasRequiredElements() const; - - /** @cond doxygenlibCombineInternal */ @@ -303,6 +352,333 @@ class LIBCOMBINE_EXTERN CaOmexManifest : public CaBase /** @endcond */ + + + #ifndef SWIG + + + + /** @cond doxygenlibCombineInternal */ + + /** + * Gets the value of the "attributeName" attribute of this CaOmexManifest. + * + * @param attributeName, the name of the attribute to retrieve. + * + * @param value, the address of the value to record. + * + * @copydetails doc_returns_success_code + * @li @omexconstant{LIBCOMBINE_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @omexconstant{LIBCOMBINE_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int getAttribute(const std::string& attributeName, bool& value) + const; + + /** @endcond */ + + + + /** @cond doxygenlibCombineInternal */ + + /** + * Gets the value of the "attributeName" attribute of this CaOmexManifest. + * + * @param attributeName, the name of the attribute to retrieve. + * + * @param value, the address of the value to record. + * + * @copydetails doc_returns_success_code + * @li @omexconstant{LIBCOMBINE_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @omexconstant{LIBCOMBINE_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int getAttribute(const std::string& attributeName, int& value) const; + + /** @endcond */ + + + + /** @cond doxygenlibCombineInternal */ + + /** + * Gets the value of the "attributeName" attribute of this CaOmexManifest. + * + * @param attributeName, the name of the attribute to retrieve. + * + * @param value, the address of the value to record. + * + * @copydetails doc_returns_success_code + * @li @omexconstant{LIBCOMBINE_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @omexconstant{LIBCOMBINE_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int getAttribute(const std::string& attributeName, + double& value) const; + + /** @endcond */ + + + + /** @cond doxygenlibCombineInternal */ + + /** + * Gets the value of the "attributeName" attribute of this CaOmexManifest. + * + * @param attributeName, the name of the attribute to retrieve. + * + * @param value, the address of the value to record. + * + * @copydetails doc_returns_success_code + * @li @omexconstant{LIBCOMBINE_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @omexconstant{LIBCOMBINE_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int getAttribute(const std::string& attributeName, + unsigned int& value) const; + + /** @endcond */ + + + + /** @cond doxygenlibCombineInternal */ + + /** + * Gets the value of the "attributeName" attribute of this CaOmexManifest. + * + * @param attributeName, the name of the attribute to retrieve. + * + * @param value, the address of the value to record. + * + * @copydetails doc_returns_success_code + * @li @omexconstant{LIBCOMBINE_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @omexconstant{LIBCOMBINE_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int getAttribute(const std::string& attributeName, + std::string& value) const; + + /** @endcond */ + + + + /** @cond doxygenlibCombineInternal */ + + /** + * Predicate returning @c true if this CaOmexManifest's attribute + * "attributeName" is set. + * + * @param attributeName, the name of the attribute to query. + * + * @return @c true if this CaOmexManifest's attribute "attributeName" has + * been set, otherwise @c false is returned. + */ + virtual bool isSetAttribute(const std::string& attributeName) const; + + /** @endcond */ + + + + /** @cond doxygenlibCombineInternal */ + + /** + * Sets the value of the "attributeName" attribute of this CaOmexManifest. + * + * @param attributeName, the name of the attribute to set. + * + * @param value, the value of the attribute to set. + * + * @copydetails doc_returns_success_code + * @li @omexconstant{LIBCOMBINE_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @omexconstant{LIBCOMBINE_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int setAttribute(const std::string& attributeName, bool value); + + /** @endcond */ + + + + /** @cond doxygenlibCombineInternal */ + + /** + * Sets the value of the "attributeName" attribute of this CaOmexManifest. + * + * @param attributeName, the name of the attribute to set. + * + * @param value, the value of the attribute to set. + * + * @copydetails doc_returns_success_code + * @li @omexconstant{LIBCOMBINE_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @omexconstant{LIBCOMBINE_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int setAttribute(const std::string& attributeName, int value); + + /** @endcond */ + + + + /** @cond doxygenlibCombineInternal */ + + /** + * Sets the value of the "attributeName" attribute of this CaOmexManifest. + * + * @param attributeName, the name of the attribute to set. + * + * @param value, the value of the attribute to set. + * + * @copydetails doc_returns_success_code + * @li @omexconstant{LIBCOMBINE_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @omexconstant{LIBCOMBINE_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int setAttribute(const std::string& attributeName, double value); + + /** @endcond */ + + + + /** @cond doxygenlibCombineInternal */ + + /** + * Sets the value of the "attributeName" attribute of this CaOmexManifest. + * + * @param attributeName, the name of the attribute to set. + * + * @param value, the value of the attribute to set. + * + * @copydetails doc_returns_success_code + * @li @omexconstant{LIBCOMBINE_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @omexconstant{LIBCOMBINE_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int setAttribute(const std::string& attributeName, + unsigned int value); + + /** @endcond */ + + + + /** @cond doxygenlibCombineInternal */ + + /** + * Sets the value of the "attributeName" attribute of this CaOmexManifest. + * + * @param attributeName, the name of the attribute to set. + * + * @param value, the value of the attribute to set. + * + * @copydetails doc_returns_success_code + * @li @omexconstant{LIBCOMBINE_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @omexconstant{LIBCOMBINE_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int setAttribute(const std::string& attributeName, + const std::string& value); + + /** @endcond */ + + + + /** @cond doxygenlibCombineInternal */ + + /** + * Unsets the value of the "attributeName" attribute of this CaOmexManifest. + * + * @param attributeName, the name of the attribute to query. + * + * @copydetails doc_returns_success_code + * @li @omexconstant{LIBCOMBINE_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @omexconstant{LIBCOMBINE_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int unsetAttribute(const std::string& attributeName); + + /** @endcond */ + + + + /** @cond doxygenlibCombineInternal */ + + /** + * Creates and returns an new "elementName" object in this CaOmexManifest. + * + * @param elementName, the name of the element to create. + * + * @return pointer to the element created. + */ + virtual CaBase* createChildObject(const std::string& elementName); + + /** @endcond */ + + + + /** @cond doxygenlibCombineInternal */ + + /** + * Adds a new "elementName" object to this CaOmexManifest. + * + * @param elementName, the name of the element to create. + * + * @param element, pointer to the element to be added. + * + * @copydetails doc_returns_success_code + * @li @omexconstant{LIBCOMBINE_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @omexconstant{LIBCOMBINE_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int addChildObject(const std::string& elementName, + const CaBase* element); + + /** @endcond */ + + + + /** @cond doxygenlibCombineInternal */ + + /** + * Removes and returns the new "elementName" object with the given id in this + * CaOmexManifest. + * + * @param elementName, the name of the element to remove. + * + * @param id, the id of the element to remove. + * + * @return pointer to the element removed. + */ + virtual CaBase* removeChildObject(const std::string& elementName, + const std::string& id); + + /** @endcond */ + + + + /** @cond doxygenlibCombineInternal */ + + /** + * Returns the number of "elementName" in this CaOmexManifest. + * + * @param elementName, the name of the element to get number of. + * + * @return unsigned int number of elements. + */ + virtual unsigned int getNumObjects(const std::string& elementName); + + /** @endcond */ + + + + /** @cond doxygenlibCombineInternal */ + + /** + * Returns the nth object of "objectName" in this CaOmexManifest. + * + * @param elementName, the name of the element to get number of. + * + * @param index, unsigned int the index of the object to retrieve. + * + * @return pointer to the object. + */ + virtual CaBase* getObject(const std::string& elementName, unsigned int + index); + + /** @endcond */ + + + + + #endif /* !SWIG */ + + /** * Returns the first child element that has the given @p id in the model-wide * SId namespace, or @c NULL if no such object is found. @@ -310,7 +686,8 @@ class LIBCOMBINE_EXTERN CaOmexManifest : public CaBase * @param id a string representing the id attribute of the object to * retrieve. * - * @return a pointer to the CaBase element with the given @p id. + * @return a pointer to the CaBase element with the given @p id. If no such + * object is found, this method returns @c NULL. */ virtual CaBase* getElementBySId(const std::string& id); @@ -358,7 +735,9 @@ class LIBCOMBINE_EXTERN CaOmexManifest : public CaBase * @param n an unsigned int representing the index of the CaError to * retrieve. * - * @return the nth CaError in the CaListOfErrors within this CaDocument. + * @return the nth CaError within this CaDocument. + * + * @copydetails doc_returned_unowned_pointer * * @see getNumErrors() */ @@ -371,7 +750,9 @@ class LIBCOMBINE_EXTERN CaOmexManifest : public CaBase * @param n an unsigned int representing the index of the CaError to * retrieve. * - * @return the nth CaError in the CaListOfErrors within this CaDocument. + * @return the nth CaError within this CaDocument. + * + * @copydetails doc_returned_unowned_pointer * * @see getNumErrors() */ @@ -382,6 +763,8 @@ class LIBCOMBINE_EXTERN CaOmexManifest : public CaBase * Get the number of CaError objects in this CaDocument. * * @return the number of CaError objects in this CaDocument. + * + * @see getError(unsigned int n) */ unsigned int getNumErrors() const; @@ -393,6 +776,8 @@ class LIBCOMBINE_EXTERN CaOmexManifest : public CaBase * @param severity the severity of the CaError to return. * * @return the number of CaError objects in this CaDocument. + * + * @see getError(unsigned int n) */ unsigned int getNumErrors(unsigned int severity) const; @@ -467,6 +852,8 @@ CaOmexManifest_create(); * * @return a (deep) copy of this CaOmexManifest_t object. * + * @copydetails doc_returned_owned_pointer + * * @memberof CaOmexManifest_t */ LIBCOMBINE_EXTERN @@ -487,13 +874,22 @@ CaOmexManifest_free(CaOmexManifest_t* com); /** - * Returns a ListOf_t* containing CaContent_t objects from this + * Returns a ListOf_t * containing CaContent_t objects from this * CaOmexManifest_t. * - * @param com the CaOmexManifest_t structure whose "CaListOfContents" is - * sought. + * @param com the CaOmexManifest_t structure whose CaListOfContents is sought. + * + * @return the CaListOfContents from this CaOmexManifest_t as a ListOf_t *. * - * @return the "CaListOfContents" from this CaOmexManifest_t as a ListOf_t *. + * @copydetails doc_returned_unowned_pointer + * + * @see CaOmexManifest_addContent() + * @see CaOmexManifest_createContent() + * @see CaOmexManifest_getContentById() + * @see CaOmexManifest_getContent() + * @see CaOmexManifest_getNumContents() + * @see CaOmexManifest_removeContentById() + * @see CaOmexManifest_removeContent() * * @memberof CaOmexManifest_t */ @@ -513,10 +909,12 @@ CaOmexManifest_getListOfContents(CaOmexManifest_t* com); * @return the nth CaContent_t in the CaListOfContents within this * CaOmexManifest. * + * @copydetails doc_returned_unowned_pointer + * * @memberof CaOmexManifest_t */ LIBCOMBINE_EXTERN -const CaContent_t* +CaContent_t* CaOmexManifest_getContent(CaOmexManifest_t* com, unsigned int n); @@ -531,6 +929,11 @@ CaOmexManifest_getContent(CaOmexManifest_t* com, unsigned int n); * @copydetails doc_returns_success_code * @li @omexconstant{LIBCOMBINE_OPERATION_SUCCESS, OperationReturnValues_t} * @li @omexconstant{LIBCOMBINE_OPERATION_FAILED, OperationReturnValues_t} + * @li @omexconstant{LIBCOMBINE_INVALID_OBJECT, OperationReturnValues_t} + * @li @omexconstant{LIBCOMBINE_LEVEL_MISMATCH, OperationReturnValues_t} + * @li @omexconstant{LIBCOMBINE_VERSION_MISMATCH, OperationReturnValues_t} + * @li @omexconstant{LIBCOMBINE_PKG_VERSION_MISMATCH, OperationReturnValues_t} + * @li @omexconstant{LIBCOMBINE_DUPLICATE_OBJECT_ID, OperationReturnValues_t} * * @memberof CaOmexManifest_t */ @@ -562,6 +965,8 @@ CaOmexManifest_getNumContents(CaOmexManifest_t* com); * * @return a new CaContent_t object instance. * + * @copydetails doc_returned_unowned_pointer + * * @memberof CaOmexManifest_t */ LIBCOMBINE_EXTERN @@ -580,6 +985,8 @@ CaOmexManifest_createContent(CaOmexManifest_t* com); * * @return a pointer to the nth CaContent_t in this CaOmexManifest_t. * + * @copydetails doc_returned_owned_pointer + * * @memberof CaOmexManifest_t */ LIBCOMBINE_EXTERN @@ -587,25 +994,6 @@ CaContent_t* CaOmexManifest_removeContent(CaOmexManifest_t* com, unsigned int n); -/** - * Predicate returning @c 1 if all the required elements for this - * CaOmexManifest_t object have been set. - * - * @param com the CaOmexManifest_t structure. - * - * @return @c 1 to indicate that all the required elements of this - * CaOmexManifest_t have been set, otherwise @c 0 is returned. - * - * - * @note The required elements for the CaOmexManifest_t object are: - * - * @memberof CaOmexManifest_t - */ -LIBCOMBINE_EXTERN -int -CaOmexManifest_hasRequiredElements(const CaOmexManifest_t * com); - - END_C_DECLS diff --git a/dev/generated/src/omex/CaReader.cpp b/dev/generated/src/omex/CaReader.cpp index ea04b77..e46d582 100644 --- a/dev/generated/src/omex/CaReader.cpp +++ b/dev/generated/src/omex/CaReader.cpp @@ -7,7 +7,11 @@ * This file is part of libSBML. Please visit http://sbml.org for more * information about SBML, and the latest version of libSBML. * - * Copyright (C) 2013-2016 jointly by the following organizations: + * Copyright (C) 2019 jointly by the following organizations: + * 1. California Institute of Technology, Pasadena, CA, USA + * 2. University of Heidelberg, Heidelberg, Germany + * + * Copyright (C) 2013-2018 jointly by the following organizations: * 1. California Institute of Technology, Pasadena, CA, USA * 2. EMBL European Bioinformatics Institute (EMBL-EBI), Hinxton, UK * 3. University of Heidelberg, Heidelberg, Germany @@ -218,7 +222,7 @@ CaReader::readInternal (const char* content, bool isFile) { XMLInputStream stream(content, isFile, "", d->getErrorLog()); - if (stream.peek().isStart() && stream.peek().getName() != "omex") + if (stream.peek().isStart() && stream.peek().getName() != "OmexManifest") { // the root element ought to be an omex element. d->getErrorLog()->logError(CaNotSchemaConformant); diff --git a/dev/generated/src/omex/CaReader.h b/dev/generated/src/omex/CaReader.h index 99eaa37..d2e0437 100644 --- a/dev/generated/src/omex/CaReader.h +++ b/dev/generated/src/omex/CaReader.h @@ -7,7 +7,11 @@ * This file is part of libSBML. Please visit http://sbml.org for more * information about SBML, and the latest version of libSBML. * - * Copyright (C) 2013-2016 jointly by the following organizations: + * Copyright (C) 2019 jointly by the following organizations: + * 1. California Institute of Technology, Pasadena, CA, USA + * 2. University of Heidelberg, Heidelberg, Germany + * + * Copyright (C) 2013-2018 jointly by the following organizations: * 1. California Institute of Technology, Pasadena, CA, USA * 2. EMBL European Bioinformatics Institute (EMBL-EBI), Hinxton, UK * 3. University of Heidelberg, Heidelberg, Germany @@ -30,7 +34,7 @@ * available online as http://sbml.org/software/libsbml/license.html * ------------------------------------------------------------------------ --> * - * @class + * @class CaReader * @sbmlbrief{} TODO:Definition of the CaReader class. */ diff --git a/dev/generated/src/omex/CaTypeCodes.cpp b/dev/generated/src/omex/CaTypeCodes.cpp index 56113d4..350cd13 100644 --- a/dev/generated/src/omex/CaTypeCodes.cpp +++ b/dev/generated/src/omex/CaTypeCodes.cpp @@ -7,7 +7,11 @@ * This file is part of libSBML. Please visit http://sbml.org for more * information about SBML, and the latest version of libSBML. * - * Copyright (C) 2013-2016 jointly by the following organizations: + * Copyright (C) 2019 jointly by the following organizations: + * 1. California Institute of Technology, Pasadena, CA, USA + * 2. University of Heidelberg, Heidelberg, Germany + * + * Copyright (C) 2013-2018 jointly by the following organizations: * 1. California Institute of Technology, Pasadena, CA, USA * 2. EMBL European Bioinformatics Institute (EMBL-EBI), Hinxton, UK * 3. University of Heidelberg, Heidelberg, Germany @@ -44,6 +48,7 @@ const char* OMEX_TYPE_CODE_STRINGS[] = "(Unknown OMEX Type)" , "Content" , "OmexManifest" + , "CrossRef" , "CaListOf" }; diff --git a/dev/generated/src/omex/CaTypeCodes.h b/dev/generated/src/omex/CaTypeCodes.h index 4785acd..cff9e02 100644 --- a/dev/generated/src/omex/CaTypeCodes.h +++ b/dev/generated/src/omex/CaTypeCodes.h @@ -7,7 +7,11 @@ * This file is part of libSBML. Please visit http://sbml.org for more * information about SBML, and the latest version of libSBML. * - * Copyright (C) 2013-2016 jointly by the following organizations: + * Copyright (C) 2019 jointly by the following organizations: + * 1. California Institute of Technology, Pasadena, CA, USA + * 2. University of Heidelberg, Heidelberg, Germany + * + * Copyright (C) 2013-2018 jointly by the following organizations: * 1. California Institute of Technology, Pasadena, CA, USA * 2. EMBL European Bioinformatics Institute (EMBL-EBI), Hinxton, UK * 3. University of Heidelberg, Heidelberg, Germany @@ -30,7 +34,7 @@ * available online as http://sbml.org/software/libsbml/license.html * ------------------------------------------------------------------------ --> * - * @class + * @class CaTypeCodes * @sbmlbrief{} TODO:Definition of the CaTypeCodes class. */ @@ -61,6 +65,7 @@ typedef enum OMEX_UNKNOWN = 0 , LIB_COMBINE_CONTENT , LIB_COMBINE_OMEXMANIFEST + , LIB_COMBINE_CROSSREF , OMEX_LIST_OF } CaTypeCode_t; diff --git a/dev/generated/src/omex/CaTypes.h b/dev/generated/src/omex/CaTypes.h index 133dd8f..f0f6d8e 100644 --- a/dev/generated/src/omex/CaTypes.h +++ b/dev/generated/src/omex/CaTypes.h @@ -7,7 +7,11 @@ * This file is part of libSBML. Please visit http://sbml.org for more * information about SBML, and the latest version of libSBML. * - * Copyright (C) 2013-2016 jointly by the following organizations: + * Copyright (C) 2019 jointly by the following organizations: + * 1. California Institute of Technology, Pasadena, CA, USA + * 2. University of Heidelberg, Heidelberg, Germany + * + * Copyright (C) 2013-2018 jointly by the following organizations: * 1. California Institute of Technology, Pasadena, CA, USA * 2. EMBL European Bioinformatics Institute (EMBL-EBI), Hinxton, UK * 3. University of Heidelberg, Heidelberg, Germany @@ -44,9 +48,11 @@ #include #include +#include #include #include +#include #endif /* CaTypes_h */ diff --git a/dev/generated/src/omex/CaVisitor.cpp b/dev/generated/src/omex/CaVisitor.cpp index dd5444a..200f562 100644 --- a/dev/generated/src/omex/CaVisitor.cpp +++ b/dev/generated/src/omex/CaVisitor.cpp @@ -7,7 +7,11 @@ * This file is part of libSBML. Please visit http://sbml.org for more * information about SBML, and the latest version of libSBML. * - * Copyright (C) 2013-2016 jointly by the following organizations: + * Copyright (C) 2019 jointly by the following organizations: + * 1. California Institute of Technology, Pasadena, CA, USA + * 2. University of Heidelberg, Heidelberg, Germany + * + * Copyright (C) 2013-2018 jointly by the following organizations: * 1. California Institute of Technology, Pasadena, CA, USA * 2. EMBL European Bioinformatics Institute (EMBL-EBI), Hinxton, UK * 3. University of Heidelberg, Heidelberg, Germany @@ -76,6 +80,16 @@ CaVisitor::visit(const CaContent& x) } +/* + * Visit the CaCrossRef + */ +bool +CaVisitor::visit(const CaCrossRef& x) +{ + return visit(static_cast(x)); +} + + void CaVisitor::leave (const CaOmexManifest& x) { @@ -103,6 +117,15 @@ CaVisitor::leave(const CaContent& x) } +/* + * Leave the CaCrossRef + */ +void +CaVisitor::leave(const CaCrossRef& x) +{ +} + + #endif /* __cplusplus */ diff --git a/dev/generated/src/omex/CaVisitor.h b/dev/generated/src/omex/CaVisitor.h index 812d008..b42ed1c 100644 --- a/dev/generated/src/omex/CaVisitor.h +++ b/dev/generated/src/omex/CaVisitor.h @@ -7,7 +7,11 @@ * This file is part of libSBML. Please visit http://sbml.org for more * information about SBML, and the latest version of libSBML. * - * Copyright (C) 2013-2016 jointly by the following organizations: + * Copyright (C) 2019 jointly by the following organizations: + * 1. California Institute of Technology, Pasadena, CA, USA + * 2. University of Heidelberg, Heidelberg, Germany + * + * Copyright (C) 2013-2018 jointly by the following organizations: * 1. California Institute of Technology, Pasadena, CA, USA * 2. EMBL European Bioinformatics Institute (EMBL-EBI), Hinxton, UK * 3. University of Heidelberg, Heidelberg, Germany @@ -30,7 +34,7 @@ * available online as http://sbml.org/software/libsbml/license.html * ------------------------------------------------------------------------ --> * - * @class + * @class CaVisitor * @sbmlbrief{} TODO:Definition of the CaVisitor class. */ @@ -59,6 +63,7 @@ class CaListOf; class CaContent; class CaOmexManifest; +class CaCrossRef; class CaVisitor @@ -113,6 +118,16 @@ class CaVisitor virtual bool visit (const CaContent &x); +/** + * Interface method for using the Visitor + * Pattern to perform operations on CaBase objects. + * + * @param x the CaBase object to visit. + */ +virtual bool visit (const CaCrossRef &x); + + /** * Interface method for using the Visitor @@ -154,6 +169,16 @@ virtual bool visit (const CaContent &x); * @param x the CaBase object to leave. */ virtual void leave (const CaContent &x); + + +/** + * Interface method for using the Visitor + * Pattern to perform operations on CaBase objects. + * + * @param x the CaBase object to leave. + */ +virtual void leave (const CaCrossRef &x); }; LIBCOMBINE_CPP_NAMESPACE_END diff --git a/dev/generated/src/omex/CaWriter.cpp b/dev/generated/src/omex/CaWriter.cpp index 60d3773..781d56d 100644 --- a/dev/generated/src/omex/CaWriter.cpp +++ b/dev/generated/src/omex/CaWriter.cpp @@ -7,7 +7,11 @@ * This file is part of libSBML. Please visit http://sbml.org for more * information about SBML, and the latest version of libSBML. * - * Copyright (C) 2013-2016 jointly by the following organizations: + * Copyright (C) 2019 jointly by the following organizations: + * 1. California Institute of Technology, Pasadena, CA, USA + * 2. University of Heidelberg, Heidelberg, Germany + * + * Copyright (C) 2013-2018 jointly by the following organizations: * 1. California Institute of Technology, Pasadena, CA, USA * 2. EMBL European Bioinformatics Institute (EMBL-EBI), Hinxton, UK * 3. University of Heidelberg, Heidelberg, Germany diff --git a/dev/generated/src/omex/CaWriter.h b/dev/generated/src/omex/CaWriter.h index 5650f34..ffeefde 100644 --- a/dev/generated/src/omex/CaWriter.h +++ b/dev/generated/src/omex/CaWriter.h @@ -7,7 +7,11 @@ * This file is part of libSBML. Please visit http://sbml.org for more * information about SBML, and the latest version of libSBML. * - * Copyright (C) 2013-2016 jointly by the following organizations: + * Copyright (C) 2019 jointly by the following organizations: + * 1. California Institute of Technology, Pasadena, CA, USA + * 2. University of Heidelberg, Heidelberg, Germany + * + * Copyright (C) 2013-2018 jointly by the following organizations: * 1. California Institute of Technology, Pasadena, CA, USA * 2. EMBL European Bioinformatics Institute (EMBL-EBI), Hinxton, UK * 3. University of Heidelberg, Heidelberg, Germany @@ -30,7 +34,7 @@ * available online as http://sbml.org/software/libsbml/license.html * ------------------------------------------------------------------------ --> * - * @class + * @class CaWriter * @sbmlbrief{} TODO:Definition of the CaWriter class. */ diff --git a/dev/generated/src/omex/common/CaOperationReturnValues.cpp b/dev/generated/src/omex/common/CaOperationReturnValues.cpp index 3c2750c..dc1ca3c 100644 --- a/dev/generated/src/omex/common/CaOperationReturnValues.cpp +++ b/dev/generated/src/omex/common/CaOperationReturnValues.cpp @@ -7,7 +7,11 @@ * This file is part of libSBML. Please visit http://sbml.org for more * information about SBML, and the latest version of libSBML. * - * Copyright (C) 2013-2016 jointly by the following organizations: + * Copyright (C) 2019 jointly by the following organizations: + * 1. California Institute of Technology, Pasadena, CA, USA + * 2. University of Heidelberg, Heidelberg, Germany + * + * Copyright (C) 2013-2018 jointly by the following organizations: * 1. California Institute of Technology, Pasadena, CA, USA * 2. EMBL European Bioinformatics Institute (EMBL-EBI), Hinxton, UK * 3. University of Heidelberg, Heidelberg, Germany diff --git a/dev/generated/src/omex/common/CaOperationReturnValues.h b/dev/generated/src/omex/common/CaOperationReturnValues.h index fbe8599..07e56d1 100644 --- a/dev/generated/src/omex/common/CaOperationReturnValues.h +++ b/dev/generated/src/omex/common/CaOperationReturnValues.h @@ -7,7 +7,11 @@ * This file is part of libSBML. Please visit http://sbml.org for more * information about SBML, and the latest version of libSBML. * - * Copyright (C) 2013-2016 jointly by the following organizations: + * Copyright (C) 2019 jointly by the following organizations: + * 1. California Institute of Technology, Pasadena, CA, USA + * 2. University of Heidelberg, Heidelberg, Germany + * + * Copyright (C) 2013-2018 jointly by the following organizations: * 1. California Institute of Technology, Pasadena, CA, USA * 2. EMBL European Bioinformatics Institute (EMBL-EBI), Hinxton, UK * 3. University of Heidelberg, Heidelberg, Germany @@ -30,7 +34,7 @@ * available online as http://sbml.org/software/libsbml/license.html * ------------------------------------------------------------------------ --> * - * @class + * @class CaOperationReturnValues * @sbmlbrief{} TODO:Definition of the CaOperationReturnValues class. */ diff --git a/dev/generated/src/omex/common/combinefwd.h b/dev/generated/src/omex/common/combinefwd.h index 3084016..77efb7e 100644 --- a/dev/generated/src/omex/common/combinefwd.h +++ b/dev/generated/src/omex/common/combinefwd.h @@ -7,7 +7,11 @@ * This file is part of libSBML. Please visit http://sbml.org for more * information about SBML, and the latest version of libSBML. * - * Copyright (C) 2013-2016 jointly by the following organizations: + * Copyright (C) 2019 jointly by the following organizations: + * 1. California Institute of Technology, Pasadena, CA, USA + * 2. University of Heidelberg, Heidelberg, Germany + * + * Copyright (C) 2013-2018 jointly by the following organizations: * 1. California Institute of Technology, Pasadena, CA, USA * 2. EMBL European Bioinformatics Institute (EMBL-EBI), Hinxton, UK * 3. University of Heidelberg, Heidelberg, Germany @@ -36,6 +40,8 @@ #define combinefwd_H__ +#include + /** * Forward declaration of all opaque C types. * @@ -57,6 +63,7 @@ LIBCOMBINE_CPP_NAMESPACE_BEGIN typedef CLASS_OR_STRUCT CaContent CaContent_t; typedef CLASS_OR_STRUCT CaOmexManifest CaOmexManifest_t; +typedef CLASS_OR_STRUCT CaCrossRef CaCrossRef_t; typedef CLASS_OR_STRUCT CaBase CaBase_t; typedef CLASS_OR_STRUCT CaListOf CaListOf_t; typedef CLASS_OR_STRUCT CaReader CaReader_t; @@ -68,6 +75,25 @@ typedef CLASS_OR_STRUCT CaError CaError_t; LIBCOMBINE_CPP_NAMESPACE_END + +#include + +LIBSBML_CPP_NAMESPACE_BEGIN + +/** + * @var typedef class ASTNode ASTNode_t + * @copydoc ASTNode + */ +typedef CLASS_OR_STRUCT ASTNode ASTNode_t; + +/** + * @var typedef class XMLNode XMLNode_t + * @copydoc XMLNode + */ +typedef CLASS_OR_STRUCT XMLNode XMLNode_t; + +LIBSBML_CPP_NAMESPACE_END + #undef CLASS_OR_STRUCT diff --git a/dev/generated/src/omex/common/common.h b/dev/generated/src/omex/common/common.h index e3d4eae..c43fce0 100644 --- a/dev/generated/src/omex/common/common.h +++ b/dev/generated/src/omex/common/common.h @@ -7,7 +7,11 @@ * This file is part of libSBML. Please visit http://sbml.org for more * information about SBML, and the latest version of libSBML. * - * Copyright (C) 2013-2016 jointly by the following organizations: + * Copyright (C) 2019 jointly by the following organizations: + * 1. California Institute of Technology, Pasadena, CA, USA + * 2. University of Heidelberg, Heidelberg, Germany + * + * Copyright (C) 2013-2018 jointly by the following organizations: * 1. California Institute of Technology, Pasadena, CA, USA * 2. EMBL European Bioinformatics Institute (EMBL-EBI), Hinxton, UK * 3. University of Heidelberg, Heidelberg, Germany @@ -30,7 +34,7 @@ * available online as http://sbml.org/software/libsbml/license.html * ------------------------------------------------------------------------ --> * - * @class + * @class common * @sbmlbrief{} TODO:Definition of the common class. */ diff --git a/dev/generated/src/omex/common/extern.h b/dev/generated/src/omex/common/extern.h index 468bc18..174f133 100644 --- a/dev/generated/src/omex/common/extern.h +++ b/dev/generated/src/omex/common/extern.h @@ -7,7 +7,11 @@ * This file is part of libSBML. Please visit http://sbml.org for more * information about SBML, and the latest version of libSBML. * - * Copyright (C) 2013-2016 jointly by the following organizations: + * Copyright (C) 2019 jointly by the following organizations: + * 1. California Institute of Technology, Pasadena, CA, USA + * 2. University of Heidelberg, Heidelberg, Germany + * + * Copyright (C) 2013-2018 jointly by the following organizations: * 1. California Institute of Technology, Pasadena, CA, USA * 2. EMBL European Bioinformatics Institute (EMBL-EBI), Hinxton, UK * 3. University of Heidelberg, Heidelberg, Germany @@ -30,7 +34,7 @@ * available online as http://sbml.org/software/libsbml/license.html * ------------------------------------------------------------------------ --> * - * @class + * @class extern * @sbmlbrief{} TODO:Definition of the extern class. */ diff --git a/dev/generated/src/omex/common/libcombine-config.h b/dev/generated/src/omex/common/libcombine-config.h index 9a967f5..342a6fd 100644 --- a/dev/generated/src/omex/common/libcombine-config.h +++ b/dev/generated/src/omex/common/libcombine-config.h @@ -7,7 +7,11 @@ * This file is part of libSBML. Please visit http://sbml.org for more * information about SBML, and the latest version of libSBML. * - * Copyright (C) 2013-2016 jointly by the following organizations: + * Copyright (C) 2019 jointly by the following organizations: + * 1. California Institute of Technology, Pasadena, CA, USA + * 2. University of Heidelberg, Heidelberg, Germany + * + * Copyright (C) 2013-2018 jointly by the following organizations: * 1. California Institute of Technology, Pasadena, CA, USA * 2. EMBL European Bioinformatics Institute (EMBL-EBI), Hinxton, UK * 3. University of Heidelberg, Heidelberg, Germany @@ -30,7 +34,7 @@ * available online as http://sbml.org/software/libsbml/license.html * ------------------------------------------------------------------------ --> * - * @class + * @class libcombine-config * @sbmlbrief{} TODO:Definition of the libcombine-config class. */ diff --git a/dev/generated/src/omex/common/libcombine-version.cpp b/dev/generated/src/omex/common/libcombine-version.cpp index 107be52..31ed729 100644 --- a/dev/generated/src/omex/common/libcombine-version.cpp +++ b/dev/generated/src/omex/common/libcombine-version.cpp @@ -7,7 +7,11 @@ * This file is part of libSBML. Please visit http://sbml.org for more * information about SBML, and the latest version of libSBML. * - * Copyright (C) 2013-2016 jointly by the following organizations: + * Copyright (C) 2019 jointly by the following organizations: + * 1. California Institute of Technology, Pasadena, CA, USA + * 2. University of Heidelberg, Heidelberg, Germany + * + * Copyright (C) 2013-2018 jointly by the following organizations: * 1. California Institute of Technology, Pasadena, CA, USA * 2. EMBL European Bioinformatics Institute (EMBL-EBI), Hinxton, UK * 3. University of Heidelberg, Heidelberg, Germany diff --git a/dev/generated/src/omex/common/libcombine-version.h.cmake b/dev/generated/src/omex/common/libcombine-version.h.cmake index 0b6c75e..ec5dfee 100644 --- a/dev/generated/src/omex/common/libcombine-version.h.cmake +++ b/dev/generated/src/omex/common/libcombine-version.h.cmake @@ -16,7 +16,7 @@ * * A version string of the form "1.2.3". */ -#define LIBCOMBINE_DOTTED_VERSION "@LIBCOMBINE_VERSION@" +#define LIBCOMBINE_DOTTED_VERSION "@PACKAGE_VERSION@" /** diff --git a/examples/python/printExample.py b/examples/python/printExample.py index 2b9ccc0..5182af6 100755 --- a/examples/python/printExample.py +++ b/examples/python/printExample.py @@ -53,6 +53,9 @@ def printArchive(fileName): print(" {0}: location: {1} format: {2}".format(i, entry.getLocation(), entry.getFormat())) printMetaDataFor(archive, entry.getLocation()) + for j in range(entry.getNumCrossRefs()): + print(" {0}: crossRef location {1}".format(j, entry.getCrossRef(j).getLocation())) + # the entry could now be extracted via # archive.extractEntry(entry.getLocation(), ) diff --git a/src/bindings/swig/libcombine.i b/src/bindings/swig/libcombine.i index 9bf4d0d..beafb2c 100644 --- a/src/bindings/swig/libcombine.i +++ b/src/bindings/swig/libcombine.i @@ -368,7 +368,9 @@ typedef std::vector CaErrorStdVector; %include %include +%include %include +%include %include %template(StringVector) std::vector; diff --git a/src/omex/CaBase.cpp b/src/omex/CaBase.cpp index 93ef23f..9f2dc38 100644 --- a/src/omex/CaBase.cpp +++ b/src/omex/CaBase.cpp @@ -7,7 +7,11 @@ * This file is part of libSBML. Please visit http://sbml.org for more * information about SBML, and the latest version of libSBML. * - * Copyright (C) 2013-2016 jointly by the following organizations: + * Copyright (C) 2019 jointly by the following organizations: + * 1. California Institute of Technology, Pasadena, CA, USA + * 2. University of Heidelberg, Heidelberg, Germany + * + * Copyright (C) 2013-2018 jointly by the following organizations: * 1. California Institute of Technology, Pasadena, CA, USA * 2. EMBL European Bioinformatics Institute (EMBL-EBI), Hinxton, UK * 3. University of Heidelberg, Heidelberg, Germany @@ -107,6 +111,7 @@ CaBase::getAllElements() */ CaBase::CaBase (unsigned int level, unsigned int version) : mMetaId ("") + , mId ("") , mNotes(NULL) , mAnnotation( NULL ) , mCa ( NULL ) @@ -137,6 +142,7 @@ CaBase::CaBase (unsigned int level, unsigned int version) */ CaBase::CaBase (CaNamespaces *omexns) : mMetaId("") + , mId("") , mNotes(NULL) , mAnnotation( NULL ) , mCa ( NULL ) @@ -167,6 +173,7 @@ CaBase::CaBase (CaNamespaces *omexns) */ CaBase::CaBase(const CaBase& orig) : mMetaId (orig.mMetaId) + , mId (orig.mId) , mNotes (NULL) , mAnnotation (NULL) , mCa (NULL) @@ -178,12 +185,12 @@ CaBase::CaBase(const CaBase& orig) , mURI(orig.mURI) { if(orig.mNotes != NULL) - this->mNotes = new XMLNode(*const_cast(orig).getNotes()); + this->mNotes = new LIBSBML_CPP_NAMESPACE_QUALIFIER XMLNode(*const_cast(orig).getNotes()); else this->mNotes = NULL; if(orig.mAnnotation != NULL) - this->mAnnotation = new XMLNode(*const_cast(orig).mAnnotation); + this->mAnnotation = new LIBSBML_CPP_NAMESPACE_QUALIFIER XMLNode(*const_cast(orig).mAnnotation); else this->mAnnotation = NULL; @@ -216,18 +223,19 @@ CaBase& CaBase::operator=(const CaBase& rhs) if(&rhs!=this) { this->mMetaId = rhs.mMetaId; + this->mId = rhs.mId; delete this->mNotes; if(rhs.mNotes != NULL) - this->mNotes = new XMLNode(*const_cast(rhs).getNotes()); + this->mNotes = new LIBSBML_CPP_NAMESPACE_QUALIFIER XMLNode(*const_cast(rhs).getNotes()); else this->mNotes = NULL; delete this->mAnnotation; if(rhs.mAnnotation != NULL) - this->mAnnotation = new XMLNode(*const_cast(rhs).mAnnotation); + this->mAnnotation = new LIBSBML_CPP_NAMESPACE_QUALIFIER XMLNode(*const_cast(rhs).mAnnotation); else this->mAnnotation = NULL; @@ -276,21 +284,21 @@ CaBase::getMetaId () const string& CaBase::getId() const { - return mEmptyString; + return mId; } /* * @return the notes of this OMEX object. */ -XMLNode* +LIBSBML_CPP_NAMESPACE_QUALIFIER XMLNode* CaBase::getNotes() { return mNotes; } -const XMLNode* +const LIBSBML_CPP_NAMESPACE_QUALIFIER XMLNode* CaBase::getNotes() const { return mNotes; @@ -303,28 +311,28 @@ CaBase::getNotes() const std::string CaBase::getNotesString() { - return XMLNode::convertXMLNodeToString(mNotes); + return LIBSBML_CPP_NAMESPACE_QUALIFIER XMLNode::convertXMLNodeToString(mNotes); } std::string CaBase::getNotesString() const { - return XMLNode::convertXMLNodeToString(mNotes); + return LIBSBML_CPP_NAMESPACE_QUALIFIER XMLNode::convertXMLNodeToString(mNotes); } /* * @return the annotation of this OMEX object. */ -XMLNode* +LIBSBML_CPP_NAMESPACE_QUALIFIER XMLNode* CaBase::getAnnotation () { return mAnnotation; } -const XMLNode* +const LIBSBML_CPP_NAMESPACE_QUALIFIER XMLNode* CaBase::getAnnotation () const { return const_cast(this)->getAnnotation(); @@ -337,14 +345,14 @@ CaBase::getAnnotation () const std::string CaBase::getAnnotationString () { - return XMLNode::convertXMLNodeToString(getAnnotation()); + return LIBSBML_CPP_NAMESPACE_QUALIFIER XMLNode::convertXMLNodeToString(getAnnotation()); } std::string CaBase::getAnnotationString () const { - return XMLNode::convertXMLNodeToString(getAnnotation()); + return LIBSBML_CPP_NAMESPACE_QUALIFIER XMLNode::convertXMLNodeToString(getAnnotation()); } @@ -422,7 +430,7 @@ CaBase::unsetUserData() /* * @return the Namespaces associated with this OMEX object */ -XMLNamespaces* +LIBSBML_CPP_NAMESPACE_QUALIFIER XMLNamespaces* CaBase::getNamespaces() { if (mCa != NULL) @@ -432,7 +440,7 @@ CaBase::getNamespaces() } -const XMLNamespaces* +const LIBSBML_CPP_NAMESPACE_QUALIFIER XMLNamespaces* CaBase::getNamespaces() const { if (mCa != NULL) @@ -637,12 +645,34 @@ CaBase::setMetaId (const std::string& metaid) } } +/* + * Sets the id field of the given OMEX object to a copy of sid. + */ +int +CaBase::setId (const std::string& sid) +{ + if (sid.empty()) + { + mId.erase(); + return LIBCOMBINE_OPERATION_SUCCESS; + } + else if (!(SyntaxChecker::isValidXMLID(sid))) + { + return LIBCOMBINE_INVALID_ATTRIBUTE_VALUE; + } + else + { + mId = sid; + return LIBCOMBINE_OPERATION_SUCCESS; + } +} + /* * Sets the annotation of this OMEX object to a copy of annotation. */ int -CaBase::setAnnotation (XMLNode* annotation) +CaBase::setAnnotation (LIBSBML_CPP_NAMESPACE_QUALIFIER XMLNode* annotation) { if (annotation == NULL) { @@ -675,17 +705,17 @@ CaBase::setAnnotation (const std::string& annotation) return LIBCOMBINE_OPERATION_SUCCESS; } - XMLNode* annt_xmln; + LIBSBML_CPP_NAMESPACE_QUALIFIER XMLNode* annt_xmln; // you might not have a document !! if (getCaOmexManifest() != NULL) { - XMLNamespaces* xmlns = getCaOmexManifest()->getNamespaces(); - annt_xmln = XMLNode::convertStringToXMLNode(annotation,xmlns); + LIBSBML_CPP_NAMESPACE_QUALIFIER XMLNamespaces* xmlns = getCaOmexManifest()->getNamespaces(); + annt_xmln = LIBSBML_CPP_NAMESPACE_QUALIFIER XMLNode::convertStringToXMLNode(annotation,xmlns); } else { - annt_xmln = XMLNode::convertStringToXMLNode(annotation); + annt_xmln = LIBSBML_CPP_NAMESPACE_QUALIFIER XMLNode::convertStringToXMLNode(annotation); } if(annt_xmln != NULL) @@ -703,7 +733,7 @@ CaBase::setAnnotation (const std::string& annotation) * adding additional information. */ int -CaBase::appendAnnotation (const XMLNode* annotation) +CaBase::appendAnnotation (const LIBSBML_CPP_NAMESPACE_QUALIFIER XMLNode* annotation) { int success = LIBCOMBINE_OPERATION_FAILED; unsigned int duplicates = 0; @@ -711,14 +741,14 @@ CaBase::appendAnnotation (const XMLNode* annotation) if(annotation == NULL) return LIBCOMBINE_OPERATION_SUCCESS; - XMLNode* new_annotation = NULL; + LIBSBML_CPP_NAMESPACE_QUALIFIER XMLNode* new_annotation = NULL; const string& name = annotation->getName(); // check for annotation tags and add if necessary if (name != "annotation") { - XMLToken ann_t = XMLToken(XMLTriple("annotation", "", ""), XMLAttributes()); - new_annotation = new XMLNode(ann_t); + LIBSBML_CPP_NAMESPACE_QUALIFIER XMLToken ann_t = LIBSBML_CPP_NAMESPACE_QUALIFIER XMLToken(LIBSBML_CPP_NAMESPACE_QUALIFIER XMLTriple("annotation", "", ""), LIBSBML_CPP_NAMESPACE_QUALIFIER XMLAttributes()); + new_annotation = new LIBSBML_CPP_NAMESPACE_QUALIFIER XMLNode(ann_t); new_annotation->addChild(*annotation); } else @@ -767,7 +797,7 @@ CaBase::appendAnnotation (const XMLNode* annotation) } else { - XMLNode *copy = mAnnotation->clone(); + LIBSBML_CPP_NAMESPACE_QUALIFIER XMLNode *copy = mAnnotation->clone(); success = setAnnotation(copy); delete copy; } @@ -793,15 +823,15 @@ int CaBase::appendAnnotation (const std::string& annotation) { int success = LIBCOMBINE_OPERATION_FAILED; - XMLNode* annt_xmln; + LIBSBML_CPP_NAMESPACE_QUALIFIER XMLNode* annt_xmln; if (getCaOmexManifest() != NULL) { - XMLNamespaces* xmlns = getCaOmexManifest()->getNamespaces(); - annt_xmln = XMLNode::convertStringToXMLNode(annotation,xmlns); + LIBSBML_CPP_NAMESPACE_QUALIFIER XMLNamespaces* xmlns = getCaOmexManifest()->getNamespaces(); + annt_xmln = LIBSBML_CPP_NAMESPACE_QUALIFIER XMLNode::convertStringToXMLNode(annotation,xmlns); } else { - annt_xmln = XMLNode::convertStringToXMLNode(annotation); + annt_xmln = LIBSBML_CPP_NAMESPACE_QUALIFIER XMLNode::convertStringToXMLNode(annotation); } if(annt_xmln != NULL) @@ -838,7 +868,7 @@ CaBase::removeTopLevelAnnotationElement(const std::string elementName, // check uri matches if (elementURI.empty() == false) { - XMLNode child = mAnnotation->getChild(index); + LIBSBML_CPP_NAMESPACE_QUALIFIER XMLNode child = mAnnotation->getChild(index); std::string prefix = child.getPrefix(); if (prefix.empty() == false @@ -890,10 +920,10 @@ CaBase::removeTopLevelAnnotationElement(const std::string elementName, int -CaBase::replaceTopLevelAnnotationElement(const XMLNode* annotation) +CaBase::replaceTopLevelAnnotationElement(const LIBSBML_CPP_NAMESPACE_QUALIFIER XMLNode* annotation) { int success = LIBCOMBINE_OPERATION_FAILED; - XMLNode * replacement = NULL; + LIBSBML_CPP_NAMESPACE_QUALIFIER XMLNode * replacement = NULL; if (annotation->getName() == "annotation") { if (annotation->getNumChildren() != 1) @@ -927,15 +957,15 @@ int CaBase::replaceTopLevelAnnotationElement(const std::string& annotation) { int success = LIBCOMBINE_OPERATION_FAILED; - XMLNode* annt_xmln; + LIBSBML_CPP_NAMESPACE_QUALIFIER XMLNode* annt_xmln; if (getCaOmexManifest() != NULL) { - XMLNamespaces* xmlns = getCaOmexManifest()->getNamespaces(); - annt_xmln = XMLNode::convertStringToXMLNode(annotation,xmlns); + LIBSBML_CPP_NAMESPACE_QUALIFIER XMLNamespaces* xmlns = getCaOmexManifest()->getNamespaces(); + annt_xmln = LIBSBML_CPP_NAMESPACE_QUALIFIER XMLNode::convertStringToXMLNode(annotation,xmlns); } else { - annt_xmln = XMLNode::convertStringToXMLNode(annotation); + annt_xmln = LIBSBML_CPP_NAMESPACE_QUALIFIER XMLNode::convertStringToXMLNode(annotation); } if(annt_xmln != NULL) @@ -953,7 +983,7 @@ CaBase::replaceTopLevelAnnotationElement(const std::string& annotation) * Sets the notes of this OMEX object to a copy of notes. */ int -CaBase::setNotes(const XMLNode* notes) +CaBase::setNotes(const LIBSBML_CPP_NAMESPACE_QUALIFIER XMLNode* notes) { if (mNotes == notes) { @@ -973,13 +1003,13 @@ CaBase::setNotes(const XMLNode* notes) if (name == "notes") { - mNotes = static_cast( notes->clone() ); + mNotes = static_cast( notes->clone() ); } else { - XMLToken notes_t = XMLToken(XMLTriple("notes", "", ""), - XMLAttributes()); - mNotes = new XMLNode(notes_t); + LIBSBML_CPP_NAMESPACE_QUALIFIER XMLToken notes_t = LIBSBML_CPP_NAMESPACE_QUALIFIER XMLToken(LIBSBML_CPP_NAMESPACE_QUALIFIER XMLTriple("notes", "", ""), + LIBSBML_CPP_NAMESPACE_QUALIFIER XMLAttributes()); + mNotes = new LIBSBML_CPP_NAMESPACE_QUALIFIER XMLNode(notes_t); // The root node of the given XMLNode tree can be an empty XMLNode // (i.e. neither start, end, nor text XMLNode) if the given notes was @@ -1028,17 +1058,17 @@ CaBase::setNotes(const std::string& notes, bool addXHTMLMarkup) } else { - XMLNode* notes_xmln; + LIBSBML_CPP_NAMESPACE_QUALIFIER XMLNode* notes_xmln; // you might not have a document !! if (getCaOmexManifest() != NULL) { - XMLNamespaces* xmlns = getCaOmexManifest()->getNamespaces(); - notes_xmln = XMLNode::convertStringToXMLNode(notes,xmlns); + LIBSBML_CPP_NAMESPACE_QUALIFIER XMLNamespaces* xmlns = getCaOmexManifest()->getNamespaces(); + notes_xmln = LIBSBML_CPP_NAMESPACE_QUALIFIER XMLNode::convertStringToXMLNode(notes,xmlns); } else { - notes_xmln = XMLNode::convertStringToXMLNode(notes); + notes_xmln = LIBSBML_CPP_NAMESPACE_QUALIFIER XMLNode::convertStringToXMLNode(notes); } if (notes_xmln != NULL) @@ -1051,11 +1081,11 @@ CaBase::setNotes(const std::string& notes, bool addXHTMLMarkup) && notes_xmln->isText() == true) { //create a parent node of xhtml type p - XMLAttributes blank_att = XMLAttributes(); - XMLTriple triple = XMLTriple("p", "http://www.w3.org/1999/xhtml", ""); - XMLNamespaces xmlns = XMLNamespaces(); + LIBSBML_CPP_NAMESPACE_QUALIFIER XMLAttributes blank_att = LIBSBML_CPP_NAMESPACE_QUALIFIER XMLAttributes(); + LIBSBML_CPP_NAMESPACE_QUALIFIER XMLTriple triple = LIBSBML_CPP_NAMESPACE_QUALIFIER XMLTriple("p", "http://www.w3.org/1999/xhtml", ""); + LIBSBML_CPP_NAMESPACE_QUALIFIER XMLNamespaces xmlns = LIBSBML_CPP_NAMESPACE_QUALIFIER XMLNamespaces(); xmlns.add("http://www.w3.org/1999/xhtml", ""); - XMLNode *xmlnode = new XMLNode(XMLToken(triple, blank_att, xmlns)); + LIBSBML_CPP_NAMESPACE_QUALIFIER XMLNode *xmlnode = new LIBSBML_CPP_NAMESPACE_QUALIFIER XMLNode(LIBSBML_CPP_NAMESPACE_QUALIFIER XMLToken(triple, blank_att, xmlns)); // create a text node from the text given xmlnode->addChild(*notes_xmln); @@ -1085,7 +1115,7 @@ CaBase::setNotes(const std::string& notes, bool addXHTMLMarkup) * adding additional information. */ int -CaBase::appendNotes(const XMLNode* notes) +CaBase::appendNotes(const LIBSBML_CPP_NAMESPACE_QUALIFIER XMLNode* notes) { int success = LIBCOMBINE_OPERATION_FAILED; if(notes == NULL) @@ -1114,7 +1144,7 @@ CaBase::appendNotes(const XMLNode* notes) typedef enum { _ANotesHTML, _ANotesBody, _ANotesAny } _NotesType; _NotesType addedNotesType = _ANotesAny; - XMLNode addedNotes; + LIBSBML_CPP_NAMESPACE_QUALIFIER XMLNode addedNotes; //------------------------------------------------------------ // @@ -1225,7 +1255,7 @@ CaBase::appendNotes(const XMLNode* notes) if (getLevel() > 2 || (getLevel() == 2 && getVersion() > 1)) { - XMLNode tmpNotes(XMLTriple("notes","",""), XMLAttributes()); + LIBSBML_CPP_NAMESPACE_QUALIFIER XMLNode tmpNotes(LIBSBML_CPP_NAMESPACE_QUALIFIER XMLTriple("notes","",""), LIBSBML_CPP_NAMESPACE_QUALIFIER XMLAttributes()); if (addedNotesType == _ANotesAny) { @@ -1255,7 +1285,7 @@ CaBase::appendNotes(const XMLNode* notes) //------------------------------------------------------------ _NotesType curNotesType = _ANotesAny; - XMLNode& curNotes = *mNotes; + LIBSBML_CPP_NAMESPACE_QUALIFIER XMLNode& curNotes = *mNotes; // curNotes.getChild(0) must be "html", "body", or any XHTML // element that would be permitted within a "body" element . @@ -1264,7 +1294,7 @@ CaBase::appendNotes(const XMLNode* notes) if (cname == "html") { - XMLNode& curHTML = curNotes.getChild(0); + LIBSBML_CPP_NAMESPACE_QUALIFIER XMLNode& curHTML = curNotes.getChild(0); // // checks the curHTML if the html tag contains "head" and "body" tags // which must be located in this order, otherwise nothing will be done. @@ -1304,14 +1334,14 @@ CaBase::appendNotes(const XMLNode* notes) if (curNotesType == _ANotesHTML) { - XMLNode& curHTML = curNotes.getChild(0); - XMLNode& curBody = curHTML.getChild(1); + LIBSBML_CPP_NAMESPACE_QUALIFIER XMLNode& curHTML = curNotes.getChild(0); + LIBSBML_CPP_NAMESPACE_QUALIFIER XMLNode& curBody = curHTML.getChild(1); if (addedNotesType == _ANotesHTML) { // adds the given html tag to the current html tag - XMLNode& addedBody = addedNotes.getChild(1); + LIBSBML_CPP_NAMESPACE_QUALIFIER XMLNode& addedBody = addedNotes.getChild(1); for (i=0; i < addedBody.getNumChildren(); i++) { @@ -1339,9 +1369,9 @@ CaBase::appendNotes(const XMLNode* notes) { // adds the given html tag to the current body tag - XMLNode addedHTML(addedNotes); - XMLNode& addedBody = addedHTML.getChild(1); - XMLNode& curBody = curNotes.getChild(0); + LIBSBML_CPP_NAMESPACE_QUALIFIER XMLNode addedHTML(addedNotes); + LIBSBML_CPP_NAMESPACE_QUALIFIER XMLNode& addedBody = addedHTML.getChild(1); + LIBSBML_CPP_NAMESPACE_QUALIFIER XMLNode& curBody = curNotes.getChild(0); for (i=0; i < curBody.getNumChildren(); i++) { @@ -1357,7 +1387,7 @@ CaBase::appendNotes(const XMLNode* notes) // adds the given body or other tag (permitted in the body) to the current // body tag - XMLNode& curBody = curNotes.getChild(0); + LIBSBML_CPP_NAMESPACE_QUALIFIER XMLNode& curBody = curNotes.getChild(0); for (i=0; i < addedNotes.getNumChildren(); i++) { @@ -1373,8 +1403,8 @@ CaBase::appendNotes(const XMLNode* notes) { // adds the given html tag to the current any tag permitted in the body. - XMLNode addedHTML(addedNotes); - XMLNode& addedBody = addedHTML.getChild(1); + LIBSBML_CPP_NAMESPACE_QUALIFIER XMLNode addedHTML(addedNotes); + LIBSBML_CPP_NAMESPACE_QUALIFIER XMLNode& addedBody = addedHTML.getChild(1); for (i=0; i < curNotes.getNumChildren(); i++) { @@ -1389,7 +1419,7 @@ CaBase::appendNotes(const XMLNode* notes) { // adds the given body tag to the current any tag permitted in the body. - XMLNode addedBody(addedNotes); + LIBSBML_CPP_NAMESPACE_QUALIFIER XMLNode addedBody(addedNotes); for (i=0; i < curNotes.getNumChildren(); i++) { @@ -1437,16 +1467,16 @@ CaBase::appendNotes(const std::string& notes) return LIBCOMBINE_OPERATION_SUCCESS; } - XMLNode* notes_xmln; + LIBSBML_CPP_NAMESPACE_QUALIFIER XMLNode* notes_xmln; // you might not have a document !! if (getCaOmexManifest() != NULL) { - XMLNamespaces* xmlns = getCaOmexManifest()->getNamespaces(); - notes_xmln = XMLNode::convertStringToXMLNode(notes,xmlns); + LIBSBML_CPP_NAMESPACE_QUALIFIER XMLNamespaces* xmlns = getCaOmexManifest()->getNamespaces(); + notes_xmln = LIBSBML_CPP_NAMESPACE_QUALIFIER XMLNode::convertStringToXMLNode(notes,xmlns); } else { - notes_xmln = XMLNode::convertStringToXMLNode(notes); + notes_xmln = LIBSBML_CPP_NAMESPACE_QUALIFIER XMLNode::convertStringToXMLNode(notes); } if(notes_xmln != NULL) @@ -1570,7 +1600,7 @@ CaBase::getAncestorOfType(int type) const * @param xmlns the namespaces to set */ int -CaBase::setNamespaces(XMLNamespaces* xmlns) +CaBase::setNamespaces(LIBSBML_CPP_NAMESPACE_QUALIFIER XMLNamespaces* xmlns) { if (xmlns == NULL) { @@ -1605,6 +1635,25 @@ CaBase::unsetMetaId () } +/* + * Unsets the id of this OMEX object. + */ +int +CaBase::unsetId () +{ + mId.erase(); + + if (mId.empty()) + { + return LIBCOMBINE_OPERATION_SUCCESS; + } + else + { + return LIBCOMBINE_OPERATION_FAILED; + } +} + + /* * Unsets the notes of this OMEX object. */ @@ -1623,7 +1672,7 @@ CaBase::unsetNotes () int CaBase::unsetAnnotation () { - XMLNode* empty = NULL; + LIBSBML_CPP_NAMESPACE_QUALIFIER XMLNode* empty = NULL; return setAnnotation(empty); } @@ -1634,9 +1683,7 @@ CaBase::unsetAnnotation () unsigned int CaBase::getLevel () const { - if (mCa != NULL) - return mCa->getLevel(); - else if (mCaNamespaces != NULL) + if (mCaNamespaces != NULL) return mCaNamespaces->getLevel(); else return OMEX_DEFAULT_LEVEL; @@ -1649,9 +1696,7 @@ CaBase::getLevel () const unsigned int CaBase::getVersion () const { - if (mCa != NULL) - return mCa->getVersion(); - else if (mCaNamespaces != NULL) + if (mCaNamespaces != NULL) return mCaNamespaces->getVersion(); else return OMEX_DEFAULT_VERSION; @@ -1681,7 +1726,7 @@ bool CaBase::hasValidLevelVersionNamespaceCombination() { int typecode = getTypeCode(); - XMLNamespaces *xmlns = getNamespaces(); + LIBSBML_CPP_NAMESPACE_QUALIFIER XMLNamespaces *xmlns = getNamespaces(); return hasValidLevelVersionNamespaceCombination(typecode, xmlns); } @@ -1779,7 +1824,7 @@ CaBase::matchesCoreCaNamespace(const CaBase * sb) const bool -CaBase::hasValidLevelVersionNamespaceCombination(int typecode, XMLNamespaces *xmlns) +CaBase::hasValidLevelVersionNamespaceCombination(int typecode, LIBSBML_CPP_NAMESPACE_QUALIFIER XMLNamespaces *xmlns) { @@ -1859,7 +1904,7 @@ CaBase::getCaNamespaces() const // initialize OMEX namespace if need be if (mCaNamespaces == NULL) - const_cast(this)->mCaNamespaces = new CaNamespaces(); + const_cast(this)->mCaNamespaces = new CaNamespaces(getLevel(), getVersion()); return mCaNamespaces; } /** @endcond */ @@ -1873,7 +1918,7 @@ char* CaBase::toCa () { ostringstream os; - XMLOutputStream stream(os, "UTF-8", false); + LIBSBML_CPP_NAMESPACE_QUALIFIER XMLOutputStream stream(os, "UTF-8", false); write(stream); @@ -1881,16 +1926,207 @@ CaBase::toCa () } +/** @cond doxygenLibomexInternal */ +int +CaBase::getAttribute(const std::string& attributeName, double& value) const +{ + return LIBCOMBINE_OPERATION_FAILED; +} +/** @endcond */ + + +/** @cond doxygenLibomexInternal */ +int +CaBase::getAttribute(const std::string& attributeName, bool& value) const +{ + return LIBCOMBINE_OPERATION_FAILED; +} +/** @endcond */ + + +/** @cond doxygenLibomexInternal */ +int +CaBase::getAttribute(const std::string& attributeName, int& value) const +{ + return LIBCOMBINE_OPERATION_FAILED; +} +/** @endcond */ + + +/** @cond doxygenLibomexInternal */ +int +CaBase::getAttribute(const std::string& attributeName, unsigned int& value) const +{ + return LIBCOMBINE_OPERATION_FAILED; +} +/** @endcond */ + + +/** @cond doxygenLibomexInternal */ +int +CaBase::getAttribute(const std::string& attributeName, std::string& value) const +{ + if (attributeName == "metaid") + { + value = getMetaId(); + return LIBCOMBINE_OPERATION_SUCCESS; + } + else if (attributeName == "id") + { + value = getId(); + return LIBCOMBINE_OPERATION_SUCCESS; + } + + return LIBCOMBINE_OPERATION_FAILED; +} +/** @endcond */ + + +/** @cond doxygenLibomexInternal */ +bool +CaBase::isSetAttribute(const std::string& attributeName) const +{ + bool value = false; + if (attributeName == "metaid") + { + value = isSetMetaId(); + } + else if (attributeName == "id") + { + value = isSetId(); + } + + return value; +} +/** @endcond */ + + +/** @cond doxygenLibomexInternal */ +int +CaBase::setAttribute(const std::string& attributeName, double value) +{ + return LIBCOMBINE_OPERATION_FAILED; +} +/** @endcond */ + + +/** @cond doxygenLibomexInternal */ +int +CaBase::setAttribute(const std::string& attributeName, bool value) +{ + return LIBCOMBINE_OPERATION_FAILED; +} +/** @endcond */ + + +/** @cond doxygenLibomexInternal */ +int +CaBase::setAttribute(const std::string& attributeName, int value) +{ + return LIBCOMBINE_OPERATION_FAILED; +} +/** @endcond */ + + +/** @cond doxygenLibomexInternal */ +int +CaBase::setAttribute(const std::string& attributeName, unsigned int value) +{ + return LIBCOMBINE_OPERATION_FAILED; +} +/** @endcond */ + + +/** @cond doxygenLibomexInternal */ +int +CaBase::setAttribute(const std::string& attributeName, const std::string& value) +{ + int return_value = LIBCOMBINE_OPERATION_FAILED; + if (attributeName == "metaid") + { + return_value = setMetaId(value); + } + else if (attributeName == "id") + { + return_value = setId(value); + } + + return return_value; +} +/** @endcond */ + + +/** @cond doxygenLibomexInternal */ +int +CaBase::unsetAttribute(const std::string& attributeName) +{ + int value = LIBCOMBINE_OPERATION_FAILED; + if (attributeName == "metaid") + { + value = unsetMetaId(); + } + else if (attributeName == "id") + { + value = unsetId(); + } + + return value; +} +/** @endcond */ + +/** @cond doxygenLibomexInternal */ +CaBase* +CaBase::createChildObject(const std::string& elementName) +{ + return NULL; +} +/** @endcond */ + +/** @cond doxygenLibomexInternal */ +int +CaBase::addChildObject(const std::string& elementName, const CaBase* element) +{ + return LIBCOMBINE_OPERATION_FAILED; +} +/** @endcond */ + +/** @cond doxygenLibomexInternal */ +CaBase* +CaBase::removeChildObject(const std::string& elementName, const std::string& id) +{ + return NULL; +} +/** @endcond */ + +/** @cond doxygenLibomexInternal */ + +unsigned int + CaBase::getNumObjects(const std::string& objectName) +{ + return 0; +} + + /** @endcond */ + + /** @cond doxygenLibomexInternal */ + +CaBase* +CaBase::getObject(const std::string& objectName, unsigned int index) +{ + return NULL; +} + + /** @endcond */ /** @cond doxygenLibomexInternal */ /* * Reads (initializes) this OMEX object by reading from XMLInputStream. */ void -CaBase::read (XMLInputStream& stream) +CaBase::read (LIBSBML_CPP_NAMESPACE_QUALIFIER XMLInputStream& stream) { if ( !stream.peek().isStart() ) return; - const XMLToken element = stream.next(); + const LIBSBML_CPP_NAMESPACE_QUALIFIER XMLToken element = stream.next(); int position = 0; setCaBaseFields( element ); @@ -1904,13 +2140,13 @@ CaBase::read (XMLInputStream& stream) * thus the MathML reader can find out what level/version * of OMEX it is parsing */ - if (element.getName() == "omex") + if (element.getName() == "OmexManifest") { // stream.setCaNamespaces(this->getCaNamespaces()); // need to check that any prefix on the omexns also occurs on element // remembering the horrible situation where the omexns might be declared // with more than one prefix - XMLNamespaces * xmlns = this->getCaNamespaces()->getNamespaces(); + LIBSBML_CPP_NAMESPACE_QUALIFIER XMLNamespaces * xmlns = this->getCaNamespaces()->getNamespaces(); if (xmlns != NULL) { int i = xmlns->getIndexByPrefix(element.getPrefix()); @@ -1937,7 +2173,7 @@ CaBase::read (XMLInputStream& stream) { unsigned int errorId = this->getErrorLog()->getError(n)->getErrorId(); - if ( errorId == CombineCaOmexManifestAllowedCoreAttributes + if ( errorId == CombineOmexManifestAllowedCoreAttributes || errorId == InvalidNamespaceOnCa) { errorLoggedAlready = true; @@ -1968,7 +2204,7 @@ CaBase::read (XMLInputStream& stream) checkDefaultNamespace(mCaNamespaces->getNamespaces(), element.getName()); if (!element.getPrefix().empty()) { - XMLNamespaces * prefixedNS = new XMLNamespaces(); + LIBSBML_CPP_NAMESPACE_QUALIFIER XMLNamespaces * prefixedNS = new LIBSBML_CPP_NAMESPACE_QUALIFIER XMLNamespaces(); prefixedNS->add(element.getURI(), element.getPrefix()); checkDefaultNamespace(prefixedNS, element.getName(), element.getPrefix()); delete prefixedNS; @@ -1989,7 +2225,7 @@ CaBase::read (XMLInputStream& stream) } setElementText(text); - const XMLToken& next = stream.peek(); + const LIBSBML_CPP_NAMESPACE_QUALIFIER XMLToken& next = stream.peek(); // Re-check stream.isGood() because stream.peek() could hit something. if ( !stream.isGood() ) break; @@ -2044,7 +2280,7 @@ CaBase::setElementText(const std::string &text) * Writes (serializes) this OMEX object by writing it to XMLOutputStream. */ void -CaBase::write (XMLOutputStream& stream) const +CaBase::write (LIBSBML_CPP_NAMESPACE_QUALIFIER XMLOutputStream& stream) const { stream.startElement( getElementName(), getPrefix() ); @@ -2065,7 +2301,7 @@ CaBase::write (XMLOutputStream& stream) const * implementation of this method as well. */ void -CaBase::writeElements (XMLOutputStream& stream) const +CaBase::writeElements (LIBSBML_CPP_NAMESPACE_QUALIFIER XMLOutputStream& stream) const { if ( mNotes != NULL ) stream << *mNotes; @@ -2083,7 +2319,7 @@ CaBase::writeElements (XMLOutputStream& stream) const * XMLInputStream or @c NULL if the token was not recognized. */ CaBase* -CaBase::createObject (XMLInputStream& stream) +CaBase::createObject (LIBSBML_CPP_NAMESPACE_QUALIFIER XMLInputStream& stream) { return NULL; } @@ -2100,7 +2336,7 @@ CaBase::createObject (XMLInputStream& stream) * @return true if the subclass read from the stream, false otherwise. */ bool -CaBase::readOtherXML (XMLInputStream& stream) +CaBase::readOtherXML (LIBSBML_CPP_NAMESPACE_QUALIFIER XMLInputStream& stream) { bool read = false; return read; @@ -2113,7 +2349,7 @@ CaBase::readOtherXML (XMLInputStream& stream) * @return true if read an element from the stream */ bool -CaBase::readAnnotation (XMLInputStream& stream) +CaBase::readAnnotation (LIBSBML_CPP_NAMESPACE_QUALIFIER XMLInputStream& stream) { const string& name = stream.peek().getName(); @@ -2130,7 +2366,7 @@ CaBase::readAnnotation (XMLInputStream& stream) } delete mAnnotation; - mAnnotation = new XMLNode(stream); + mAnnotation = new LIBSBML_CPP_NAMESPACE_QUALIFIER XMLNode(stream); checkAnnotation(); return true; } @@ -2145,7 +2381,7 @@ CaBase::readAnnotation (XMLInputStream& stream) * @return true if read a element from the stream */ bool -CaBase::readNotes (XMLInputStream& stream) +CaBase::readNotes (LIBSBML_CPP_NAMESPACE_QUALIFIER XMLInputStream& stream) { const string& name = stream.peek().getName(); @@ -2161,13 +2397,13 @@ CaBase::readNotes (XMLInputStream& stream) } delete mNotes; - mNotes = new XMLNode(stream); + mNotes = new LIBSBML_CPP_NAMESPACE_QUALIFIER XMLNode(stream); // // checks if the given default namespace (if any) is a valid // OMEX namespace // - const XMLNamespaces &xmlns = mNotes->getNamespaces(); + const LIBSBML_CPP_NAMESPACE_QUALIFIER XMLNamespaces &xmlns = mNotes->getNamespaces(); checkDefaultNamespace(&xmlns,"notes"); return true; @@ -2336,10 +2572,10 @@ CaBase::addExpectedAttributes(ExpectedAttributes& attributes) * parents implementation of this method as well. */ void -CaBase::readAttributes (const XMLAttributes& attributes, - const ExpectedAttributes& expectedAttributes) +CaBase::readAttributes (const LIBSBML_CPP_NAMESPACE_QUALIFIER XMLAttributes& attributes, + const LIBSBML_CPP_NAMESPACE_QUALIFIER ExpectedAttributes& expectedAttributes) { - const_cast(attributes).setErrorLog(getErrorLog()); + const_cast(attributes).setErrorLog(getErrorLog()); const unsigned int level = getLevel (); const unsigned int version = getVersion(); @@ -2371,7 +2607,7 @@ CaBase::readAttributes (const XMLAttributes& attributes, // if we happen to be on the omex element (document) then // getPrefix() and mURI have not been set and just return defaults // thus a prefix does not appear to come from the right place !!! - if (!prefix.empty() && getElementName() == "omex") + if (!prefix.empty() && getElementName() == "OmexManifest") { if (!expectedAttributes.hasAttribute(name)) { @@ -2412,7 +2648,7 @@ CaBase::getPrefix() const { std::string prefix = ""; - const XMLNamespaces *xmlns = getNamespaces(); + const LIBSBML_CPP_NAMESPACE_QUALIFIER XMLNamespaces *xmlns = getNamespaces(); string uri = getURI(); if(xmlns && mCa) { @@ -2431,7 +2667,7 @@ CaBase::getCaPrefix() const { std::string prefix = ""; - const XMLNamespaces *xmlns = getNamespaces(); + const LIBSBML_CPP_NAMESPACE_QUALIFIER XMLNamespaces *xmlns = getNamespaces(); if (xmlns == NULL) return getPrefix(); @@ -2476,7 +2712,7 @@ CaBase::getRootElement() * of this method as well. */ void -CaBase::writeAttributes (XMLOutputStream& stream) const +CaBase::writeAttributes (LIBSBML_CPP_NAMESPACE_QUALIFIER XMLOutputStream& stream) const { string omexPrefix = getCaPrefix(); if ( !mMetaId.empty() ) @@ -2495,7 +2731,7 @@ CaBase::writeAttributes (XMLOutputStream& stream) const * */ void -CaBase::writeXMLNS (XMLOutputStream& stream) const +CaBase::writeXMLNS (LIBSBML_CPP_NAMESPACE_QUALIFIER XMLOutputStream& stream) const { // do nothing. } @@ -2553,7 +2789,7 @@ int CaBase::removeFromParentAndDelete() /** @cond doxygenLibomexInternal */ const std::string -CaBase::checkMathMLNamespace(const XMLToken elem) +CaBase::checkMathMLNamespace(const LIBSBML_CPP_NAMESPACE_QUALIFIER XMLToken elem) { std::string prefix = ""; unsigned int match = 0; @@ -2599,7 +2835,7 @@ CaBase::checkMathMLNamespace(const XMLToken elem) /** @cond doxygenLibomexInternal */ void -CaBase::checkDefaultNamespace(const XMLNamespaces* xmlns, +CaBase::checkDefaultNamespace(const LIBSBML_CPP_NAMESPACE_QUALIFIER XMLNamespaces* xmlns, const std::string& elementName, const std::string& prefix) { @@ -2649,12 +2885,12 @@ CaBase::checkAnnotation() // checks if the given default namespace (if any) is a valid // OMEX namespace // - const XMLNamespaces &xmlns = mAnnotation->getNamespaces(); + const LIBSBML_CPP_NAMESPACE_QUALIFIER XMLNamespaces &xmlns = mAnnotation->getNamespaces(); checkDefaultNamespace(&xmlns,"annotation"); while (nNodes < mAnnotation->getNumChildren()) { - XMLNode topLevel = mAnnotation->getChild(nNodes); + LIBSBML_CPP_NAMESPACE_QUALIFIER XMLNode topLevel = mAnnotation->getChild(nNodes); // the top level must be an element (so it should be a start) if (topLevel.isStart() == false) @@ -2750,7 +2986,7 @@ CaBase::checkAnnotation() * an omex document, an error is logged. */ void -CaBase::checkXHTML(const XMLNode * xhtml) +CaBase::checkXHTML(const LIBSBML_CPP_NAMESPACE_QUALIFIER XMLNode * xhtml) { if (xhtml == NULL) return; @@ -2766,7 +3002,7 @@ CaBase::checkXHTML(const XMLNode * xhtml) } else // We shouldn't ever get to this point. { - logError(CaUnknownError); + logError(CaUnknown); return; } @@ -2789,7 +3025,7 @@ CaBase::checkXHTML(const XMLNode * xhtml) } } - XMLNamespaces* toplevelNS = (mCa) ? mCa->getNamespaces() : NULL; + LIBSBML_CPP_NAMESPACE_QUALIFIER XMLNamespaces* toplevelNS = (mCa) ? mCa->getNamespaces() : NULL; /* * namespace declaration is variable @@ -2897,14 +3133,14 @@ CaBase::checkCompatibility(const CaBase * object) const * roundtripping) declared on this OMEX (XML) element. */ void -CaBase::setCaBaseFields (const XMLToken& element) +CaBase::setCaBaseFields (const LIBSBML_CPP_NAMESPACE_QUALIFIER XMLToken& element) { mLine = element.getLine (); mColumn = element.getColumn(); if (element.getNamespaces().getLength() > 0) { - XMLNamespaces tmpxmlns(element.getNamespaces()); + LIBSBML_CPP_NAMESPACE_QUALIFIER XMLNamespaces tmpxmlns(element.getNamespaces()); setNamespaces(&tmpxmlns); } else @@ -2937,6 +3173,15 @@ CaBase::getElementNamespace() const #endif /* __cplusplus */ + +LIBCOMBINE_EXTERN +int +CaBase_getTypeCode (const CaBase_t *sb) +{ + return (sb != NULL) ? sb->getTypeCode() : OMEX_UNKNOWN; +} + + LIBCOMBINE_EXTERN const char * CaBase_getMetaId (CaBase_t *sb) diff --git a/src/omex/CaBase.h b/src/omex/CaBase.h index 57f2e08..376755c 100644 --- a/src/omex/CaBase.h +++ b/src/omex/CaBase.h @@ -7,7 +7,11 @@ * This file is part of libSBML. Please visit http://sbml.org for more * information about SBML, and the latest version of libSBML. * - * Copyright (C) 2013-2016 jointly by the following organizations: + * Copyright (C) 2019 jointly by the following organizations: + * 1. California Institute of Technology, Pasadena, CA, USA + * 2. University of Heidelberg, Heidelberg, Germany + * + * Copyright (C) 2013-2018 jointly by the following organizations: * 1. California Institute of Technology, Pasadena, CA, USA * 2. EMBL European Bioinformatics Institute (EMBL-EBI), Hinxton, UK * 3. University of Heidelberg, Heidelberg, Germany @@ -30,7 +34,7 @@ * available online as http://sbml.org/software/libsbml/license.html * ------------------------------------------------------------------------ --> * - * @class + * @class CaBase * @sbmlbrief{} TODO:Definition of the CaBase class. */ @@ -41,6 +45,7 @@ #include #include +#include #include #include #include @@ -58,6 +63,7 @@ #include #include +#include LIBSBML_CPP_NAMESPACE_BEGIN @@ -75,7 +81,6 @@ LIBSBML_CPP_NAMESPACE_END LIBCOMBINE_CPP_NAMESPACE_BEGIN -class CaVisitor; class CaOmexManifest; @@ -239,7 +244,7 @@ class LIBCOMBINE_EXTERN CaBase * @see unsetNotes() * @see SyntaxChecker::hasExpectedXHTMLSyntax(@if java XMLNode@endif) */ - XMLNode* getNotes(); + LIBSBML_CPP_NAMESPACE_QUALIFIER XMLNode* getNotes(); /** @@ -265,7 +270,7 @@ class LIBCOMBINE_EXTERN CaBase * @see unsetNotes() * @see SyntaxChecker::hasExpectedXHTMLSyntax(@if java XMLNode@endif) */ - const XMLNode* getNotes() const; + const LIBSBML_CPP_NAMESPACE_QUALIFIER XMLNode* getNotes() const; /** @@ -336,7 +341,7 @@ class LIBCOMBINE_EXTERN CaBase * @see appendAnnotation(const std::string& annotation) * @see unsetAnnotation() */ - XMLNode* getAnnotation (); + LIBSBML_CPP_NAMESPACE_QUALIFIER XMLNode* getAnnotation (); /** @@ -359,7 +364,7 @@ class LIBCOMBINE_EXTERN CaBase * @see appendAnnotation(const std::string& annotation) * @see unsetAnnotation() */ - const XMLNode* getAnnotation () const; + const LIBSBML_CPP_NAMESPACE_QUALIFIER XMLNode* getAnnotation () const; /** @@ -416,7 +421,7 @@ class LIBCOMBINE_EXTERN CaBase * @see getLevel() * @see getVersion() */ - virtual const XMLNamespaces* getNamespaces() const ; + virtual const LIBSBML_CPP_NAMESPACE_QUALIFIER XMLNamespaces* getNamespaces() const ; /** @@ -433,7 +438,7 @@ class LIBCOMBINE_EXTERN CaBase * @see getLevel() * @see getVersion() */ - virtual XMLNamespaces* getNamespaces(); + virtual LIBSBML_CPP_NAMESPACE_QUALIFIER XMLNamespaces* getNamespaces(); /** @@ -738,6 +743,14 @@ class LIBCOMBINE_EXTERN CaBase int setMetaId (const std::string& metaid); + /** + * Sets the value of the "id" attribute of this OMEX object. + * + * @copydetails doc_set_id + */ + virtual int setId(const std::string& sid); + + /** * Sets the value of the "annotation" subelement of this OMEX object. * @@ -781,7 +794,7 @@ class LIBCOMBINE_EXTERN CaBase * @see appendAnnotation(const std::string& annotation) * @see unsetAnnotation() */ - virtual int setAnnotation (XMLNode* annotation); + virtual int setAnnotation (LIBSBML_CPP_NAMESPACE_QUALIFIER XMLNode* annotation); /** @@ -869,7 +882,7 @@ class LIBCOMBINE_EXTERN CaBase * @see appendAnnotation(const std::string& annotation) * @see unsetAnnotation() */ - virtual int appendAnnotation (const XMLNode* annotation); + virtual int appendAnnotation (const LIBSBML_CPP_NAMESPACE_QUALIFIER XMLNode* annotation); /** @@ -970,7 +983,7 @@ class LIBCOMBINE_EXTERN CaBase * @see removeTopLevelAnnotationElement(const std::string elementName, const std::string elementURI) * @see replaceTopLevelAnnotationElement(const std::string&) */ - int replaceTopLevelAnnotationElement(const XMLNode* annotation); + int replaceTopLevelAnnotationElement(const LIBSBML_CPP_NAMESPACE_QUALIFIER XMLNode* annotation); /** @@ -1044,7 +1057,7 @@ class LIBCOMBINE_EXTERN CaBase * @see unsetNotes() * @see SyntaxChecker::hasExpectedXHTMLSyntax(@if java XMLNode@endif) */ - int setNotes(const XMLNode* notes); + int setNotes(const LIBSBML_CPP_NAMESPACE_QUALIFIER XMLNode* notes); /** @@ -1141,7 +1154,7 @@ class LIBCOMBINE_EXTERN CaBase * @see unsetNotes() * @see SyntaxChecker::hasExpectedXHTMLSyntax(@if java XMLNode@endif) */ - int appendNotes(const XMLNode* notes); + int appendNotes(const LIBSBML_CPP_NAMESPACE_QUALIFIER XMLNode* notes); /** @@ -1252,7 +1265,7 @@ class LIBCOMBINE_EXTERN CaBase * @copydetails doc_returns_success_code * @li @omexconstant{LIBCOMBINE_OPERATION_SUCCESS, OperationReturnValues_t} */ - int setNamespaces(XMLNamespaces* xmlns); + int setNamespaces(LIBSBML_CPP_NAMESPACE_QUALIFIER XMLNamespaces* xmlns); /** @@ -1262,6 +1275,14 @@ class LIBCOMBINE_EXTERN CaBase int unsetMetaId (); + /** + * Unsets the value of the "id" attribute of this OMEX object. + * + * @copydetails doc_unset_id + */ + virtual int unsetId (); + + /** * Unsets the value of the "notes" subelement of this OMEX object. * @@ -1414,12 +1435,136 @@ class LIBCOMBINE_EXTERN CaBase // ------------------------------------------------------------------ + #ifndef SWIG + /** @cond doxygenLibomexInternal */ + + + virtual int getAttribute(const std::string& attributeName, double& value) const; + + /** @endcond */ + + /** @cond doxygenLibomexInternal */ + + virtual int getAttribute(const std::string& attributeName, bool& value) const; + + /** @endcond */ + + /** @cond doxygenLibomexInternal */ + + virtual int getAttribute(const std::string& attributeName, int& value) const; + + /** @endcond */ + + /** @cond doxygenLibomexInternal */ + + virtual int getAttribute(const std::string& attributeName, unsigned int& value) const; + + /** @endcond */ + + /** @cond doxygenLibomexInternal */ + + virtual int getAttribute(const std::string& attributeName, std::string& value) const; + + /** @endcond */ + +// virtual int getAttribute(const std::string& attributeName, const char * value) const; + + + virtual bool isSetAttribute(const std::string& attributeName) const; + + /** @endcond */ + + /** @cond doxygenLibomexInternal */ + + virtual int setAttribute(const std::string& attributeName, double value); + + /** @endcond */ + + /** @cond doxygenLibomexInternal */ + + virtual int setAttribute(const std::string& attributeName, bool value); + + /** @endcond */ + + /** @cond doxygenLibomexInternal */ + + virtual int setAttribute(const std::string& attributeName, int value); + + /** @endcond */ + + /** @cond doxygenLibomexInternal */ + + virtual int setAttribute(const std::string& attributeName, unsigned int value); + + /** @endcond */ + + /** @cond doxygenLibomexInternal */ + + virtual int setAttribute(const std::string& attributeName, const std::string& value); + + /** @endcond */ + + /** @cond doxygenLibomexInternal */ + +// virtual int setAttribute(const std::string& attributeName, const char* value); + + /** @endcond */ + + /** @cond doxygenLibomexInternal */ + + virtual int unsetAttribute(const std::string& attributeName); + + /** @endcond */ + + /** @cond doxygenLibomexInternal */ + + virtual CaBase* createChildObject(const std::string& elementName); + + /** @endcond */ + + /** @cond doxygenLibomexInternal */ + + virtual int addChildObject(const std::string& elementName, const CaBase* element); + + /** @endcond */ + + /** @cond doxygenLibomexInternal */ + + virtual CaBase* removeChildObject(const std::string& elementName, const std::string& id); + + /** @endcond */ + + /** @cond doxygenLibomexInternal */ + + virtual unsigned int getNumObjects(const std::string& objectName); + + /** @endcond */ + + /** @cond doxygenLibomexInternal */ + + virtual CaBase* getObject(const std::string& objectName, unsigned int index); + + /** @endcond */ + + /** @cond doxygenLibomexInternal */ + + template T getAttribute(const std::string& attributeName) + { + T result; + getAttribute(attributeName, result); + return result; + } + /** @endcond */ + +#endif /* SWIG */ + + /** @cond doxygenLibomexInternal */ /** * Reads (initializes) this OMEX object by reading from XMLInputStream. */ - void read (XMLInputStream& stream); + void read (LIBSBML_CPP_NAMESPACE_QUALIFIER XMLInputStream& stream); /** @endcond */ @@ -1427,7 +1572,7 @@ class LIBCOMBINE_EXTERN CaBase /** * Writes (serializes) this OMEX object by writing it to XMLOutputStream. */ - virtual void write (XMLOutputStream& stream) const; + virtual void write (LIBSBML_CPP_NAMESPACE_QUALIFIER XMLOutputStream& stream) const; /** @endcond */ @@ -1443,7 +1588,7 @@ class LIBCOMBINE_EXTERN CaBase * ... * @endif@~ */ - virtual void writeElements (XMLOutputStream& stream) const; + virtual void writeElements (LIBSBML_CPP_NAMESPACE_QUALIFIER XMLOutputStream& stream) const; /** @endcond */ @@ -1661,7 +1806,7 @@ class LIBCOMBINE_EXTERN CaBase * @return the OMEX object corresponding to next XMLToken in the * XMLInputStream or @c NULL if the token was not recognized. */ - virtual CaBase* createObject (XMLInputStream& stream); + virtual CaBase* createObject (LIBSBML_CPP_NAMESPACE_QUALIFIER XMLInputStream& stream); /** @@ -1678,7 +1823,7 @@ class LIBCOMBINE_EXTERN CaBase * @return @c true if the level, version and namespace values of this * OMEX object correspond to a valid set of values, @c false otherwise. */ - bool hasValidLevelVersionNamespaceCombination(int typecode, XMLNamespaces *xmlns); + bool hasValidLevelVersionNamespaceCombination(int typecode, LIBSBML_CPP_NAMESPACE_QUALIFIER XMLNamespaces *xmlns); /** @@ -1687,7 +1832,7 @@ class LIBCOMBINE_EXTERN CaBase * * @return true if the subclass read from the stream, false otherwise. */ - virtual bool readOtherXML (XMLInputStream& stream); + virtual bool readOtherXML (LIBSBML_CPP_NAMESPACE_QUALIFIER XMLInputStream& stream); /** @@ -1757,8 +1902,8 @@ class LIBCOMBINE_EXTERN CaBase * XMLAttributes set into their specific fields. Be sure to call your * parents implementation of this method as well. */ - virtual void readAttributes (const XMLAttributes& attributes, - const ExpectedAttributes& expectedAttributes); + virtual void readAttributes (const LIBSBML_CPP_NAMESPACE_QUALIFIER XMLAttributes& attributes, + const LIBSBML_CPP_NAMESPACE_QUALIFIER ExpectedAttributes& expectedAttributes); /** @@ -1775,7 +1920,7 @@ class LIBCOMBINE_EXTERN CaBase * Be sure to implement wirteXMLNS() function to write xmlns attributes. * */ - virtual void writeAttributes (XMLOutputStream& stream) const; + virtual void writeAttributes (LIBSBML_CPP_NAMESPACE_QUALIFIER XMLOutputStream& stream) const; /** @@ -1784,7 +1929,7 @@ class LIBCOMBINE_EXTERN CaBase * (if any) to the XMLOutputStream. * */ - virtual void writeXMLNS (XMLOutputStream& stream) const; + virtual void writeXMLNS (LIBSBML_CPP_NAMESPACE_QUALIFIER XMLOutputStream& stream) const; /** @@ -1798,7 +1943,7 @@ class LIBCOMBINE_EXTERN CaBase * Checks that the given default namespace in the given element is valid. * If the given default namespace is not valid, an error is logged. */ - void checkDefaultNamespace(const XMLNamespaces* xmlns, + void checkDefaultNamespace(const LIBSBML_CPP_NAMESPACE_QUALIFIER XMLNamespaces* xmlns, const std::string& elementName, const std::string& prefix = ""); /** @@ -1813,13 +1958,13 @@ class LIBCOMBINE_EXTERN CaBase * If the xhtml does not conform to the specification of valid xhtml within * an omex document, an error is logged. */ - void checkXHTML(const XMLNode *); + void checkXHTML(const LIBSBML_CPP_NAMESPACE_QUALIFIER XMLNode *); /** * Checks that the math ml ns has been declared */ - const std::string checkMathMLNamespace(const XMLToken elem); + const std::string checkMathMLNamespace(const LIBSBML_CPP_NAMESPACE_QUALIFIER XMLToken elem); /** * Sets the XML namespace to which this element belongs to. @@ -1872,8 +2017,9 @@ class LIBCOMBINE_EXTERN CaBase std::string mMetaId; - XMLNode* mNotes; - XMLNode* mAnnotation; + std::string mId; + LIBSBML_CPP_NAMESPACE_QUALIFIER XMLNode* mNotes; + LIBSBML_CPP_NAMESPACE_QUALIFIER XMLNode* mAnnotation; CaOmexManifest* mCa; CaNamespaces* mCaNamespaces; void* mUserData; @@ -1914,7 +2060,7 @@ class LIBCOMBINE_EXTERN CaBase * Stores the location (line and column) and any XML namespaces (for * roundtripping) declared on this OMEX (XML) element. */ - void setCaBaseFields (const XMLToken& element); + void setCaBaseFields (const LIBSBML_CPP_NAMESPACE_QUALIFIER XMLToken& element); /** @@ -1922,7 +2068,7 @@ class LIBCOMBINE_EXTERN CaBase * * @return true if read an element from the stream */ - bool readAnnotation (XMLInputStream& stream); + bool readAnnotation (LIBSBML_CPP_NAMESPACE_QUALIFIER XMLInputStream& stream); /** @@ -1930,7 +2076,7 @@ class LIBCOMBINE_EXTERN CaBase * * @return true if read a element from the stream */ - bool readNotes (XMLInputStream& stream); + bool readNotes (LIBSBML_CPP_NAMESPACE_QUALIFIER XMLInputStream& stream); /** @endcond */ diff --git a/src/omex/CaContent.cpp b/src/omex/CaContent.cpp index 94b5310..27c196d 100644 --- a/src/omex/CaContent.cpp +++ b/src/omex/CaContent.cpp @@ -7,7 +7,11 @@ * This file is part of libSBML. Please visit http://sbml.org for more * information about SBML, and the latest version of libSBML. * - * Copyright (C) 2013-2016 jointly by the following organizations: + * Copyright (C) 2019 jointly by the following organizations: + * 1. California Institute of Technology, Pasadena, CA, USA + * 2. University of Heidelberg, Heidelberg, Germany + * + * Copyright (C) 2013-2018 jointly by the following organizations: * 1. California Institute of Technology, Pasadena, CA, USA * 2. EMBL European Bioinformatics Institute (EMBL-EBI), Hinxton, UK * 3. University of Heidelberg, Heidelberg, Germany @@ -36,6 +40,7 @@ #include + using namespace std; @@ -57,7 +62,9 @@ CaContent::CaContent() , mFormat ("") , mMaster (false) , mIsSetMaster (false) + , mCrossRefs () { + connectToChild(); } @@ -70,8 +77,10 @@ CaContent::CaContent(CaNamespaces *omexns) , mFormat ("") , mMaster (false) , mIsSetMaster (false) + , mCrossRefs (omexns) { setElementNamespace(omexns->getURI()); + connectToChild(); } @@ -84,7 +93,9 @@ CaContent::CaContent(const CaContent& orig) , mFormat ( orig.mFormat ) , mMaster ( orig.mMaster ) , mIsSetMaster ( orig.mIsSetMaster ) + , mCrossRefs ( orig.mCrossRefs ) { + connectToChild(); } @@ -101,6 +112,8 @@ CaContent::operator=(const CaContent& rhs) mFormat = rhs.mFormat; mMaster = rhs.mMaster; mIsSetMaster = rhs.mIsSetMaster; + mCrossRefs = rhs.mCrossRefs; + connectToChild(); } return *this; @@ -283,6 +296,126 @@ CaContent::unsetMaster() } +/* + * Returns the CaListOfCrossRefs from this CaContent. + */ +const CaListOfCrossRefs* +CaContent::getListOfCrossRefs() const +{ + return &mCrossRefs; +} + + +/* + * Returns the CaListOfCrossRefs from this CaContent. + */ +CaListOfCrossRefs* +CaContent::getListOfCrossRefs() +{ + return &mCrossRefs; +} + + +/* + * Get a CaCrossRef from the CaContent. + */ +CaCrossRef* +CaContent::getCrossRef(unsigned int n) +{ + return mCrossRefs.get(n); +} + + +/* + * Get a CaCrossRef from the CaContent. + */ +const CaCrossRef* +CaContent::getCrossRef(unsigned int n) const +{ + return mCrossRefs.get(n); +} + + +/* + * Adds a copy of the given CaCrossRef to this CaContent. + */ +int +CaContent::addCrossRef(const CaCrossRef* ccr) +{ + if (ccr == NULL) + { + return LIBCOMBINE_OPERATION_FAILED; + } + else if (ccr->hasRequiredAttributes() == false) + { + return LIBCOMBINE_INVALID_OBJECT; + } + else if (getLevel() != ccr->getLevel()) + { + return LIBCOMBINE_LEVEL_MISMATCH; + } + else if (getVersion() != ccr->getVersion()) + { + return LIBCOMBINE_VERSION_MISMATCH; + } + else if (matchesRequiredCaNamespacesForAddition(static_cast(ccr)) == false) + { + return LIBCOMBINE_NAMESPACES_MISMATCH; + } + else + { + return mCrossRefs.append(ccr); + } +} + + +/* + * Get the number of CaCrossRef objects in this CaContent. + */ +unsigned int +CaContent::getNumCrossRefs() const +{ + return mCrossRefs.size(); +} + + +/* + * Creates a new CaCrossRef object, adds it to this CaContent object and + * returns the CaCrossRef object created. + */ +CaCrossRef* +CaContent::createCrossRef() +{ + CaCrossRef* ccr = NULL; + + try + { + ccr = new CaCrossRef(getCaNamespaces()); + } + catch (...) + { + } + + if (ccr != NULL) + { + mCrossRefs.appendAndOwn(ccr); + } + + return ccr; +} + + +/* + * Removes the nth CaCrossRef from this CaContent and returns a pointer to it. + */ +CaCrossRef* +CaContent::removeCrossRef(unsigned int n) +{ + return mCrossRefs.remove(n); +} + + /* * Returns the XML element name of this CaContent object. */ @@ -338,6 +471,11 @@ CaContent::writeElements(LIBSBML_CPP_NAMESPACE_QUALIFIER XMLOutputStream& stream) const { CaBase::writeElements(stream); + + for (unsigned int i = 0; i < getNumCrossRefs(); i++) + { + getCrossRef(i)->write(stream); + } } /** @endcond */ @@ -368,6 +506,467 @@ void CaContent::setCaOmexManifest(CaOmexManifest* d) { CaBase::setCaOmexManifest(d); + + mCrossRefs.setCaOmexManifest(d); +} + +/** @endcond */ + + + +/** @cond doxygenlibCombineInternal */ + +/* + * Connects to child elements + */ +void +CaContent::connectToChild() +{ + CaBase::connectToChild(); + + mCrossRefs.connectToParent(this); +} + +/** @endcond */ + + + +/** @cond doxygenlibCombineInternal */ + +/* + * Gets the value of the "attributeName" attribute of this CaContent. + */ +int +CaContent::getAttribute(const std::string& attributeName, bool& value) const +{ + int return_value = CaBase::getAttribute(attributeName, value); + + if (return_value == LIBCOMBINE_OPERATION_SUCCESS) + { + return return_value; + } + + if (attributeName == "master") + { + value = getMaster(); + return_value = LIBCOMBINE_OPERATION_SUCCESS; + } + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenlibCombineInternal */ + +/* + * Gets the value of the "attributeName" attribute of this CaContent. + */ +int +CaContent::getAttribute(const std::string& attributeName, int& value) const +{ + int return_value = CaBase::getAttribute(attributeName, value); + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenlibCombineInternal */ + +/* + * Gets the value of the "attributeName" attribute of this CaContent. + */ +int +CaContent::getAttribute(const std::string& attributeName, double& value) const +{ + int return_value = CaBase::getAttribute(attributeName, value); + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenlibCombineInternal */ + +/* + * Gets the value of the "attributeName" attribute of this CaContent. + */ +int +CaContent::getAttribute(const std::string& attributeName, + unsigned int& value) const +{ + int return_value = CaBase::getAttribute(attributeName, value); + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenlibCombineInternal */ + +/* + * Gets the value of the "attributeName" attribute of this CaContent. + */ +int +CaContent::getAttribute(const std::string& attributeName, + std::string& value) const +{ + int return_value = CaBase::getAttribute(attributeName, value); + + if (return_value == LIBCOMBINE_OPERATION_SUCCESS) + { + return return_value; + } + + if (attributeName == "location") + { + value = getLocation(); + return_value = LIBCOMBINE_OPERATION_SUCCESS; + } + else if (attributeName == "format") + { + value = getFormat(); + return_value = LIBCOMBINE_OPERATION_SUCCESS; + } + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenlibCombineInternal */ + +/* + * Predicate returning @c true if this CaContent's attribute "attributeName" is + * set. + */ +bool +CaContent::isSetAttribute(const std::string& attributeName) const +{ + bool value = CaBase::isSetAttribute(attributeName); + + if (attributeName == "location") + { + value = isSetLocation(); + } + else if (attributeName == "format") + { + value = isSetFormat(); + } + else if (attributeName == "master") + { + value = isSetMaster(); + } + + return value; +} + +/** @endcond */ + + + +/** @cond doxygenlibCombineInternal */ + +/* + * Sets the value of the "attributeName" attribute of this CaContent. + */ +int +CaContent::setAttribute(const std::string& attributeName, bool value) +{ + int return_value = CaBase::setAttribute(attributeName, value); + + if (attributeName == "master") + { + return_value = setMaster(value); + } + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenlibCombineInternal */ + +/* + * Sets the value of the "attributeName" attribute of this CaContent. + */ +int +CaContent::setAttribute(const std::string& attributeName, int value) +{ + int return_value = CaBase::setAttribute(attributeName, value); + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenlibCombineInternal */ + +/* + * Sets the value of the "attributeName" attribute of this CaContent. + */ +int +CaContent::setAttribute(const std::string& attributeName, double value) +{ + int return_value = CaBase::setAttribute(attributeName, value); + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenlibCombineInternal */ + +/* + * Sets the value of the "attributeName" attribute of this CaContent. + */ +int +CaContent::setAttribute(const std::string& attributeName, unsigned int value) +{ + int return_value = CaBase::setAttribute(attributeName, value); + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenlibCombineInternal */ + +/* + * Sets the value of the "attributeName" attribute of this CaContent. + */ +int +CaContent::setAttribute(const std::string& attributeName, + const std::string& value) +{ + int return_value = CaBase::setAttribute(attributeName, value); + + if (attributeName == "location") + { + return_value = setLocation(value); + } + else if (attributeName == "format") + { + return_value = setFormat(value); + } + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenlibCombineInternal */ + +/* + * Unsets the value of the "attributeName" attribute of this CaContent. + */ +int +CaContent::unsetAttribute(const std::string& attributeName) +{ + int value = CaBase::unsetAttribute(attributeName); + + if (attributeName == "location") + { + value = unsetLocation(); + } + else if (attributeName == "format") + { + value = unsetFormat(); + } + else if (attributeName == "master") + { + value = unsetMaster(); + } + + return value; +} + +/** @endcond */ + + + +/** @cond doxygenlibCombineInternal */ + +/* + * Creates and returns an new "elementName" object in this CaContent. + */ +CaBase* +CaContent::createChildObject(const std::string& elementName) +{ + CaBase* obj = NULL; + + if (elementName == "crossRef") + { + return createCrossRef(); + } + + return obj; +} + +/** @endcond */ + + + +/** @cond doxygenlibCombineInternal */ + +/* + * Adds a new "elementName" object to this CaContent. + */ +int +CaContent::addChildObject(const std::string& elementName, + const CaBase* element) +{ + if (elementName == "crossRef" && element->getTypeCode() == + LIB_COMBINE_CROSSREF) + { + return addCrossRef((const CaCrossRef*)(element)); + } + + return LIBSBML_OPERATION_FAILED; +} + +/** @endcond */ + + + +/** @cond doxygenlibCombineInternal */ + +/* + * Removes and returns the new "elementName" object with the given id in this + * CaContent. + */ +CaBase* +CaContent::removeChildObject(const std::string& elementName, + const std::string& id) +{ + if (elementName == "crossRef") + { + for (unsigned int i = 0; i < getNumCrossRefs(); i++) + { + if (getCrossRef(i)->getId() == id) + { + return removeCrossRef(i); + } + } + } + + return NULL; +} + +/** @endcond */ + + + +/** @cond doxygenlibCombineInternal */ + +/* + * Returns the number of "elementName" in this CaContent. + */ +unsigned int +CaContent::getNumObjects(const std::string& elementName) +{ + unsigned int n = 0; + + if (elementName == "crossRef") + { + return getNumCrossRefs(); + } + + return n; +} + +/** @endcond */ + + + +/** @cond doxygenlibCombineInternal */ + +/* + * Returns the nth object of "objectName" in this CaContent. + */ +CaBase* +CaContent::getObject(const std::string& elementName, unsigned int index) +{ + CaBase* obj = NULL; + + if (elementName == "crossRef") + { + return getCrossRef(index); + } + + return obj; +} + +/** @endcond */ + + +/* + * Returns the first child element that has the given @p id in the model-wide + * SId namespace, or @c NULL if no such object is found. + */ +CaBase* +CaContent::getElementBySId(const std::string& id) +{ + if (id.empty()) + { + return NULL; + } + + CaBase* obj = NULL; + + obj = mCrossRefs.getElementBySId(id); + + if (obj != NULL) + { + return obj; + } + + return obj; +} + + + +/** @cond doxygenlibCombineInternal */ + +/* + * Creates a new object from the next XMLToken on the XMLInputStream + */ +CaBase* +CaContent::createObject(LIBSBML_CPP_NAMESPACE_QUALIFIER XMLInputStream& stream) +{ + CaBase* obj = NULL; + + const std::string& name = stream.peek().getName(); + + if (name == "crossRef") + { + obj = mCrossRefs.createObject(stream); + } + + connectToChild(); + + return obj; } /** @endcond */ @@ -414,7 +1013,8 @@ CaContent::readAttributes( bool assigned = false; CaErrorLog* log = getErrorLog(); - if (static_cast(getParentCaObject())->size() < 2) + if (log && getParentCaObject() && + static_cast(getParentCaObject())->size() < 2) { numErrs = log->getNumErrors(); for (int n = numErrs-1; n >= 0; n--) @@ -423,23 +1023,26 @@ CaContent::readAttributes( { const std::string details = log->getError(n)->getMessage(); log->remove(CaUnknownCoreAttribute); - log->logError(CombineCaOmexManifestLOContentsAllowedCoreAttributes, - level, version, details); + log->logError(CaUnknown, level, version, details); } } } CaBase::readAttributes(attributes, expectedAttributes); - numErrs = log->getNumErrors(); - for (int n = numErrs-1; n >= 0; n--) + if (log) { - if (log->getError(n)->getErrorId() == CaUnknownCoreAttribute) + numErrs = log->getNumErrors(); + + for (int n = numErrs-1; n >= 0; n--) { - const std::string details = log->getError(n)->getMessage(); - log->remove(CaUnknownCoreAttribute); - log->logError(CombineCaContentAllowedAttributes, level, version, - details); + if (log->getError(n)->getErrorId() == CaUnknownCoreAttribute) + { + const std::string details = log->getError(n)->getMessage(); + log->remove(CaUnknownCoreAttribute); + log->logError(CombineContentAllowedAttributes, level, version, details, + getLine(), getColumn()); + } } } @@ -460,7 +1063,7 @@ CaContent::readAttributes( { std::string message = "Combine attribute 'location' is missing from the " " element."; - log->logError(CombineCaContentAllowedAttributes, level, version, message); + log->logError(CombineContentAllowedAttributes, level, version, message); } // @@ -480,14 +1083,25 @@ CaContent::readAttributes( { std::string message = "Combine attribute 'format' is missing from the " " element."; - log->logError(CombineCaContentAllowedAttributes, level, version, message); + log->logError(CombineContentAllowedAttributes, level, version, message); } // // master bool (use = "optional" ) // + numErrs = log->getNumErrors(); mIsSetMaster = attributes.readInto("master", mMaster); + + if (mIsSetMaster == false) + { + if (log->getNumErrors() == numErrs + 1 && + log->contains(XMLAttributeTypeMismatch)) + { + log->remove(XMLAttributeTypeMismatch); + log->logError(CombineContentMasterMustBeBoolean, level, version); + } + } } /** @endcond */ @@ -576,7 +1190,7 @@ CaContent_free(CaContent_t* cc) * Returns the value of the "location" attribute of this CaContent_t. */ LIBCOMBINE_EXTERN -const char * +char * CaContent_getLocation(const CaContent_t * cc) { if (cc == NULL) @@ -593,7 +1207,7 @@ CaContent_getLocation(const CaContent_t * cc) * Returns the value of the "format" attribute of this CaContent_t. */ LIBCOMBINE_EXTERN -const char * +char * CaContent_getFormat(const CaContent_t * cc) { if (cc == NULL) @@ -617,7 +1231,8 @@ CaContent_getMaster(const CaContent_t * cc) /* - * Predicate returning @c 1 if this CaContent_t's "location" attribute is set. + * Predicate returning @c 1 (true) if this CaContent_t's "location" attribute + * is set. */ LIBCOMBINE_EXTERN int @@ -628,7 +1243,8 @@ CaContent_isSetLocation(const CaContent_t * cc) /* - * Predicate returning @c 1 if this CaContent_t's "format" attribute is set. + * Predicate returning @c 1 (true) if this CaContent_t's "format" attribute is + * set. */ LIBCOMBINE_EXTERN int @@ -639,7 +1255,8 @@ CaContent_isSetFormat(const CaContent_t * cc) /* - * Predicate returning @c 1 if this CaContent_t's "master" attribute is set. + * Predicate returning @c 1 (true) if this CaContent_t's "master" attribute is + * set. */ LIBCOMBINE_EXTERN int @@ -716,8 +1333,76 @@ CaContent_unsetMaster(CaContent_t * cc) /* - * Predicate returning @c 1 if all the required attributes for this CaContent_t - * object have been set. + * Returns a ListOf_t * containing CaCrossRef_t objects from this CaContent_t. + */ +LIBCOMBINE_EXTERN +CaListOf_t* +CaContent_getListOfCrossRefs(CaContent_t* cc) +{ + return (cc != NULL) ? cc->getListOfCrossRefs() : NULL; +} + + +/* + * Get a CaCrossRef_t from the CaContent_t. + */ +LIBCOMBINE_EXTERN +CaCrossRef_t* +CaContent_getCrossRef(CaContent_t* cc, unsigned int n) +{ + return (cc != NULL) ? cc->getCrossRef(n) : NULL; +} + + +/* + * Adds a copy of the given CaCrossRef_t to this CaContent_t. + */ +LIBCOMBINE_EXTERN +int +CaContent_addCrossRef(CaContent_t* cc, const CaCrossRef_t* ccr) +{ + return (cc != NULL) ? cc->addCrossRef(ccr) : LIBCOMBINE_INVALID_OBJECT; +} + + +/* + * Get the number of CaCrossRef_t objects in this CaContent_t. + */ +LIBCOMBINE_EXTERN +unsigned int +CaContent_getNumCrossRefs(CaContent_t* cc) +{ + return (cc != NULL) ? cc->getNumCrossRefs() : OMEX_INT_MAX; +} + + +/* + * Creates a new CaCrossRef_t object, adds it to this CaContent_t object and + * returns the CaCrossRef_t object created. + */ +LIBCOMBINE_EXTERN +CaCrossRef_t* +CaContent_createCrossRef(CaContent_t* cc) +{ + return (cc != NULL) ? cc->createCrossRef() : NULL; +} + + +/* + * Removes the nth CaCrossRef_t from this CaContent_t and returns a pointer to + * it. + */ +LIBCOMBINE_EXTERN +CaCrossRef_t* +CaContent_removeCrossRef(CaContent_t* cc, unsigned int n) +{ + return (cc != NULL) ? cc->removeCrossRef(n) : NULL; +} + + +/* + * Predicate returning @c 1 (true) if all the required attributes for this + * CaContent_t object have been set. */ LIBCOMBINE_EXTERN int diff --git a/src/omex/CaContent.h b/src/omex/CaContent.h index c7ffba6..bee0b16 100644 --- a/src/omex/CaContent.h +++ b/src/omex/CaContent.h @@ -7,7 +7,11 @@ * This file is part of libSBML. Please visit http://sbml.org for more * information about SBML, and the latest version of libSBML. * - * Copyright (C) 2013-2016 jointly by the following organizations: + * Copyright (C) 2019 jointly by the following organizations: + * 1. California Institute of Technology, Pasadena, CA, USA + * 2. University of Heidelberg, Heidelberg, Germany + * + * Copyright (C) 2013-2018 jointly by the following organizations: * 1. California Institute of Technology, Pasadena, CA, USA * 2. EMBL European Bioinformatics Institute (EMBL-EBI), Hinxton, UK * 3. University of Heidelberg, Heidelberg, Germany @@ -50,6 +54,7 @@ #include +#include #include @@ -66,6 +71,7 @@ class LIBCOMBINE_EXTERN CaContent : public CaBase std::string mFormat; bool mMaster; bool mIsSetMaster; + CaListOfCrossRefs mCrossRefs; /** @endcond */ @@ -82,11 +88,7 @@ class LIBCOMBINE_EXTERN CaContent : public CaBase * * @param omexns the CaNamespaces object. * - * @throws OMEXConstructorException - * Thrown if the given @p level and @p version combination, or this kind of - * OMEX object, are either invalid or mismatched with respect to the parent - * CaOmexManifest object. - * @copydetails doc_note_setting_lv + * @copydetails doc_note_setting_lv_pkg */ CaContent(CaNamespaces *omexns); @@ -147,6 +149,7 @@ class LIBCOMBINE_EXTERN CaContent : public CaBase */ bool isFormat(const std::string& formatKey) const; + /** * Returns the value of the "master" attribute of this CaContent. * @@ -189,10 +192,11 @@ class LIBCOMBINE_EXTERN CaContent : public CaBase * * @param location std::string& value of the "location" attribute to be set. * - * @copydetails doc_returns_success_code + * @copydetails doc_returns_one_success_code * @li @omexconstant{LIBCOMBINE_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @omexconstant{LIBCOMBINE_INVALID_ATTRIBUTE_VALUE, - * OperationReturnValues_t} + * + * Calling this function with @p location = @c NULL or an empty string is + * equivalent to calling unsetLocation(). */ int setLocation(const std::string& location); @@ -202,10 +206,11 @@ class LIBCOMBINE_EXTERN CaContent : public CaBase * * @param format std::string& value of the "format" attribute to be set. * - * @copydetails doc_returns_success_code + * @copydetails doc_returns_one_success_code * @li @omexconstant{LIBCOMBINE_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @omexconstant{LIBCOMBINE_INVALID_ATTRIBUTE_VALUE, - * OperationReturnValues_t} + * + * Calling this function with @p format = @c NULL or an empty string is + * equivalent to calling unsetFormat(). */ int setFormat(const std::string& format); @@ -253,6 +258,163 @@ class LIBCOMBINE_EXTERN CaContent : public CaBase int unsetMaster(); + /** + * Returns the CaListOfCrossRefs from this CaContent. + * + * @return the CaListOfCrossRefs from this CaContent. + * + * @copydetails doc_returned_unowned_pointer + * + * @see addCrossRef(const CaCrossRef* object) + * @see createCrossRef() + * @see getCrossRef(const std::string& sid) + * @see getCrossRef(unsigned int n) + * @see getNumCrossRefs() + * @see removeCrossRef(const std::string& sid) + * @see removeCrossRef(unsigned int n) + */ + const CaListOfCrossRefs* getListOfCrossRefs() const; + + + /** + * Returns the CaListOfCrossRefs from this CaContent. + * + * @return the CaListOfCrossRefs from this CaContent. + * + * @copydetails doc_returned_unowned_pointer + * + * @see addCrossRef(const CaCrossRef* object) + * @see createCrossRef() + * @see getCrossRef(const std::string& sid) + * @see getCrossRef(unsigned int n) + * @see getNumCrossRefs() + * @see removeCrossRef(const std::string& sid) + * @see removeCrossRef(unsigned int n) + */ + CaListOfCrossRefs* getListOfCrossRefs(); + + + /** + * Get a CaCrossRef from the CaContent. + * + * @param n an unsigned int representing the index of the CaCrossRef to + * retrieve. + * + * @return the nth CaCrossRef in the CaListOfCrossRefs within this CaContent. + * + * @copydetails doc_returned_unowned_pointer + * + * @see addCrossRef(const CaCrossRef* object) + * @see createCrossRef() + * @see getCrossRef(const std::string& sid) + * @see getNumCrossRefs() + * @see removeCrossRef(const std::string& sid) + * @see removeCrossRef(unsigned int n) + */ + CaCrossRef* getCrossRef(unsigned int n); + + + /** + * Get a CaCrossRef from the CaContent. + * + * @param n an unsigned int representing the index of the CaCrossRef to + * retrieve. + * + * @return the nth CaCrossRef in the CaListOfCrossRefs within this CaContent. + * + * @copydetails doc_returned_unowned_pointer + * + * @see addCrossRef(const CaCrossRef* object) + * @see createCrossRef() + * @see getCrossRef(const std::string& sid) + * @see getNumCrossRefs() + * @see removeCrossRef(const std::string& sid) + * @see removeCrossRef(unsigned int n) + */ + const CaCrossRef* getCrossRef(unsigned int n) const; + + + /** + * Adds a copy of the given CaCrossRef to this CaContent. + * + * @param ccr the CaCrossRef object to add. + * + * @copydetails doc_returns_success_code + * @li @omexconstant{LIBCOMBINE_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @omexconstant{LIBCOMBINE_OPERATION_FAILED, OperationReturnValues_t} + * @li @omexconstant{LIBCOMBINE_INVALID_OBJECT, OperationReturnValues_t} + * @li @omexconstant{LIBCOMBINE_LEVEL_MISMATCH, OperationReturnValues_t} + * @li @omexconstant{LIBCOMBINE_VERSION_MISMATCH, OperationReturnValues_t} + * @li @omexconstant{LIBCOMBINE_PKG_VERSION_MISMATCH, + * OperationReturnValues_t} + * @li @omexconstant{LIBCOMBINE_DUPLICATE_OBJECT_ID, OperationReturnValues_t} + * + * @copydetails doc_note_object_is_copied + * + * @see createCrossRef() + * @see getCrossRef(const std::string& sid) + * @see getCrossRef(unsigned int n) + * @see getNumCrossRefs() + * @see removeCrossRef(const std::string& sid) + * @see removeCrossRef(unsigned int n) + */ + int addCrossRef(const CaCrossRef* ccr); + + + /** + * Get the number of CaCrossRef objects in this CaContent. + * + * @return the number of CaCrossRef objects in this CaContent. + * + * @see addCrossRef(const CaCrossRef* object) + * @see createCrossRef() + * @see getCrossRef(const std::string& sid) + * @see getCrossRef(unsigned int n) + * @see removeCrossRef(const std::string& sid) + * @see removeCrossRef(unsigned int n) + */ + unsigned int getNumCrossRefs() const; + + + /** + * Creates a new CaCrossRef object, adds it to this CaContent object and + * returns the CaCrossRef object created. + * + * @return a new CaCrossRef object instance. + * + * @copydetails doc_returned_unowned_pointer + * + * @see addCrossRef(const CaCrossRef* object) + * @see getCrossRef(const std::string& sid) + * @see getCrossRef(unsigned int n) + * @see getNumCrossRefs() + * @see removeCrossRef(const std::string& sid) + * @see removeCrossRef(unsigned int n) + */ + CaCrossRef* createCrossRef(); + + + /** + * Removes the nth CaCrossRef from this CaContent and returns a pointer to + * it. + * + * @param n an unsigned int representing the index of the CaCrossRef to + * remove. + * + * @return a pointer to the nth CaCrossRef in this CaContent. + * + * @copydetails doc_returned_owned_pointer + * + * @see addCrossRef(const CaCrossRef* object) + * @see createCrossRef() + * @see getCrossRef(const std::string& sid) + * @see getCrossRef(unsigned int n) + * @see getNumCrossRefs() + * @see removeCrossRef(const std::string& sid) + */ + CaCrossRef* removeCrossRef(unsigned int n); + + /** * Returns the XML element name of this CaContent object. * @@ -269,8 +431,7 @@ class LIBCOMBINE_EXTERN CaContent : public CaBase * @copydetails doc_what_are_typecodes * * @return the OMEX type code for this object: - * - * @omexconstant{LIB_COMBINE_CONTENT, OMEXCombineTypeCode_t} + * @omexconstant{LIB_COMBINE_CONTENT, CaTypeCode_t}. * * @copydetails doc_warning_typecodes_not_unique * @@ -328,9 +489,372 @@ class LIBCOMBINE_EXTERN CaContent : public CaBase /** @endcond */ + + /** @cond doxygenlibCombineInternal */ + + /** + * Connects to child elements + */ + virtual void connectToChild(); + + /** @endcond */ + + + + + #ifndef SWIG + + + + /** @cond doxygenlibCombineInternal */ + + /** + * Gets the value of the "attributeName" attribute of this CaContent. + * + * @param attributeName, the name of the attribute to retrieve. + * + * @param value, the address of the value to record. + * + * @copydetails doc_returns_success_code + * @li @omexconstant{LIBCOMBINE_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @omexconstant{LIBCOMBINE_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int getAttribute(const std::string& attributeName, bool& value) + const; + + /** @endcond */ + + + + /** @cond doxygenlibCombineInternal */ + + /** + * Gets the value of the "attributeName" attribute of this CaContent. + * + * @param attributeName, the name of the attribute to retrieve. + * + * @param value, the address of the value to record. + * + * @copydetails doc_returns_success_code + * @li @omexconstant{LIBCOMBINE_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @omexconstant{LIBCOMBINE_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int getAttribute(const std::string& attributeName, int& value) const; + + /** @endcond */ + + + + /** @cond doxygenlibCombineInternal */ + + /** + * Gets the value of the "attributeName" attribute of this CaContent. + * + * @param attributeName, the name of the attribute to retrieve. + * + * @param value, the address of the value to record. + * + * @copydetails doc_returns_success_code + * @li @omexconstant{LIBCOMBINE_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @omexconstant{LIBCOMBINE_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int getAttribute(const std::string& attributeName, + double& value) const; + + /** @endcond */ + + + + /** @cond doxygenlibCombineInternal */ + + /** + * Gets the value of the "attributeName" attribute of this CaContent. + * + * @param attributeName, the name of the attribute to retrieve. + * + * @param value, the address of the value to record. + * + * @copydetails doc_returns_success_code + * @li @omexconstant{LIBCOMBINE_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @omexconstant{LIBCOMBINE_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int getAttribute(const std::string& attributeName, + unsigned int& value) const; + + /** @endcond */ + + + + /** @cond doxygenlibCombineInternal */ + + /** + * Gets the value of the "attributeName" attribute of this CaContent. + * + * @param attributeName, the name of the attribute to retrieve. + * + * @param value, the address of the value to record. + * + * @copydetails doc_returns_success_code + * @li @omexconstant{LIBCOMBINE_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @omexconstant{LIBCOMBINE_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int getAttribute(const std::string& attributeName, + std::string& value) const; + + /** @endcond */ + + + + /** @cond doxygenlibCombineInternal */ + + /** + * Predicate returning @c true if this CaContent's attribute "attributeName" + * is set. + * + * @param attributeName, the name of the attribute to query. + * + * @return @c true if this CaContent's attribute "attributeName" has been + * set, otherwise @c false is returned. + */ + virtual bool isSetAttribute(const std::string& attributeName) const; + + /** @endcond */ + + + + /** @cond doxygenlibCombineInternal */ + + /** + * Sets the value of the "attributeName" attribute of this CaContent. + * + * @param attributeName, the name of the attribute to set. + * + * @param value, the value of the attribute to set. + * + * @copydetails doc_returns_success_code + * @li @omexconstant{LIBCOMBINE_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @omexconstant{LIBCOMBINE_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int setAttribute(const std::string& attributeName, bool value); + + /** @endcond */ + + + + /** @cond doxygenlibCombineInternal */ + + /** + * Sets the value of the "attributeName" attribute of this CaContent. + * + * @param attributeName, the name of the attribute to set. + * + * @param value, the value of the attribute to set. + * + * @copydetails doc_returns_success_code + * @li @omexconstant{LIBCOMBINE_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @omexconstant{LIBCOMBINE_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int setAttribute(const std::string& attributeName, int value); + + /** @endcond */ + + + + /** @cond doxygenlibCombineInternal */ + + /** + * Sets the value of the "attributeName" attribute of this CaContent. + * + * @param attributeName, the name of the attribute to set. + * + * @param value, the value of the attribute to set. + * + * @copydetails doc_returns_success_code + * @li @omexconstant{LIBCOMBINE_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @omexconstant{LIBCOMBINE_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int setAttribute(const std::string& attributeName, double value); + + /** @endcond */ + + + + /** @cond doxygenlibCombineInternal */ + + /** + * Sets the value of the "attributeName" attribute of this CaContent. + * + * @param attributeName, the name of the attribute to set. + * + * @param value, the value of the attribute to set. + * + * @copydetails doc_returns_success_code + * @li @omexconstant{LIBCOMBINE_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @omexconstant{LIBCOMBINE_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int setAttribute(const std::string& attributeName, + unsigned int value); + + /** @endcond */ + + + + /** @cond doxygenlibCombineInternal */ + + /** + * Sets the value of the "attributeName" attribute of this CaContent. + * + * @param attributeName, the name of the attribute to set. + * + * @param value, the value of the attribute to set. + * + * @copydetails doc_returns_success_code + * @li @omexconstant{LIBCOMBINE_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @omexconstant{LIBCOMBINE_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int setAttribute(const std::string& attributeName, + const std::string& value); + + /** @endcond */ + + + + /** @cond doxygenlibCombineInternal */ + + /** + * Unsets the value of the "attributeName" attribute of this CaContent. + * + * @param attributeName, the name of the attribute to query. + * + * @copydetails doc_returns_success_code + * @li @omexconstant{LIBCOMBINE_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @omexconstant{LIBCOMBINE_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int unsetAttribute(const std::string& attributeName); + + /** @endcond */ + + + + /** @cond doxygenlibCombineInternal */ + + /** + * Creates and returns an new "elementName" object in this CaContent. + * + * @param elementName, the name of the element to create. + * + * @return pointer to the element created. + */ + virtual CaBase* createChildObject(const std::string& elementName); + + /** @endcond */ + + + + /** @cond doxygenlibCombineInternal */ + + /** + * Adds a new "elementName" object to this CaContent. + * + * @param elementName, the name of the element to create. + * + * @param element, pointer to the element to be added. + * + * @copydetails doc_returns_success_code + * @li @omexconstant{LIBCOMBINE_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @omexconstant{LIBCOMBINE_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int addChildObject(const std::string& elementName, + const CaBase* element); + + /** @endcond */ + + + + /** @cond doxygenlibCombineInternal */ + + /** + * Removes and returns the new "elementName" object with the given id in this + * CaContent. + * + * @param elementName, the name of the element to remove. + * + * @param id, the id of the element to remove. + * + * @return pointer to the element removed. + */ + virtual CaBase* removeChildObject(const std::string& elementName, + const std::string& id); + + /** @endcond */ + + + + /** @cond doxygenlibCombineInternal */ + + /** + * Returns the number of "elementName" in this CaContent. + * + * @param elementName, the name of the element to get number of. + * + * @return unsigned int number of elements. + */ + virtual unsigned int getNumObjects(const std::string& elementName); + + /** @endcond */ + + + + /** @cond doxygenlibCombineInternal */ + + /** + * Returns the nth object of "objectName" in this CaContent. + * + * @param elementName, the name of the element to get number of. + * + * @param index, unsigned int the index of the object to retrieve. + * + * @return pointer to the object. + */ + virtual CaBase* getObject(const std::string& elementName, unsigned int + index); + + /** @endcond */ + + + + + #endif /* !SWIG */ + + + /** + * Returns the first child element that has the given @p id in the model-wide + * SId namespace, or @c NULL if no such object is found. + * + * @param id a string representing the id attribute of the object to + * retrieve. + * + * @return a pointer to the CaBase element with the given @p id. If no such + * object is found, this method returns @c NULL. + */ + virtual CaBase* getElementBySId(const std::string& id); + + protected: + /** @cond doxygenlibCombineInternal */ + + /** + * Creates a new object from the next XMLToken on the XMLInputStream + */ + virtual CaBase* createObject(LIBSBML_CPP_NAMESPACE_QUALIFIER XMLInputStream& + stream); + + /** @endcond */ + + + /** @cond doxygenlibCombineInternal */ /** @@ -413,6 +937,8 @@ CaContent_create(); * * @return a (deep) copy of this CaContent_t object. * + * @copydetails doc_returned_owned_pointer + * * @memberof CaContent_t */ LIBCOMBINE_EXTERN @@ -440,10 +966,12 @@ CaContent_free(CaContent_t* cc); * @return the value of the "location" attribute of this CaContent_t as a * pointer to a string. * + * @copydetails doc_returned_owned_char + * * @memberof CaContent_t */ LIBCOMBINE_EXTERN -const char * +char * CaContent_getLocation(const CaContent_t * cc); @@ -455,10 +983,12 @@ CaContent_getLocation(const CaContent_t * cc); * @return the value of the "format" attribute of this CaContent_t as a pointer * to a string. * + * @copydetails doc_returned_owned_char + * * @memberof CaContent_t */ LIBCOMBINE_EXTERN -const char * +char * CaContent_getFormat(const CaContent_t * cc); @@ -478,12 +1008,13 @@ CaContent_getMaster(const CaContent_t * cc); /** - * Predicate returning @c 1 if this CaContent_t's "location" attribute is set. + * Predicate returning @c 1 (true) if this CaContent_t's "location" attribute + * is set. * * @param cc the CaContent_t structure. * - * @return @c 1 if this CaContent_t's "location" attribute has been set, - * otherwise @c 0 is returned. + * @return @c 1 (true) if this CaContent_t's "location" attribute has been set, + * otherwise @c 0 (false) is returned. * * @memberof CaContent_t */ @@ -493,12 +1024,13 @@ CaContent_isSetLocation(const CaContent_t * cc); /** - * Predicate returning @c 1 if this CaContent_t's "format" attribute is set. + * Predicate returning @c 1 (true) if this CaContent_t's "format" attribute is + * set. * * @param cc the CaContent_t structure. * - * @return @c 1 if this CaContent_t's "format" attribute has been set, - * otherwise @c 0 is returned. + * @return @c 1 (true) if this CaContent_t's "format" attribute has been set, + * otherwise @c 0 (false) is returned. * * @memberof CaContent_t */ @@ -508,12 +1040,13 @@ CaContent_isSetFormat(const CaContent_t * cc); /** - * Predicate returning @c 1 if this CaContent_t's "master" attribute is set. + * Predicate returning @c 1 (true) if this CaContent_t's "master" attribute is + * set. * * @param cc the CaContent_t structure. * - * @return @c 1 if this CaContent_t's "master" attribute has been set, - * otherwise @c 0 is returned. + * @return @c 1 (true) if this CaContent_t's "master" attribute has been set, + * otherwise @c 0 (false) is returned. * * @memberof CaContent_t */ @@ -531,8 +1064,10 @@ CaContent_isSetMaster(const CaContent_t * cc); * * @copydetails doc_returns_success_code * @li @omexconstant{LIBCOMBINE_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @omexconstant{LIBCOMBINE_INVALID_ATTRIBUTE_VALUE, - * OperationReturnValues_t} + * @li @omexconstant{LIBCOMBINE_INVALID_OBJECT, OperationReturnValues_t} + * + * Calling this function with @p location = @c NULL or an empty string is + * equivalent to calling CaContent_unsetLocation(). * * @memberof CaContent_t */ @@ -550,8 +1085,10 @@ CaContent_setLocation(CaContent_t * cc, const char * location); * * @copydetails doc_returns_success_code * @li @omexconstant{LIBCOMBINE_OPERATION_SUCCESS, OperationReturnValues_t} - * @li @omexconstant{LIBCOMBINE_INVALID_ATTRIBUTE_VALUE, - * OperationReturnValues_t} + * @li @omexconstant{LIBCOMBINE_INVALID_OBJECT, OperationReturnValues_t} + * + * Calling this function with @p format = @c NULL or an empty string is + * equivalent to calling CaContent_unsetFormat(). * * @memberof CaContent_t */ @@ -571,6 +1108,7 @@ CaContent_setFormat(CaContent_t * cc, const char * format); * @li @omexconstant{LIBCOMBINE_OPERATION_SUCCESS, OperationReturnValues_t} * @li @omexconstant{LIBCOMBINE_INVALID_ATTRIBUTE_VALUE, * OperationReturnValues_t} + * @li @omexconstant{LIBCOMBINE_INVALID_OBJECT, OperationReturnValues_t} * * @memberof CaContent_t */ @@ -587,6 +1125,7 @@ CaContent_setMaster(CaContent_t * cc, int master); * @copydetails doc_returns_success_code * @li @omexconstant{LIBCOMBINE_OPERATION_SUCCESS, OperationReturnValues_t} * @li @omexconstant{LIBCOMBINE_OPERATION_FAILED, OperationReturnValues_t} + * @li @omexconstant{LIBCOMBINE_INVALID_OBJECT, OperationReturnValues_t} * * @memberof CaContent_t */ @@ -603,6 +1142,7 @@ CaContent_unsetLocation(CaContent_t * cc); * @copydetails doc_returns_success_code * @li @omexconstant{LIBCOMBINE_OPERATION_SUCCESS, OperationReturnValues_t} * @li @omexconstant{LIBCOMBINE_OPERATION_FAILED, OperationReturnValues_t} + * @li @omexconstant{LIBCOMBINE_INVALID_OBJECT, OperationReturnValues_t} * * @memberof CaContent_t */ @@ -619,6 +1159,7 @@ CaContent_unsetFormat(CaContent_t * cc); * @copydetails doc_returns_success_code * @li @omexconstant{LIBCOMBINE_OPERATION_SUCCESS, OperationReturnValues_t} * @li @omexconstant{LIBCOMBINE_OPERATION_FAILED, OperationReturnValues_t} + * @li @omexconstant{LIBCOMBINE_INVALID_OBJECT, OperationReturnValues_t} * * @memberof CaContent_t */ @@ -628,13 +1169,132 @@ CaContent_unsetMaster(CaContent_t * cc); /** - * Predicate returning @c 1 if all the required attributes for this CaContent_t - * object have been set. + * Returns a ListOf_t * containing CaCrossRef_t objects from this CaContent_t. + * + * @param cc the CaContent_t structure whose CaListOfCrossRefs is sought. + * + * @return the CaListOfCrossRefs from this CaContent_t as a ListOf_t *. + * + * @copydetails doc_returned_unowned_pointer + * + * @see CaContent_addCrossRef() + * @see CaContent_createCrossRef() + * @see CaContent_getCrossRefById() + * @see CaContent_getCrossRef() + * @see CaContent_getNumCrossRefs() + * @see CaContent_removeCrossRefById() + * @see CaContent_removeCrossRef() + * + * @memberof CaContent_t + */ +LIBCOMBINE_EXTERN +CaListOf_t* +CaContent_getListOfCrossRefs(CaContent_t* cc); + + +/** + * Get a CaCrossRef_t from the CaContent_t. + * + * @param cc the CaContent_t structure to search. + * + * @param n an unsigned int representing the index of the CaCrossRef_t to + * retrieve. + * + * @return the nth CaCrossRef_t in the CaListOfCrossRefs within this CaContent. + * + * @copydetails doc_returned_unowned_pointer + * + * @memberof CaContent_t + */ +LIBCOMBINE_EXTERN +CaCrossRef_t* +CaContent_getCrossRef(CaContent_t* cc, unsigned int n); + + +/** + * Adds a copy of the given CaCrossRef_t to this CaContent_t. + * + * @param cc the CaContent_t structure to which the CaCrossRef_t should be + * added. + * + * @param ccr the CaCrossRef_t object to add. + * + * @copydetails doc_returns_success_code + * @li @omexconstant{LIBCOMBINE_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @omexconstant{LIBCOMBINE_OPERATION_FAILED, OperationReturnValues_t} + * @li @omexconstant{LIBCOMBINE_INVALID_OBJECT, OperationReturnValues_t} + * @li @omexconstant{LIBCOMBINE_LEVEL_MISMATCH, OperationReturnValues_t} + * @li @omexconstant{LIBCOMBINE_VERSION_MISMATCH, OperationReturnValues_t} + * @li @omexconstant{LIBCOMBINE_PKG_VERSION_MISMATCH, OperationReturnValues_t} + * @li @omexconstant{LIBCOMBINE_DUPLICATE_OBJECT_ID, OperationReturnValues_t} + * + * @memberof CaContent_t + */ +LIBCOMBINE_EXTERN +int +CaContent_addCrossRef(CaContent_t* cc, const CaCrossRef_t* ccr); + + +/** + * Get the number of CaCrossRef_t objects in this CaContent_t. + * + * @param cc the CaContent_t structure to query. + * + * @return the number of CaCrossRef_t objects in this CaContent_t. + * + * @memberof CaContent_t + */ +LIBCOMBINE_EXTERN +unsigned int +CaContent_getNumCrossRefs(CaContent_t* cc); + + +/** + * Creates a new CaCrossRef_t object, adds it to this CaContent_t object and + * returns the CaCrossRef_t object created. + * + * @param cc the CaContent_t structure to which the CaCrossRef_t should be + * added. + * + * @return a new CaCrossRef_t object instance. + * + * @copydetails doc_returned_unowned_pointer + * + * @memberof CaContent_t + */ +LIBCOMBINE_EXTERN +CaCrossRef_t* +CaContent_createCrossRef(CaContent_t* cc); + + +/** + * Removes the nth CaCrossRef_t from this CaContent_t and returns a pointer to + * it. + * + * @param cc the CaContent_t structure to search. + * + * @param n an unsigned int representing the index of the CaCrossRef_t to + * remove. + * + * @return a pointer to the nth CaCrossRef_t in this CaContent_t. + * + * @copydetails doc_returned_owned_pointer + * + * @memberof CaContent_t + */ +LIBCOMBINE_EXTERN +CaCrossRef_t* +CaContent_removeCrossRef(CaContent_t* cc, unsigned int n); + + +/** + * Predicate returning @c 1 (true) if all the required attributes for this + * CaContent_t object have been set. * * @param cc the CaContent_t structure. * - * @return @c 1 to indicate that all the required attributes of this - * CaContent_t have been set, otherwise @c 0 is returned. + * @return @c 1 (true) to indicate that all the required attributes of this + * CaContent_t have been set, otherwise @c 0 (false) is returned. * * * @note The required attributes for the CaContent_t object are: diff --git a/src/omex/CaCrossRef.cpp b/src/omex/CaCrossRef.cpp new file mode 100644 index 0000000..fa9d4ea --- /dev/null +++ b/src/omex/CaCrossRef.cpp @@ -0,0 +1,721 @@ +/** + * @file CaCrossRef.cpp + * @brief Implementation of the CaCrossRef class. + * @author DEVISER + * + * + */ +#include +#include +#include + + +using namespace std; + + + +LIBCOMBINE_CPP_NAMESPACE_BEGIN + + + + +#ifdef __cplusplus + + +/* + * Creates a new CaCrossRef instance. + */ +CaCrossRef::CaCrossRef() + : CaBase(1, 1) + , mLocation ("") +{ +} + + +/* + * Creates a new CaCrossRef using the given CaNamespaces object @p omexns. + */ +CaCrossRef::CaCrossRef(CaNamespaces *omexns) + : CaBase(omexns) + , mLocation ("") +{ + setElementNamespace(omexns->getURI()); +} + + +/* + * Copy constructor for CaCrossRef. + */ +CaCrossRef::CaCrossRef(const CaCrossRef& orig) + : CaBase( orig ) + , mLocation ( orig.mLocation ) +{ +} + + +/* + * Assignment operator for CaCrossRef. + */ +CaCrossRef& +CaCrossRef::operator=(const CaCrossRef& rhs) +{ + if (&rhs != this) + { + CaBase::operator=(rhs); + mLocation = rhs.mLocation; + } + + return *this; +} + + +/* + * Creates and returns a deep copy of this CaCrossRef object. + */ +CaCrossRef* +CaCrossRef::clone() const +{ + return new CaCrossRef(*this); +} + + +/* + * Destructor for CaCrossRef. + */ +CaCrossRef::~CaCrossRef() +{ +} + + +/* + * Returns the value of the "location" attribute of this CaCrossRef. + */ +const std::string& +CaCrossRef::getLocation() const +{ + return mLocation; +} + + +/* + * Predicate returning @c true if this CaCrossRef's "location" attribute is + * set. + */ +bool +CaCrossRef::isSetLocation() const +{ + return (mLocation.empty() == false); +} + + +/* + * Sets the value of the "location" attribute of this CaCrossRef. + */ +int +CaCrossRef::setLocation(const std::string& location) +{ + mLocation = location; + return LIBCOMBINE_OPERATION_SUCCESS; +} + + +/* + * Unsets the value of the "location" attribute of this CaCrossRef. + */ +int +CaCrossRef::unsetLocation() +{ + mLocation.erase(); + + if (mLocation.empty() == true) + { + return LIBCOMBINE_OPERATION_SUCCESS; + } + else + { + return LIBCOMBINE_OPERATION_FAILED; + } +} + + +/* + * Returns the XML element name of this CaCrossRef object. + */ +const std::string& +CaCrossRef::getElementName() const +{ + static const string name = "crossRef"; + return name; +} + + +/* + * Returns the libCombine type code for this CaCrossRef object. + */ +int +CaCrossRef::getTypeCode() const +{ + return LIB_COMBINE_CROSSREF; +} + + +/* + * Predicate returning @c true if all the required attributes for this + * CaCrossRef object have been set. + */ +bool +CaCrossRef::hasRequiredAttributes() const +{ + bool allPresent = true; + + if (isSetLocation() == false) + { + allPresent = false; + } + + return allPresent; +} + + + +/** @cond doxygenlibCombineInternal */ + +/* + * Write any contained elements + */ +void +CaCrossRef::writeElements(LIBSBML_CPP_NAMESPACE_QUALIFIER XMLOutputStream& + stream) const +{ + CaBase::writeElements(stream); +} + +/** @endcond */ + + + +/** @cond doxygenlibCombineInternal */ + +/* + * Accepts the given CaVisitor + */ +bool +CaCrossRef::accept(CaVisitor& v) const +{ + return false; +} + +/** @endcond */ + + + +/** @cond doxygenlibCombineInternal */ + +/* + * Sets the parent CaOmexManifest + */ +void +CaCrossRef::setCaOmexManifest(CaOmexManifest* d) +{ + CaBase::setCaOmexManifest(d); +} + +/** @endcond */ + + + +/** @cond doxygenlibCombineInternal */ + +/* + * Gets the value of the "attributeName" attribute of this CaCrossRef. + */ +int +CaCrossRef::getAttribute(const std::string& attributeName, bool& value) const +{ + int return_value = CaBase::getAttribute(attributeName, value); + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenlibCombineInternal */ + +/* + * Gets the value of the "attributeName" attribute of this CaCrossRef. + */ +int +CaCrossRef::getAttribute(const std::string& attributeName, int& value) const +{ + int return_value = CaBase::getAttribute(attributeName, value); + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenlibCombineInternal */ + +/* + * Gets the value of the "attributeName" attribute of this CaCrossRef. + */ +int +CaCrossRef::getAttribute(const std::string& attributeName, + double& value) const +{ + int return_value = CaBase::getAttribute(attributeName, value); + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenlibCombineInternal */ + +/* + * Gets the value of the "attributeName" attribute of this CaCrossRef. + */ +int +CaCrossRef::getAttribute(const std::string& attributeName, + unsigned int& value) const +{ + int return_value = CaBase::getAttribute(attributeName, value); + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenlibCombineInternal */ + +/* + * Gets the value of the "attributeName" attribute of this CaCrossRef. + */ +int +CaCrossRef::getAttribute(const std::string& attributeName, + std::string& value) const +{ + int return_value = CaBase::getAttribute(attributeName, value); + + if (return_value == LIBCOMBINE_OPERATION_SUCCESS) + { + return return_value; + } + + if (attributeName == "location") + { + value = getLocation(); + return_value = LIBCOMBINE_OPERATION_SUCCESS; + } + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenlibCombineInternal */ + +/* + * Predicate returning @c true if this CaCrossRef's attribute "attributeName" + * is set. + */ +bool +CaCrossRef::isSetAttribute(const std::string& attributeName) const +{ + bool value = CaBase::isSetAttribute(attributeName); + + if (attributeName == "location") + { + value = isSetLocation(); + } + + return value; +} + +/** @endcond */ + + + +/** @cond doxygenlibCombineInternal */ + +/* + * Sets the value of the "attributeName" attribute of this CaCrossRef. + */ +int +CaCrossRef::setAttribute(const std::string& attributeName, bool value) +{ + int return_value = CaBase::setAttribute(attributeName, value); + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenlibCombineInternal */ + +/* + * Sets the value of the "attributeName" attribute of this CaCrossRef. + */ +int +CaCrossRef::setAttribute(const std::string& attributeName, int value) +{ + int return_value = CaBase::setAttribute(attributeName, value); + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenlibCombineInternal */ + +/* + * Sets the value of the "attributeName" attribute of this CaCrossRef. + */ +int +CaCrossRef::setAttribute(const std::string& attributeName, double value) +{ + int return_value = CaBase::setAttribute(attributeName, value); + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenlibCombineInternal */ + +/* + * Sets the value of the "attributeName" attribute of this CaCrossRef. + */ +int +CaCrossRef::setAttribute(const std::string& attributeName, unsigned int value) +{ + int return_value = CaBase::setAttribute(attributeName, value); + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenlibCombineInternal */ + +/* + * Sets the value of the "attributeName" attribute of this CaCrossRef. + */ +int +CaCrossRef::setAttribute(const std::string& attributeName, + const std::string& value) +{ + int return_value = CaBase::setAttribute(attributeName, value); + + if (attributeName == "location") + { + return_value = setLocation(value); + } + + return return_value; +} + +/** @endcond */ + + + +/** @cond doxygenlibCombineInternal */ + +/* + * Unsets the value of the "attributeName" attribute of this CaCrossRef. + */ +int +CaCrossRef::unsetAttribute(const std::string& attributeName) +{ + int value = CaBase::unsetAttribute(attributeName); + + if (attributeName == "location") + { + value = unsetLocation(); + } + + return value; +} + +/** @endcond */ + + + +/** @cond doxygenlibCombineInternal */ + +/* + * Adds the expected attributes for this element + */ +void +CaCrossRef::addExpectedAttributes(LIBSBML_CPP_NAMESPACE_QUALIFIER + ExpectedAttributes& attributes) +{ + CaBase::addExpectedAttributes(attributes); + + attributes.add("location"); +} + +/** @endcond */ + + + +/** @cond doxygenlibCombineInternal */ + +/* + * Reads the expected attributes into the member data variables + */ +void +CaCrossRef::readAttributes( + const LIBSBML_CPP_NAMESPACE_QUALIFIER XMLAttributes& + attributes, + const LIBSBML_CPP_NAMESPACE_QUALIFIER + ExpectedAttributes& expectedAttributes) +{ + unsigned int level = getLevel(); + unsigned int version = getVersion(); + unsigned int numErrs; + bool assigned = false; + CaErrorLog* log = getErrorLog(); + + if (log && getParentCaObject() && + static_cast(getParentCaObject())->size() < 2) + { + numErrs = log->getNumErrors(); + for (int n = numErrs-1; n >= 0; n--) + { + if (log->getError(n)->getErrorId() == CaUnknownCoreAttribute) + { + const std::string details = log->getError(n)->getMessage(); + log->remove(CaUnknownCoreAttribute); + log->logError(CaUnknown, level, version, details); + } + } + } + + CaBase::readAttributes(attributes, expectedAttributes); + + if (log) + { + numErrs = log->getNumErrors(); + + for (int n = numErrs-1; n >= 0; n--) + { + if (log->getError(n)->getErrorId() == CaUnknownCoreAttribute) + { + const std::string details = log->getError(n)->getMessage(); + log->remove(CaUnknownCoreAttribute); + log->logError(CombineCrossRefAllowedAttributes, level, version, + details, getLine(), getColumn()); + } + } + } + + // + // location string (use = "required" ) + // + + assigned = attributes.readInto("location", mLocation); + + if (assigned == true) + { + if (mLocation.empty() == true) + { + logEmptyString(mLocation, level, version, ""); + } + } + else + { + std::string message = "Combine attribute 'location' is missing from the " + " element."; + log->logError(CombineCrossRefAllowedAttributes, level, version, message); + } +} + +/** @endcond */ + + + +/** @cond doxygenlibCombineInternal */ + +/* + * Writes the attributes to the stream + */ +void +CaCrossRef::writeAttributes(LIBSBML_CPP_NAMESPACE_QUALIFIER XMLOutputStream& + stream) const +{ + CaBase::writeAttributes(stream); + + if (isSetLocation() == true) + { + stream.writeAttribute("location", getPrefix(), mLocation); + } +} + +/** @endcond */ + + + + +#endif /* __cplusplus */ + + +/* + * Creates a new CaCrossRef_t instance. + */ +LIBCOMBINE_EXTERN +CaCrossRef_t * +CaCrossRef_create() +{ + return new CaCrossRef(); +} + + +/* + * Creates and returns a deep copy of this CaCrossRef_t object. + */ +LIBCOMBINE_EXTERN +CaCrossRef_t* +CaCrossRef_clone(const CaCrossRef_t* ccr) +{ + if (ccr != NULL) + { + return static_cast(ccr->clone()); + } + else + { + return NULL; + } +} + + +/* + * Frees this CaCrossRef_t object. + */ +LIBCOMBINE_EXTERN +void +CaCrossRef_free(CaCrossRef_t* ccr) +{ + if (ccr != NULL) + { + delete ccr; + } +} + + +/* + * Returns the value of the "location" attribute of this CaCrossRef_t. + */ +LIBCOMBINE_EXTERN +char * +CaCrossRef_getLocation(const CaCrossRef_t * ccr) +{ + if (ccr == NULL) + { + return NULL; + } + + return ccr->getLocation().empty() ? NULL : + safe_strdup(ccr->getLocation().c_str()); +} + + +/* + * Predicate returning @c 1 (true) if this CaCrossRef_t's "location" attribute + * is set. + */ +LIBCOMBINE_EXTERN +int +CaCrossRef_isSetLocation(const CaCrossRef_t * ccr) +{ + return (ccr != NULL) ? static_cast(ccr->isSetLocation()) : 0; +} + + +/* + * Sets the value of the "location" attribute of this CaCrossRef_t. + */ +LIBCOMBINE_EXTERN +int +CaCrossRef_setLocation(CaCrossRef_t * ccr, const char * location) +{ + return (ccr != NULL) ? ccr->setLocation(location) : + LIBCOMBINE_INVALID_OBJECT; +} + + +/* + * Unsets the value of the "location" attribute of this CaCrossRef_t. + */ +LIBCOMBINE_EXTERN +int +CaCrossRef_unsetLocation(CaCrossRef_t * ccr) +{ + return (ccr != NULL) ? ccr->unsetLocation() : LIBCOMBINE_INVALID_OBJECT; +} + + +/* + * Predicate returning @c 1 (true) if all the required attributes for this + * CaCrossRef_t object have been set. + */ +LIBCOMBINE_EXTERN +int +CaCrossRef_hasRequiredAttributes(const CaCrossRef_t * ccr) +{ + return (ccr != NULL) ? static_cast(ccr->hasRequiredAttributes()) : 0; +} + + + + +LIBCOMBINE_CPP_NAMESPACE_END + + diff --git a/src/omex/CaCrossRef.h b/src/omex/CaCrossRef.h new file mode 100644 index 0000000..7d264ea --- /dev/null +++ b/src/omex/CaCrossRef.h @@ -0,0 +1,694 @@ +/** + * @file CaCrossRef.h + * @brief Definition of the CaCrossRef class. + * @author DEVISER + * + * + * + * @class CaCrossRef + * @sbmlbrief{combine} TODO:Definition of the CaCrossRef class. + */ + + +#ifndef CaCrossRef_H__ +#define CaCrossRef_H__ + + +#include +#include + + +#ifdef __cplusplus + + +#include + + +#include +#include + + +LIBCOMBINE_CPP_NAMESPACE_BEGIN + + +class LIBCOMBINE_EXTERN CaCrossRef : public CaBase +{ +protected: + + /** @cond doxygenlibCombineInternal */ + + std::string mLocation; + + /** @endcond */ + +public: + + /** + * Creates a new CaCrossRef instance. + */ + CaCrossRef(); + + + /** + * Creates a new CaCrossRef using the given CaNamespaces object @p omexns. + * + * @param omexns the CaNamespaces object. + * + * @copydetails doc_note_setting_lv_pkg + */ + CaCrossRef(CaNamespaces *omexns); + + + /** + * Copy constructor for CaCrossRef. + * + * @param orig the CaCrossRef instance to copy. + */ + CaCrossRef(const CaCrossRef& orig); + + + /** + * Assignment operator for CaCrossRef. + * + * @param rhs the CaCrossRef object whose values are to be used as the basis + * of the assignment. + */ + CaCrossRef& operator=(const CaCrossRef& rhs); + + + /** + * Creates and returns a deep copy of this CaCrossRef object. + * + * @return a (deep) copy of this CaCrossRef object. + */ + virtual CaCrossRef* clone() const; + + + /** + * Destructor for CaCrossRef. + */ + virtual ~CaCrossRef(); + + + /** + * Returns the value of the "location" attribute of this CaCrossRef. + * + * @return the value of the "location" attribute of this CaCrossRef as a + * string. + */ + const std::string& getLocation() const; + + + /** + * Predicate returning @c true if this CaCrossRef's "location" attribute is + * set. + * + * @return @c true if this CaCrossRef's "location" attribute has been set, + * otherwise @c false is returned. + */ + bool isSetLocation() const; + + + /** + * Sets the value of the "location" attribute of this CaCrossRef. + * + * @param location std::string& value of the "location" attribute to be set. + * + * @copydetails doc_returns_one_success_code + * @li @omexconstant{LIBCOMBINE_OPERATION_SUCCESS, OperationReturnValues_t} + * + * Calling this function with @p location = @c NULL or an empty string is + * equivalent to calling unsetLocation(). + */ + int setLocation(const std::string& location); + + + /** + * Unsets the value of the "location" attribute of this CaCrossRef. + * + * @copydetails doc_returns_success_code + * @li @omexconstant{LIBCOMBINE_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @omexconstant{LIBCOMBINE_OPERATION_FAILED, OperationReturnValues_t} + */ + int unsetLocation(); + + + /** + * Returns the XML element name of this CaCrossRef object. + * + * For CaCrossRef, the XML element name is always @c "crossRef". + * + * @return the name of this element, i.e. @c "crossRef". + */ + virtual const std::string& getElementName() const; + + + /** + * Returns the libCombine type code for this CaCrossRef object. + * + * @copydetails doc_what_are_typecodes + * + * @return the OMEX type code for this object: + * @omexconstant{LIB_COMBINE_CROSSREF, CaTypeCode_t}. + * + * @copydetails doc_warning_typecodes_not_unique + * + * @see getElementName() + */ + virtual int getTypeCode() const; + + + /** + * Predicate returning @c true if all the required attributes for this + * CaCrossRef object have been set. + * + * @return @c true to indicate that all the required attributes of this + * CaCrossRef have been set, otherwise @c false is returned. + * + * + * @note The required attributes for the CaCrossRef object are: + * @li "location" + */ + virtual bool hasRequiredAttributes() const; + + + + /** @cond doxygenlibCombineInternal */ + + /** + * Write any contained elements + */ + virtual void writeElements(LIBSBML_CPP_NAMESPACE_QUALIFIER XMLOutputStream& + stream) const; + + /** @endcond */ + + + + /** @cond doxygenlibCombineInternal */ + + /** + * Accepts the given CaVisitor + */ + virtual bool accept(CaVisitor& v) const; + + /** @endcond */ + + + + /** @cond doxygenlibCombineInternal */ + + /** + * Sets the parent CaOmexManifest + */ + virtual void setCaOmexManifest(CaOmexManifest* d); + + /** @endcond */ + + + + + #ifndef SWIG + + + + /** @cond doxygenlibCombineInternal */ + + /** + * Gets the value of the "attributeName" attribute of this CaCrossRef. + * + * @param attributeName, the name of the attribute to retrieve. + * + * @param value, the address of the value to record. + * + * @copydetails doc_returns_success_code + * @li @omexconstant{LIBCOMBINE_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @omexconstant{LIBCOMBINE_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int getAttribute(const std::string& attributeName, bool& value) + const; + + /** @endcond */ + + + + /** @cond doxygenlibCombineInternal */ + + /** + * Gets the value of the "attributeName" attribute of this CaCrossRef. + * + * @param attributeName, the name of the attribute to retrieve. + * + * @param value, the address of the value to record. + * + * @copydetails doc_returns_success_code + * @li @omexconstant{LIBCOMBINE_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @omexconstant{LIBCOMBINE_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int getAttribute(const std::string& attributeName, int& value) const; + + /** @endcond */ + + + + /** @cond doxygenlibCombineInternal */ + + /** + * Gets the value of the "attributeName" attribute of this CaCrossRef. + * + * @param attributeName, the name of the attribute to retrieve. + * + * @param value, the address of the value to record. + * + * @copydetails doc_returns_success_code + * @li @omexconstant{LIBCOMBINE_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @omexconstant{LIBCOMBINE_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int getAttribute(const std::string& attributeName, + double& value) const; + + /** @endcond */ + + + + /** @cond doxygenlibCombineInternal */ + + /** + * Gets the value of the "attributeName" attribute of this CaCrossRef. + * + * @param attributeName, the name of the attribute to retrieve. + * + * @param value, the address of the value to record. + * + * @copydetails doc_returns_success_code + * @li @omexconstant{LIBCOMBINE_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @omexconstant{LIBCOMBINE_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int getAttribute(const std::string& attributeName, + unsigned int& value) const; + + /** @endcond */ + + + + /** @cond doxygenlibCombineInternal */ + + /** + * Gets the value of the "attributeName" attribute of this CaCrossRef. + * + * @param attributeName, the name of the attribute to retrieve. + * + * @param value, the address of the value to record. + * + * @copydetails doc_returns_success_code + * @li @omexconstant{LIBCOMBINE_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @omexconstant{LIBCOMBINE_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int getAttribute(const std::string& attributeName, + std::string& value) const; + + /** @endcond */ + + + + /** @cond doxygenlibCombineInternal */ + + /** + * Predicate returning @c true if this CaCrossRef's attribute "attributeName" + * is set. + * + * @param attributeName, the name of the attribute to query. + * + * @return @c true if this CaCrossRef's attribute "attributeName" has been + * set, otherwise @c false is returned. + */ + virtual bool isSetAttribute(const std::string& attributeName) const; + + /** @endcond */ + + + + /** @cond doxygenlibCombineInternal */ + + /** + * Sets the value of the "attributeName" attribute of this CaCrossRef. + * + * @param attributeName, the name of the attribute to set. + * + * @param value, the value of the attribute to set. + * + * @copydetails doc_returns_success_code + * @li @omexconstant{LIBCOMBINE_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @omexconstant{LIBCOMBINE_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int setAttribute(const std::string& attributeName, bool value); + + /** @endcond */ + + + + /** @cond doxygenlibCombineInternal */ + + /** + * Sets the value of the "attributeName" attribute of this CaCrossRef. + * + * @param attributeName, the name of the attribute to set. + * + * @param value, the value of the attribute to set. + * + * @copydetails doc_returns_success_code + * @li @omexconstant{LIBCOMBINE_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @omexconstant{LIBCOMBINE_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int setAttribute(const std::string& attributeName, int value); + + /** @endcond */ + + + + /** @cond doxygenlibCombineInternal */ + + /** + * Sets the value of the "attributeName" attribute of this CaCrossRef. + * + * @param attributeName, the name of the attribute to set. + * + * @param value, the value of the attribute to set. + * + * @copydetails doc_returns_success_code + * @li @omexconstant{LIBCOMBINE_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @omexconstant{LIBCOMBINE_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int setAttribute(const std::string& attributeName, double value); + + /** @endcond */ + + + + /** @cond doxygenlibCombineInternal */ + + /** + * Sets the value of the "attributeName" attribute of this CaCrossRef. + * + * @param attributeName, the name of the attribute to set. + * + * @param value, the value of the attribute to set. + * + * @copydetails doc_returns_success_code + * @li @omexconstant{LIBCOMBINE_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @omexconstant{LIBCOMBINE_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int setAttribute(const std::string& attributeName, + unsigned int value); + + /** @endcond */ + + + + /** @cond doxygenlibCombineInternal */ + + /** + * Sets the value of the "attributeName" attribute of this CaCrossRef. + * + * @param attributeName, the name of the attribute to set. + * + * @param value, the value of the attribute to set. + * + * @copydetails doc_returns_success_code + * @li @omexconstant{LIBCOMBINE_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @omexconstant{LIBCOMBINE_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int setAttribute(const std::string& attributeName, + const std::string& value); + + /** @endcond */ + + + + /** @cond doxygenlibCombineInternal */ + + /** + * Unsets the value of the "attributeName" attribute of this CaCrossRef. + * + * @param attributeName, the name of the attribute to query. + * + * @copydetails doc_returns_success_code + * @li @omexconstant{LIBCOMBINE_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @omexconstant{LIBCOMBINE_OPERATION_FAILED, OperationReturnValues_t} + */ + virtual int unsetAttribute(const std::string& attributeName); + + /** @endcond */ + + + + + #endif /* !SWIG */ + + +protected: + + + /** @cond doxygenlibCombineInternal */ + + /** + * Adds the expected attributes for this element + */ + virtual void addExpectedAttributes(LIBSBML_CPP_NAMESPACE_QUALIFIER + ExpectedAttributes& attributes); + + /** @endcond */ + + + + /** @cond doxygenlibCombineInternal */ + + /** + * Reads the expected attributes into the member data variables + */ + virtual void readAttributes( + const LIBSBML_CPP_NAMESPACE_QUALIFIER + XMLAttributes& attributes, + const LIBSBML_CPP_NAMESPACE_QUALIFIER + ExpectedAttributes& expectedAttributes); + + /** @endcond */ + + + + /** @cond doxygenlibCombineInternal */ + + /** + * Writes the attributes to the stream + */ + virtual void writeAttributes(LIBSBML_CPP_NAMESPACE_QUALIFIER XMLOutputStream& + stream) const; + + /** @endcond */ + + +}; + + + +LIBCOMBINE_CPP_NAMESPACE_END + + + + +#endif /* __cplusplus */ + + + + +#ifndef SWIG + + + + +LIBCOMBINE_CPP_NAMESPACE_BEGIN + + + + +BEGIN_C_DECLS + + +/** + * Creates a new CaCrossRef_t instance. + * + * @memberof CaCrossRef_t + */ +LIBCOMBINE_EXTERN +CaCrossRef_t * +CaCrossRef_create(); + + +/** + * Creates and returns a deep copy of this CaCrossRef_t object. + * + * @param ccr the CaCrossRef_t structure. + * + * @return a (deep) copy of this CaCrossRef_t object. + * + * @copydetails doc_returned_owned_pointer + * + * @memberof CaCrossRef_t + */ +LIBCOMBINE_EXTERN +CaCrossRef_t* +CaCrossRef_clone(const CaCrossRef_t* ccr); + + +/** + * Frees this CaCrossRef_t object. + * + * @param ccr the CaCrossRef_t structure. + * + * @memberof CaCrossRef_t + */ +LIBCOMBINE_EXTERN +void +CaCrossRef_free(CaCrossRef_t* ccr); + + +/** + * Returns the value of the "location" attribute of this CaCrossRef_t. + * + * @param ccr the CaCrossRef_t structure whose location is sought. + * + * @return the value of the "location" attribute of this CaCrossRef_t as a + * pointer to a string. + * + * @copydetails doc_returned_owned_char + * + * @memberof CaCrossRef_t + */ +LIBCOMBINE_EXTERN +char * +CaCrossRef_getLocation(const CaCrossRef_t * ccr); + + +/** + * Predicate returning @c 1 (true) if this CaCrossRef_t's "location" attribute + * is set. + * + * @param ccr the CaCrossRef_t structure. + * + * @return @c 1 (true) if this CaCrossRef_t's "location" attribute has been + * set, otherwise @c 0 (false) is returned. + * + * @memberof CaCrossRef_t + */ +LIBCOMBINE_EXTERN +int +CaCrossRef_isSetLocation(const CaCrossRef_t * ccr); + + +/** + * Sets the value of the "location" attribute of this CaCrossRef_t. + * + * @param ccr the CaCrossRef_t structure. + * + * @param location const char * value of the "location" attribute to be set. + * + * @copydetails doc_returns_success_code + * @li @omexconstant{LIBCOMBINE_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @omexconstant{LIBCOMBINE_INVALID_OBJECT, OperationReturnValues_t} + * + * Calling this function with @p location = @c NULL or an empty string is + * equivalent to calling CaCrossRef_unsetLocation(). + * + * @memberof CaCrossRef_t + */ +LIBCOMBINE_EXTERN +int +CaCrossRef_setLocation(CaCrossRef_t * ccr, const char * location); + + +/** + * Unsets the value of the "location" attribute of this CaCrossRef_t. + * + * @param ccr the CaCrossRef_t structure. + * + * @copydetails doc_returns_success_code + * @li @omexconstant{LIBCOMBINE_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @omexconstant{LIBCOMBINE_OPERATION_FAILED, OperationReturnValues_t} + * @li @omexconstant{LIBCOMBINE_INVALID_OBJECT, OperationReturnValues_t} + * + * @memberof CaCrossRef_t + */ +LIBCOMBINE_EXTERN +int +CaCrossRef_unsetLocation(CaCrossRef_t * ccr); + + +/** + * Predicate returning @c 1 (true) if all the required attributes for this + * CaCrossRef_t object have been set. + * + * @param ccr the CaCrossRef_t structure. + * + * @return @c 1 (true) to indicate that all the required attributes of this + * CaCrossRef_t have been set, otherwise @c 0 (false) is returned. + * + * + * @note The required attributes for the CaCrossRef_t object are: + * @li "location" + * + * @memberof CaCrossRef_t + */ +LIBCOMBINE_EXTERN +int +CaCrossRef_hasRequiredAttributes(const CaCrossRef_t * ccr); + + + + +END_C_DECLS + + + + +LIBCOMBINE_CPP_NAMESPACE_END + + + + +#endif /* !SWIG */ + + + + +#endif /* !CaCrossRef_H__ */ + + diff --git a/src/omex/CaError.cpp b/src/omex/CaError.cpp index cd864b7..477e480 100644 --- a/src/omex/CaError.cpp +++ b/src/omex/CaError.cpp @@ -7,7 +7,11 @@ * This file is part of libSBML. Please visit http://sbml.org for more * information about SBML, and the latest version of libSBML. * - * Copyright (C) 2013-2016 jointly by the following organizations: + * Copyright (C) 2019 jointly by the following organizations: + * 1. California Institute of Technology, Pasadena, CA, USA + * 2. University of Heidelberg, Heidelberg, Germany + * + * Copyright (C) 2013-2018 jointly by the following organizations: * 1. California Institute of Technology, Pasadena, CA, USA * 2. EMBL European Bioinformatics Institute (EMBL-EBI), Hinxton, UK * 3. University of Heidelberg, Heidelberg, Germany @@ -192,7 +196,7 @@ CaError::CaError ( const unsigned int errorId } } - if ( index == 0 && mErrorId != CaUnknownError ) + if ( index == 0 && mErrorId != CaUnknown ) { // The id is in the range of error numbers that are supposed to be in // the OMEX layer, but it's NOT in our table. This is an internal error. diff --git a/src/omex/CaError.h b/src/omex/CaError.h index 5dbb629..6926dc0 100644 --- a/src/omex/CaError.h +++ b/src/omex/CaError.h @@ -7,7 +7,11 @@ * This file is part of libSBML. Please visit http://sbml.org for more * information about SBML, and the latest version of libSBML. * - * Copyright (C) 2013-2016 jointly by the following organizations: + * Copyright (C) 2019 jointly by the following organizations: + * 1. California Institute of Technology, Pasadena, CA, USA + * 2. University of Heidelberg, Heidelberg, Germany + * + * Copyright (C) 2013-2018 jointly by the following organizations: * 1. California Institute of Technology, Pasadena, CA, USA * 2. EMBL European Bioinformatics Institute (EMBL-EBI), Hinxton, UK * 3. University of Heidelberg, Heidelberg, Germany @@ -49,7 +53,7 @@ BEGIN_C_DECLS */ typedef enum { - CaUnknownError = 10000 /*!< Encountered unknown internal libCombine error. */ + CaUnknown = 10000 /*!< Encountered unknown internal libCombine error. */ , CaNotUTF8 = 10001 /*!< File does not use UTF-8 encoding. */ , CaUnrecognizedElement = 10002 /*!< Encountered unrecognized element. */ , CaNotSchemaConformant = 10003 /*!< Document does not conform to the OMEX XML schema. */ @@ -72,17 +76,20 @@ typedef enum , InvalidNamespaceOnCa = 20101 , AllowedAttributes = 20102 , CaEmptyListElement = 20103 -, CombineCaContentAllowedCoreAttributes = 20201 -, CombineCaContentAllowedCoreElements = 20202 -, CombineCaContentAllowedAttributes = 20203 -, CombineCaContentLocationMustBeString = 20204 -, CombineCaContentFormatMustBeString = 20205 -, CombineCaContentMasterMustBeBoolean = 20206 -, CombineCaOmexManifestAllowedCoreAttributes = 20301 -, CombineCaOmexManifestAllowedCoreElements = 20302 -, CombineCaOmexManifestAllowedElements = 20303 -, CombineCaOmexManifestLOContentsAllowedCoreElements = 20304 -, CombineCaOmexManifestLOContentsAllowedCoreAttributes = 20305 +, CombineContentAllowedCoreAttributes = 20201 +, CombineContentAllowedCoreElements = 20202 +, CombineContentAllowedAttributes = 20203 +, CombineContentAllowedElements = 20204 +, CombineContentLocationMustBeString = 20205 +, CombineContentFormatMustBeString = 20206 +, CombineContentMasterMustBeBoolean = 20207 +, CombineOmexManifestAllowedCoreAttributes = 20301 +, CombineOmexManifestAllowedCoreElements = 20302 +, CombineOmexManifestAllowedElements = 20303 +, CombineCrossRefAllowedCoreAttributes = 20401 +, CombineCrossRefAllowedCoreElements = 20402 +, CombineCrossRefAllowedAttributes = 20403 +, CombineCrossRefLocationMustBeString = 20404 , CaUnknownCoreAttribute = 99994 /*!< Encountered an unknown attribute in the OMEX Core namespace. */ , CaCodesUpperBound = 99999 /*!< Upper boundary of libCombine-specific diagnostic codes. */ } CaErrorCode_t; diff --git a/src/omex/CaErrorLog.cpp b/src/omex/CaErrorLog.cpp index a340652..53e4db2 100644 --- a/src/omex/CaErrorLog.cpp +++ b/src/omex/CaErrorLog.cpp @@ -7,7 +7,11 @@ * This file is part of libSBML. Please visit http://sbml.org for more * information about SBML, and the latest version of libSBML. * - * Copyright (C) 2013-2016 jointly by the following organizations: + * Copyright (C) 2019 jointly by the following organizations: + * 1. California Institute of Technology, Pasadena, CA, USA + * 2. University of Heidelberg, Heidelberg, Germany + * + * Copyright (C) 2013-2018 jointly by the following organizations: * 1. California Institute of Technology, Pasadena, CA, USA * 2. EMBL European Bioinformatics Institute (EMBL-EBI), Hinxton, UK * 3. University of Heidelberg, Heidelberg, Germany diff --git a/src/omex/CaErrorLog.h b/src/omex/CaErrorLog.h index de2c540..b898292 100644 --- a/src/omex/CaErrorLog.h +++ b/src/omex/CaErrorLog.h @@ -7,7 +7,11 @@ * This file is part of libSBML. Please visit http://sbml.org for more * information about SBML, and the latest version of libSBML. * - * Copyright (C) 2013-2016 jointly by the following organizations: + * Copyright (C) 2019 jointly by the following organizations: + * 1. California Institute of Technology, Pasadena, CA, USA + * 2. University of Heidelberg, Heidelberg, Germany + * + * Copyright (C) 2013-2018 jointly by the following organizations: * 1. California Institute of Technology, Pasadena, CA, USA * 2. EMBL European Bioinformatics Institute (EMBL-EBI), Hinxton, UK * 3. University of Heidelberg, Heidelberg, Germany @@ -30,7 +34,7 @@ * available online as http://sbml.org/software/libsbml/license.html * ------------------------------------------------------------------------ --> * - * @class + * @class CaErrorLog * @sbmlbrief{} TODO:Definition of the CaErrorLog class. */ diff --git a/src/omex/CaErrorTable.h b/src/omex/CaErrorTable.h index c799148..d31aaee 100644 --- a/src/omex/CaErrorTable.h +++ b/src/omex/CaErrorTable.h @@ -7,7 +7,11 @@ * This file is part of libSBML. Please visit http://sbml.org for more * information about SBML, and the latest version of libSBML. * - * Copyright (C) 2013-2016 jointly by the following organizations: + * Copyright (C) 2019 jointly by the following organizations: + * 1. California Institute of Technology, Pasadena, CA, USA + * 2. University of Heidelberg, Heidelberg, Germany + * + * Copyright (C) 2013-2018 jointly by the following organizations: * 1. California Institute of Technology, Pasadena, CA, USA * 2. EMBL European Bioinformatics Institute (EMBL-EBI), Hinxton, UK * 3. University of Heidelberg, Heidelberg, Germany @@ -59,7 +63,7 @@ typedef struct { static const omexErrorTableEntry omexErrorTable[] = { // 10000 - { CaUnknownError, + { CaUnknown, "Encountered unknown internal libCombine error", LIBCOMBINE_CAT_INTERNAL, LIBCOMBINE_SEV_FATAL, @@ -325,7 +329,7 @@ static const omexErrorTableEntry omexErrorTable[] = }, // 20201 - { CombineCaContentAllowedCoreAttributes, + { CombineContentAllowedCoreAttributes, "Core attributes allowed on .", LIBCOMBINE_CAT_GENERAL_CONSISTENCY, LIBCOMBINE_SEV_ERROR, @@ -337,7 +341,7 @@ static const omexErrorTableEntry omexErrorTable[] = }, // 20202 - { CombineCaContentAllowedCoreElements, + { CombineContentAllowedCoreElements, "Core elements allowed on .", LIBCOMBINE_CAT_GENERAL_CONSISTENCY, LIBCOMBINE_SEV_ERROR, @@ -349,7 +353,7 @@ static const omexErrorTableEntry omexErrorTable[] = }, // 20203 - { CombineCaContentAllowedAttributes, + { CombineContentAllowedAttributes, "Attributes allowed on .", LIBCOMBINE_CAT_GENERAL_CONSISTENCY, LIBCOMBINE_SEV_ERROR, @@ -362,8 +366,20 @@ static const omexErrorTableEntry omexErrorTable[] = }, // 20204 - { CombineCaContentLocationMustBeString, - "Location attribute must be String.", + { CombineContentAllowedElements, + "Elements allowed on .", + LIBCOMBINE_CAT_GENERAL_CONSISTENCY, + LIBCOMBINE_SEV_ERROR, + "A object may contain one and only one instance of the " + " element. No other elements from the SBML Level 3 Combine " + "Archive namespaces are permitted on a object. ", + { "L3V1 Combine V1 Section" + } + }, + + // 20205 + { CombineContentLocationMustBeString, + "The 'location' attribute must be String.", LIBCOMBINE_CAT_GENERAL_CONSISTENCY, LIBCOMBINE_SEV_ERROR, "The attribute 'combine:location' on a must have a value of data " @@ -372,9 +388,9 @@ static const omexErrorTableEntry omexErrorTable[] = } }, - // 20205 - { CombineCaContentFormatMustBeString, - "Format attribute must be String.", + // 20206 + { CombineContentFormatMustBeString, + "The 'format' attribute must be String.", LIBCOMBINE_CAT_GENERAL_CONSISTENCY, LIBCOMBINE_SEV_ERROR, "The attribute 'combine:format' on a must have a value of data " @@ -383,9 +399,9 @@ static const omexErrorTableEntry omexErrorTable[] = } }, - // 20206 - { CombineCaContentMasterMustBeBoolean, - "Master attribute must be Boolean.", + // 20207 + { CombineContentMasterMustBeBoolean, + "The 'master' attribute must be Boolean.", LIBCOMBINE_CAT_GENERAL_CONSISTENCY, LIBCOMBINE_SEV_ERROR, "The attribute 'combine:master' on a must have a value of data " @@ -395,7 +411,7 @@ static const omexErrorTableEntry omexErrorTable[] = }, // 20301 - { CombineCaOmexManifestAllowedCoreAttributes, + { CombineOmexManifestAllowedCoreAttributes, "Core attributes allowed on .", LIBCOMBINE_CAT_GENERAL_CONSISTENCY, LIBCOMBINE_SEV_ERROR, @@ -407,7 +423,7 @@ static const omexErrorTableEntry omexErrorTable[] = }, // 20302 - { CombineCaOmexManifestAllowedCoreElements, + { CombineOmexManifestAllowedCoreElements, "Core elements allowed on .", LIBCOMBINE_CAT_GENERAL_CONSISTENCY, LIBCOMBINE_SEV_ERROR, @@ -419,7 +435,7 @@ static const omexErrorTableEntry omexErrorTable[] = }, // 20303 - { CombineCaOmexManifestAllowedElements, + { CombineOmexManifestAllowedElements, "Elements allowed on .", LIBCOMBINE_CAT_GENERAL_CONSISTENCY, LIBCOMBINE_SEV_ERROR, @@ -430,26 +446,49 @@ static const omexErrorTableEntry omexErrorTable[] = } }, - // 20304 - { CombineCaOmexManifestLOContentsAllowedCoreElements, - "Core elements allowed on .", + // 20401 + { CombineCrossRefAllowedCoreAttributes, + "Core attributes allowed on .", LIBCOMBINE_CAT_GENERAL_CONSISTENCY, LIBCOMBINE_SEV_ERROR, - "Apart from the general notes and annotations subobjects permitted on all " - "SBML objects, a container object may only contain " - " objects.", + "A object may have the optional SBML Level 3 Core attributes " + "'metaid' and 'sboTerm'. No other attributes from the SBML Level 3 Core " + "namespaces are permitted on a .", { "L3V1 Combine V1 Section" } }, - // 20305 - { CombineCaOmexManifestLOContentsAllowedCoreAttributes, - "Core attributes allowed on .", + // 20402 + { CombineCrossRefAllowedCoreElements, + "Core elements allowed on .", LIBCOMBINE_CAT_GENERAL_CONSISTENCY, LIBCOMBINE_SEV_ERROR, - "A object may have the optional SBML Level 3 Core " - "attributes 'metaid' and 'sboTerm'. No other attributes from the SBML Level " - "3 Core namespaces are permitted on a object.", + "A object may have the optional SBML Level 3 Core subobjects for " + "notes and annotations. No other elements from the SBML Level 3 Core " + "namespaces are permitted on a .", + { "L3V1 Combine V1 Section" + } + }, + + // 20403 + { CombineCrossRefAllowedAttributes, + "Attributes allowed on .", + LIBCOMBINE_CAT_GENERAL_CONSISTENCY, + LIBCOMBINE_SEV_ERROR, + "A object may have the optional attribute 'combine:location'. No " + "other attributes from the SBML Level 3 Combine Archive namespaces are " + "permitted on a object. ", + { "L3V1 Combine V1 Section" + } + }, + + // 20404 + { CombineCrossRefLocationMustBeString, + "The 'location' attribute must be String.", + LIBCOMBINE_CAT_GENERAL_CONSISTENCY, + LIBCOMBINE_SEV_ERROR, + "The attribute 'combine:location' on a must have a value of data " + "type 'string'.", { "L3V1 Combine V1 Section" } }, diff --git a/src/omex/CaListOfContents.cpp b/src/omex/CaListOfContents.cpp index 983d9c5..b96a5ca 100644 --- a/src/omex/CaListOfContents.cpp +++ b/src/omex/CaListOfContents.cpp @@ -7,7 +7,11 @@ * This file is part of libSBML. Please visit http://sbml.org for more * information about SBML, and the latest version of libSBML. * - * Copyright (C) 2013-2016 jointly by the following organizations: + * Copyright (C) 2019 jointly by the following organizations: + * 1. California Institute of Technology, Pasadena, CA, USA + * 2. University of Heidelberg, Heidelberg, Germany + * + * Copyright (C) 2013-2018 jointly by the following organizations: * 1. California Institute of Technology, Pasadena, CA, USA * 2. EMBL European Bioinformatics Institute (EMBL-EBI), Hinxton, UK * 3. University of Heidelberg, Heidelberg, Germany @@ -350,7 +354,7 @@ CaListOfContents::writeXMLNS(LIBSBML_CPP_NAMESPACE_QUALIFIER XMLOutputStream& * Get a CaContent_t from the CaListOf_t. */ LIBCOMBINE_EXTERN -const CaContent_t* +CaContent_t* CaListOfContents_getContent(CaListOf_t* clo, unsigned int n) { if (clo == NULL) @@ -366,7 +370,7 @@ CaListOfContents_getContent(CaListOf_t* clo, unsigned int n) * Get a CaContent_t from the CaListOf_t based on its identifier. */ LIBCOMBINE_EXTERN -const CaContent_t* +CaContent_t* CaListOfContents_getById(CaListOf_t* clo, const char *sid) { if (clo == NULL) diff --git a/src/omex/CaListOfContents.h b/src/omex/CaListOfContents.h index c87f68c..b92a6fc 100644 --- a/src/omex/CaListOfContents.h +++ b/src/omex/CaListOfContents.h @@ -7,7 +7,11 @@ * This file is part of libSBML. Please visit http://sbml.org for more * information about SBML, and the latest version of libSBML. * - * Copyright (C) 2013-2016 jointly by the following organizations: + * Copyright (C) 2019 jointly by the following organizations: + * 1. California Institute of Technology, Pasadena, CA, USA + * 2. University of Heidelberg, Heidelberg, Germany + * + * Copyright (C) 2013-2018 jointly by the following organizations: * 1. California Institute of Technology, Pasadena, CA, USA * 2. EMBL European Bioinformatics Institute (EMBL-EBI), Hinxton, UK * 3. University of Heidelberg, Heidelberg, Germany @@ -74,11 +78,7 @@ class LIBCOMBINE_EXTERN CaListOfContents : public CaListOf * * @param omexns the CaNamespaces object. * - * @throws OMEXConstructorException - * Thrown if the given @p level and @p version combination, or this kind of - * OMEX object, are either invalid or mismatched with respect to the parent - * CaOmexManifest object. - * @copydetails doc_note_setting_lv + * @copydetails doc_note_setting_lv_pkg */ CaListOfContents(CaNamespaces *omexns); @@ -122,7 +122,14 @@ class LIBCOMBINE_EXTERN CaListOfContents : public CaListOf * * @return the nth CaContent in this CaListOfContents. * - * @see size() + * @copydetails doc_returned_unowned_pointer + * + * @see addContent(const CaContent* object) + * @see createContent() + * @see get(const std::string& sid) + * @see getNumContents() + * @see remove(const std::string& sid) + * @see remove(unsigned int n) */ virtual CaContent* get(unsigned int n); @@ -135,7 +142,14 @@ class LIBCOMBINE_EXTERN CaListOfContents : public CaListOf * * @return the nth CaContent in this CaListOfContents. * - * @see size() + * @copydetails doc_returned_unowned_pointer + * + * @see addContent(const CaContent* object) + * @see createContent() + * @see get(const std::string& sid) + * @see getNumContents() + * @see remove(const std::string& sid) + * @see remove(unsigned int n) */ virtual const CaContent* get(unsigned int n) const; @@ -146,10 +160,17 @@ class LIBCOMBINE_EXTERN CaListOfContents : public CaListOf * @param sid a string representing the identifier of the CaContent to * retrieve. * - * @return the CaContent in this CaListOfContents with the given id or NULL - * if no such CaContent exists. + * @return the CaContent in this CaListOfContents with the given @p sid or + * @c NULL if no such CaContent exists. + * + * @copydetails doc_returned_unowned_pointer * - * @see size() + * @see addContent(const CaContent* object) + * @see createContent() + * @see get(unsigned int n) + * @see getNumContents() + * @see remove(const std::string& sid) + * @see remove(unsigned int n) */ virtual CaContent* get(const std::string& sid); @@ -160,10 +181,17 @@ class LIBCOMBINE_EXTERN CaListOfContents : public CaListOf * @param sid a string representing the identifier of the CaContent to * retrieve. * - * @return the CaContent in this CaListOfContents with the given id or NULL - * if no such CaContent exists. + * @return the CaContent in this CaListOfContents with the given @p sid or + * @c NULL if no such CaContent exists. + * + * @copydetails doc_returned_unowned_pointer * - * @see size() + * @see addContent(const CaContent* object) + * @see createContent() + * @see get(unsigned int n) + * @see getNumContents() + * @see remove(const std::string& sid) + * @see remove(unsigned int n) */ virtual const CaContent* get(const std::string& sid) const; @@ -177,10 +205,14 @@ class LIBCOMBINE_EXTERN CaListOfContents : public CaListOf * * @return a pointer to the nth CaContent in this CaListOfContents. * - * @see size() + * @copydetails doc_returned_owned_pointer * - * @note the caller owns the returned object and is responsible for deleting - * it. + * @see addContent(const CaContent* object) + * @see createContent() + * @see get(const std::string& sid) + * @see get(unsigned int n) + * @see getNumContents() + * @see remove(const std::string& sid) */ virtual CaContent* remove(unsigned int n); @@ -195,8 +227,14 @@ class LIBCOMBINE_EXTERN CaListOfContents : public CaListOf * @return the CaContent in this CaListOfContents based on the identifier or * NULL if no such CaContent exists. * - * @note the caller owns the returned object and is responsible for deleting - * it. + * @copydetails doc_returned_owned_pointer + * + * @see addContent(const CaContent* object) + * @see createContent() + * @see get(const std::string& sid) + * @see get(unsigned int n) + * @see getNumContents() + * @see remove(unsigned int n) */ virtual CaContent* remove(const std::string& sid); @@ -209,10 +247,21 @@ class LIBCOMBINE_EXTERN CaListOfContents : public CaListOf * @copydetails doc_returns_success_code * @li @omexconstant{LIBCOMBINE_OPERATION_SUCCESS, OperationReturnValues_t} * @li @omexconstant{LIBCOMBINE_OPERATION_FAILED, OperationReturnValues_t} + * @li @omexconstant{LIBCOMBINE_INVALID_OBJECT, OperationReturnValues_t} + * @li @omexconstant{LIBCOMBINE_LEVEL_MISMATCH, OperationReturnValues_t} + * @li @omexconstant{LIBCOMBINE_VERSION_MISMATCH, OperationReturnValues_t} + * @li @omexconstant{LIBCOMBINE_PKG_VERSION_MISMATCH, + * OperationReturnValues_t} + * @li @omexconstant{LIBCOMBINE_DUPLICATE_OBJECT_ID, OperationReturnValues_t} * * @copydetails doc_note_object_is_copied * * @see createContent() + * @see get(const std::string& sid) + * @see get(unsigned int n) + * @see getNumContents() + * @see remove(const std::string& sid) + * @see remove(unsigned int n) */ int addContent(const CaContent* cc); @@ -221,6 +270,13 @@ class LIBCOMBINE_EXTERN CaListOfContents : public CaListOf * Get the number of CaContent objects in this CaListOfContents. * * @return the number of CaContent objects in this CaListOfContents. + * + * @see addContent(const CaContent* object) + * @see createContent() + * @see get(const std::string& sid) + * @see get(unsigned int n) + * @see remove(const std::string& sid) + * @see remove(unsigned int n) */ unsigned int getNumContents() const; @@ -231,7 +287,14 @@ class LIBCOMBINE_EXTERN CaListOfContents : public CaListOf * * @return a new CaContent object instance. * - * @see addContent(const CaContent* cc) + * @copydetails doc_returned_unowned_pointer + * + * @see addContent(const CaContent* object) + * @see get(const std::string& sid) + * @see get(unsigned int n) + * @see getNumContents() + * @see remove(const std::string& sid) + * @see remove(unsigned int n) */ CaContent* createContent(); @@ -252,8 +315,7 @@ class LIBCOMBINE_EXTERN CaListOfContents : public CaListOf * @copydetails doc_what_are_typecodes * * @return the OMEX type code for this object: - * - * @omexconstant{OMEX_LIST_OF, OMEXTypeCode_t} + * @omexconstant{OMEX_LIST_OF, CaTypeCode_t}. * * @copydetails doc_warning_typecodes_not_unique */ @@ -268,8 +330,7 @@ class LIBCOMBINE_EXTERN CaListOfContents : public CaListOf * * @return the OMEX typecode for the objects contained in this * CaListOfContents: - * - * @omexconstant{LIB_COMBINE_CONTENT, OMEXCombineTypeCode_t} + * @omexconstant{LIB_COMBINE_CONTENT, CaTypeCode_t}. * * @copydetails doc_warning_typecodes_not_unique * @@ -278,6 +339,16 @@ class LIBCOMBINE_EXTERN CaListOfContents : public CaListOf virtual int getItemTypeCode() const; + + + #ifndef SWIG + + + + + #endif /* !SWIG */ + + protected: @@ -342,10 +413,12 @@ BEGIN_C_DECLS * * @return the nth CaContent_t in this CaListOf_t. * - * @memberof CaContent_t + * @copydetails doc_returned_unowned_pointer + * + * @memberof CaListOfContents_t */ LIBCOMBINE_EXTERN -const CaContent_t* +CaContent_t* CaListOfContents_getContent(CaListOf_t* clo, unsigned int n); @@ -357,13 +430,15 @@ CaListOfContents_getContent(CaListOf_t* clo, unsigned int n); * @param sid a string representing the identifier of the CaContent_t to * retrieve. * - * @return the CaContent_t in this CaListOf_t with the given id or NULL if no - * such CaContent_t exists. + * @return the CaContent_t in this CaListOf_t with the given @p sid or @c NULL + * if no such CaContent_t exists. + * + * @copydetails doc_returned_unowned_pointer * - * @memberof CaContent_t + * @memberof CaListOfContents_t */ LIBCOMBINE_EXTERN -const CaContent_t* +CaContent_t* CaListOfContents_getById(CaListOf_t* clo, const char *sid); @@ -378,7 +453,9 @@ CaListOfContents_getById(CaListOf_t* clo, const char *sid); * * @return a pointer to the nth CaContent_t in this CaListOf_t. * - * @memberof CaContent_t + * @copydetails doc_returned_owned_pointer + * + * @memberof CaListOfContents_t */ LIBCOMBINE_EXTERN CaContent_t* @@ -397,7 +474,9 @@ CaListOfContents_remove(CaListOf_t* clo, unsigned int n); * @return the CaContent_t in this CaListOf_t based on the identifier or NULL * if no such CaContent_t exists. * - * @memberof CaContent_t + * @copydetails doc_returned_owned_pointer + * + * @memberof CaListOfContents_t */ LIBCOMBINE_EXTERN CaContent_t* diff --git a/src/omex/CaListOfCrossRefs.cpp b/src/omex/CaListOfCrossRefs.cpp new file mode 100644 index 0000000..aaf5095 --- /dev/null +++ b/src/omex/CaListOfCrossRefs.cpp @@ -0,0 +1,425 @@ +/** + * @file CaListOfCrossRefs.cpp + * @brief Implementation of the CaListOfCrossRefs class. + * @author DEVISER + * + * + */ +#include +#include + + +using namespace std; + + + +LIBCOMBINE_CPP_NAMESPACE_BEGIN + + + + +#ifdef __cplusplus + + +/* + * Creates a new CaListOfCrossRefs instance. + */ +CaListOfCrossRefs::CaListOfCrossRefs() + : CaListOf(1, 1) +{ +} + + +/* + * Creates a new CaListOfCrossRefs using the given CaNamespaces object @p + * omexns. + */ +CaListOfCrossRefs::CaListOfCrossRefs(CaNamespaces *omexns) + : CaListOf(omexns) +{ + setElementNamespace(omexns->getURI()); +} + + +/* + * Copy constructor for CaListOfCrossRefs. + */ +CaListOfCrossRefs::CaListOfCrossRefs(const CaListOfCrossRefs& orig) + : CaListOf( orig ) +{ +} + + +/* + * Assignment operator for CaListOfCrossRefs. + */ +CaListOfCrossRefs& +CaListOfCrossRefs::operator=(const CaListOfCrossRefs& rhs) +{ + if (&rhs != this) + { + CaListOf::operator=(rhs); + } + + return *this; +} + + +/* + * Creates and returns a deep copy of this CaListOfCrossRefs object. + */ +CaListOfCrossRefs* +CaListOfCrossRefs::clone() const +{ + return new CaListOfCrossRefs(*this); +} + + +/* + * Destructor for CaListOfCrossRefs. + */ +CaListOfCrossRefs::~CaListOfCrossRefs() +{ +} + + +/* + * Get a CaCrossRef from the CaListOfCrossRefs. + */ +CaCrossRef* +CaListOfCrossRefs::get(unsigned int n) +{ + return static_cast(CaListOf::get(n)); +} + + +/* + * Get a CaCrossRef from the CaListOfCrossRefs. + */ +const CaCrossRef* +CaListOfCrossRefs::get(unsigned int n) const +{ + return static_cast(CaListOf::get(n)); +} + + +/* + * Get a CaCrossRef from the CaListOfCrossRefs based on its identifier. + */ +CaCrossRef* +CaListOfCrossRefs::get(const std::string& sid) +{ + return const_cast(static_cast(*this).get(sid)); +} + + +/* + * Get a CaCrossRef from the CaListOfCrossRefs based on its identifier. + */ +const CaCrossRef* +CaListOfCrossRefs::get(const std::string& sid) const +{ + vector::const_iterator result; + result = find_if(mItems.begin(), mItems.end(), CaIdEq(sid)); + return (result == mItems.end()) ? 0 : static_cast + (*result); +} + + +/* + * Removes the nth CaCrossRef from this CaListOfCrossRefs and returns a pointer + * to it. + */ +CaCrossRef* +CaListOfCrossRefs::remove(unsigned int n) +{ + return static_cast(CaListOf::remove(n)); +} + + +/* + * Removes the CaCrossRef from this CaListOfCrossRefs based on its identifier + * and returns a pointer to it. + */ +CaCrossRef* +CaListOfCrossRefs::remove(const std::string& sid) +{ + CaBase* item = NULL; + vector::iterator result; + + result = find_if(mItems.begin(), mItems.end(), CaIdEq(sid)); + + if (result != mItems.end()) + { + item = *result; + mItems.erase(result); + } + + return static_cast (item); +} + + +/* + * Adds a copy of the given CaCrossRef to this CaListOfCrossRefs. + */ +int +CaListOfCrossRefs::addCrossRef(const CaCrossRef* ccr) +{ + if (ccr == NULL) + { + return LIBCOMBINE_OPERATION_FAILED; + } + else if (ccr->hasRequiredAttributes() == false) + { + return LIBCOMBINE_INVALID_OBJECT; + } + else if (getLevel() != ccr->getLevel()) + { + return LIBCOMBINE_LEVEL_MISMATCH; + } + else if (getVersion() != ccr->getVersion()) + { + return LIBCOMBINE_VERSION_MISMATCH; + } + else if (matchesRequiredCaNamespacesForAddition(static_cast(ccr)) == false) + { + return LIBCOMBINE_NAMESPACES_MISMATCH; + } + else + { + return append(ccr); + } +} + + +/* + * Get the number of CaCrossRef objects in this CaListOfCrossRefs. + */ +unsigned int +CaListOfCrossRefs::getNumCrossRefs() const +{ + return size(); +} + + +/* + * Creates a new CaCrossRef object, adds it to this CaListOfCrossRefs object + * and returns the CaCrossRef object created. + */ +CaCrossRef* +CaListOfCrossRefs::createCrossRef() +{ + CaCrossRef* ccr = NULL; + + try + { + ccr = new CaCrossRef(getCaNamespaces()); + } + catch (...) + { + } + + if (ccr != NULL) + { + appendAndOwn(ccr); + } + + return ccr; +} + + +/* + * Returns the XML element name of this CaListOfCrossRefs object. + */ +const std::string& +CaListOfCrossRefs::getElementName() const +{ + static const string name = "listOfCrossRefs"; + return name; +} + + +/* + * Returns the libCombine type code for this CaListOfCrossRefs object. + */ +int +CaListOfCrossRefs::getTypeCode() const +{ + return OMEX_LIST_OF; +} + + +/* + * Returns the libOMEX type code for the OMEX objects contained in this + * CaListOfCrossRefs object. + */ +int +CaListOfCrossRefs::getItemTypeCode() const +{ + return LIB_COMBINE_CROSSREF; +} + + + +/** @cond doxygenlibCombineInternal */ + +/* + * Creates a new CaCrossRef in this CaListOfCrossRefs + */ +CaBase* +CaListOfCrossRefs::createObject(LIBSBML_CPP_NAMESPACE_QUALIFIER XMLInputStream& + stream) +{ + const std::string& name = stream.peek().getName(); + CaBase* object = NULL; + + if (name == "crossRef") + { + object = new CaCrossRef(getCaNamespaces()); + appendAndOwn(object); + } + + return object; +} + +/** @endcond */ + + + +/** @cond doxygenlibCombineInternal */ + +/* + * Writes the namespace for the Combine package + */ +void +CaListOfCrossRefs::writeXMLNS(LIBSBML_CPP_NAMESPACE_QUALIFIER XMLOutputStream& + stream) const +{ + LIBSBML_CPP_NAMESPACE_QUALIFIER XMLNamespaces xmlns; + std::string prefix = getPrefix(); + + if (prefix.empty()) + { + const LIBSBML_CPP_NAMESPACE_QUALIFIER XMLNamespaces* thisxmlns = + getNamespaces(); + if (thisxmlns && thisxmlns->hasURI(OMEX_XMLNS_L1V1)) + { + xmlns.add(OMEX_XMLNS_L1V1, prefix); + } + } + + stream << xmlns; +} + +/** @endcond */ + + + + +#endif /* __cplusplus */ + + +/* + * Get a CaCrossRef_t from the CaListOf_t. + */ +LIBCOMBINE_EXTERN +CaCrossRef_t* +CaListOfCrossRefs_getCrossRef(CaListOf_t* clo, unsigned int n) +{ + if (clo == NULL) + { + return NULL; + } + + return static_cast (clo)->get(n); +} + + +/* + * Get a CaCrossRef_t from the CaListOf_t based on its identifier. + */ +LIBCOMBINE_EXTERN +CaCrossRef_t* +CaListOfCrossRefs_getById(CaListOf_t* clo, const char *sid) +{ + if (clo == NULL) + { + return NULL; + } + + return (sid != NULL) ? static_cast (clo)->get(sid) : + NULL; +} + + +/* + * Removes the nth CaCrossRef_t from this CaListOf_t and returns a pointer to + * it. + */ +LIBCOMBINE_EXTERN +CaCrossRef_t* +CaListOfCrossRefs_remove(CaListOf_t* clo, unsigned int n) +{ + if (clo == NULL) + { + return NULL; + } + + return static_cast (clo)->remove(n); +} + + +/* + * Removes the CaCrossRef_t from this CaListOf_t based on its identifier and + * returns a pointer to it. + */ +LIBCOMBINE_EXTERN +CaCrossRef_t* +CaListOfCrossRefs_removeById(CaListOf_t* clo, const char* sid) +{ + if (clo == NULL) + { + return NULL; + } + + return (sid != NULL) ? static_cast (clo)->remove(sid) : + NULL; +} + + + + +LIBCOMBINE_CPP_NAMESPACE_END + + diff --git a/src/omex/CaListOfCrossRefs.h b/src/omex/CaListOfCrossRefs.h new file mode 100644 index 0000000..158ee06 --- /dev/null +++ b/src/omex/CaListOfCrossRefs.h @@ -0,0 +1,506 @@ +/** + * @file CaListOfCrossRefs.h + * @brief Definition of the CaListOfCrossRefs class. + * @author DEVISER + * + * + * + * @class CaListOfCrossRefs + * @sbmlbrief{combine} TODO:Definition of the CaListOfCrossRefs class. + */ + + +#ifndef CaListOfCrossRefs_H__ +#define CaListOfCrossRefs_H__ + + +#include +#include + + +#ifdef __cplusplus + + +#include + + +#include +#include +#include + + +LIBCOMBINE_CPP_NAMESPACE_BEGIN + + +class LIBCOMBINE_EXTERN CaListOfCrossRefs : public CaListOf +{ + +public: + + /** + * Creates a new CaListOfCrossRefs instance. + */ + CaListOfCrossRefs(); + + + /** + * Creates a new CaListOfCrossRefs using the given CaNamespaces object @p + * omexns. + * + * @param omexns the CaNamespaces object. + * + * @copydetails doc_note_setting_lv_pkg + */ + CaListOfCrossRefs(CaNamespaces *omexns); + + + /** + * Copy constructor for CaListOfCrossRefs. + * + * @param orig the CaListOfCrossRefs instance to copy. + */ + CaListOfCrossRefs(const CaListOfCrossRefs& orig); + + + /** + * Assignment operator for CaListOfCrossRefs. + * + * @param rhs the CaListOfCrossRefs object whose values are to be used as the + * basis of the assignment. + */ + CaListOfCrossRefs& operator=(const CaListOfCrossRefs& rhs); + + + /** + * Creates and returns a deep copy of this CaListOfCrossRefs object. + * + * @return a (deep) copy of this CaListOfCrossRefs object. + */ + virtual CaListOfCrossRefs* clone() const; + + + /** + * Destructor for CaListOfCrossRefs. + */ + virtual ~CaListOfCrossRefs(); + + + /** + * Get a CaCrossRef from the CaListOfCrossRefs. + * + * @param n an unsigned int representing the index of the CaCrossRef to + * retrieve. + * + * @return the nth CaCrossRef in this CaListOfCrossRefs. + * + * @copydetails doc_returned_unowned_pointer + * + * @see addCrossRef(const CaCrossRef* object) + * @see createCrossRef() + * @see get(const std::string& sid) + * @see getNumCrossRefs() + * @see remove(const std::string& sid) + * @see remove(unsigned int n) + */ + virtual CaCrossRef* get(unsigned int n); + + + /** + * Get a CaCrossRef from the CaListOfCrossRefs. + * + * @param n an unsigned int representing the index of the CaCrossRef to + * retrieve. + * + * @return the nth CaCrossRef in this CaListOfCrossRefs. + * + * @copydetails doc_returned_unowned_pointer + * + * @see addCrossRef(const CaCrossRef* object) + * @see createCrossRef() + * @see get(const std::string& sid) + * @see getNumCrossRefs() + * @see remove(const std::string& sid) + * @see remove(unsigned int n) + */ + virtual const CaCrossRef* get(unsigned int n) const; + + + /** + * Get a CaCrossRef from the CaListOfCrossRefs based on its identifier. + * + * @param sid a string representing the identifier of the CaCrossRef to + * retrieve. + * + * @return the CaCrossRef in this CaListOfCrossRefs with the given @p sid or + * @c NULL if no such CaCrossRef exists. + * + * @copydetails doc_returned_unowned_pointer + * + * @see addCrossRef(const CaCrossRef* object) + * @see createCrossRef() + * @see get(unsigned int n) + * @see getNumCrossRefs() + * @see remove(const std::string& sid) + * @see remove(unsigned int n) + */ + virtual CaCrossRef* get(const std::string& sid); + + + /** + * Get a CaCrossRef from the CaListOfCrossRefs based on its identifier. + * + * @param sid a string representing the identifier of the CaCrossRef to + * retrieve. + * + * @return the CaCrossRef in this CaListOfCrossRefs with the given @p sid or + * @c NULL if no such CaCrossRef exists. + * + * @copydetails doc_returned_unowned_pointer + * + * @see addCrossRef(const CaCrossRef* object) + * @see createCrossRef() + * @see get(unsigned int n) + * @see getNumCrossRefs() + * @see remove(const std::string& sid) + * @see remove(unsigned int n) + */ + virtual const CaCrossRef* get(const std::string& sid) const; + + + /** + * Removes the nth CaCrossRef from this CaListOfCrossRefs and returns a + * pointer to it. + * + * @param n an unsigned int representing the index of the CaCrossRef to + * remove. + * + * @return a pointer to the nth CaCrossRef in this CaListOfCrossRefs. + * + * @copydetails doc_returned_owned_pointer + * + * @see addCrossRef(const CaCrossRef* object) + * @see createCrossRef() + * @see get(const std::string& sid) + * @see get(unsigned int n) + * @see getNumCrossRefs() + * @see remove(const std::string& sid) + */ + virtual CaCrossRef* remove(unsigned int n); + + + /** + * Removes the CaCrossRef from this CaListOfCrossRefs based on its identifier + * and returns a pointer to it. + * + * @param sid a string representing the identifier of the CaCrossRef to + * remove. + * + * @return the CaCrossRef in this CaListOfCrossRefs based on the identifier + * or NULL if no such CaCrossRef exists. + * + * @copydetails doc_returned_owned_pointer + * + * @see addCrossRef(const CaCrossRef* object) + * @see createCrossRef() + * @see get(const std::string& sid) + * @see get(unsigned int n) + * @see getNumCrossRefs() + * @see remove(unsigned int n) + */ + virtual CaCrossRef* remove(const std::string& sid); + + + /** + * Adds a copy of the given CaCrossRef to this CaListOfCrossRefs. + * + * @param ccr the CaCrossRef object to add. + * + * @copydetails doc_returns_success_code + * @li @omexconstant{LIBCOMBINE_OPERATION_SUCCESS, OperationReturnValues_t} + * @li @omexconstant{LIBCOMBINE_OPERATION_FAILED, OperationReturnValues_t} + * @li @omexconstant{LIBCOMBINE_INVALID_OBJECT, OperationReturnValues_t} + * @li @omexconstant{LIBCOMBINE_LEVEL_MISMATCH, OperationReturnValues_t} + * @li @omexconstant{LIBCOMBINE_VERSION_MISMATCH, OperationReturnValues_t} + * @li @omexconstant{LIBCOMBINE_PKG_VERSION_MISMATCH, + * OperationReturnValues_t} + * @li @omexconstant{LIBCOMBINE_DUPLICATE_OBJECT_ID, OperationReturnValues_t} + * + * @copydetails doc_note_object_is_copied + * + * @see createCrossRef() + * @see get(const std::string& sid) + * @see get(unsigned int n) + * @see getNumCrossRefs() + * @see remove(const std::string& sid) + * @see remove(unsigned int n) + */ + int addCrossRef(const CaCrossRef* ccr); + + + /** + * Get the number of CaCrossRef objects in this CaListOfCrossRefs. + * + * @return the number of CaCrossRef objects in this CaListOfCrossRefs. + * + * @see addCrossRef(const CaCrossRef* object) + * @see createCrossRef() + * @see get(const std::string& sid) + * @see get(unsigned int n) + * @see remove(const std::string& sid) + * @see remove(unsigned int n) + */ + unsigned int getNumCrossRefs() const; + + + /** + * Creates a new CaCrossRef object, adds it to this CaListOfCrossRefs object + * and returns the CaCrossRef object created. + * + * @return a new CaCrossRef object instance. + * + * @copydetails doc_returned_unowned_pointer + * + * @see addCrossRef(const CaCrossRef* object) + * @see get(const std::string& sid) + * @see get(unsigned int n) + * @see getNumCrossRefs() + * @see remove(const std::string& sid) + * @see remove(unsigned int n) + */ + CaCrossRef* createCrossRef(); + + + /** + * Returns the XML element name of this CaListOfCrossRefs object. + * + * For CaListOfCrossRefs, the XML element name is always + * @c "listOfCrossRefs". + * + * @return the name of this element, i.e. @c "listOfCrossRefs". + */ + virtual const std::string& getElementName() const; + + + /** + * Returns the libCombine type code for this CaListOfCrossRefs object. + * + * @copydetails doc_what_are_typecodes + * + * @return the OMEX type code for this object: + * @omexconstant{OMEX_LIST_OF, CaTypeCode_t}. + * + * @copydetails doc_warning_typecodes_not_unique + */ + virtual int getTypeCode() const; + + + /** + * Returns the libOMEX type code for the OMEX objects contained in this + * CaListOfCrossRefs object. + * + * @copydetails doc_what_are_typecodes + * + * @return the OMEX typecode for the objects contained in this + * CaListOfCrossRefs: + * @omexconstant{LIB_COMBINE_CROSSREF, CaTypeCode_t}. + * + * @copydetails doc_warning_typecodes_not_unique + * + * @see getElementName() + */ + virtual int getItemTypeCode() const; + + + + + #ifndef SWIG + + + + + #endif /* !SWIG */ + + +protected: + + + /** @cond doxygenlibCombineInternal */ + + /** + * Creates a new CaCrossRef in this CaListOfCrossRefs + */ + virtual CaBase* createObject(LIBSBML_CPP_NAMESPACE_QUALIFIER XMLInputStream& + stream); + + /** @endcond */ + + + friend class CaContent; + + /** @cond doxygenlibCombineInternal */ + + /** + * Writes the namespace for the Combine package + */ + virtual void writeXMLNS(LIBSBML_CPP_NAMESPACE_QUALIFIER XMLOutputStream& + stream) const; + + /** @endcond */ + + +}; + + + +LIBCOMBINE_CPP_NAMESPACE_END + + + + +#endif /* __cplusplus */ + + + + +#ifndef SWIG + + + + +LIBCOMBINE_CPP_NAMESPACE_BEGIN + + + + +BEGIN_C_DECLS + + +/** + * Get a CaCrossRef_t from the CaListOf_t. + * + * @param clo the CaListOf_t structure to search. + * + * @param n an unsigned int representing the index of the CaCrossRef_t to + * retrieve. + * + * @return the nth CaCrossRef_t in this CaListOf_t. + * + * @copydetails doc_returned_unowned_pointer + * + * @memberof CaListOfCrossRefs_t + */ +LIBCOMBINE_EXTERN +CaCrossRef_t* +CaListOfCrossRefs_getCrossRef(CaListOf_t* clo, unsigned int n); + + +/** + * Get a CaCrossRef_t from the CaListOf_t based on its identifier. + * + * @param clo the CaListOf_t structure to search. + * + * @param sid a string representing the identifier of the CaCrossRef_t to + * retrieve. + * + * @return the CaCrossRef_t in this CaListOf_t with the given @p sid or @c NULL + * if no such CaCrossRef_t exists. + * + * @copydetails doc_returned_unowned_pointer + * + * @memberof CaListOfCrossRefs_t + */ +LIBCOMBINE_EXTERN +CaCrossRef_t* +CaListOfCrossRefs_getById(CaListOf_t* clo, const char *sid); + + +/** + * Removes the nth CaCrossRef_t from this CaListOf_t and returns a pointer to + * it. + * + * @param clo the CaListOf_t structure to search. + * + * @param n an unsigned int representing the index of the CaCrossRef_t to + * remove. + * + * @return a pointer to the nth CaCrossRef_t in this CaListOf_t. + * + * @copydetails doc_returned_owned_pointer + * + * @memberof CaListOfCrossRefs_t + */ +LIBCOMBINE_EXTERN +CaCrossRef_t* +CaListOfCrossRefs_remove(CaListOf_t* clo, unsigned int n); + + +/** + * Removes the CaCrossRef_t from this CaListOf_t based on its identifier and + * returns a pointer to it. + * + * @param clo the CaListOf_t structure to search. + * + * @param sid a string representing the identifier of the CaCrossRef_t to + * remove. + * + * @return the CaCrossRef_t in this CaListOf_t based on the identifier or NULL + * if no such CaCrossRef_t exists. + * + * @copydetails doc_returned_owned_pointer + * + * @memberof CaListOfCrossRefs_t + */ +LIBCOMBINE_EXTERN +CaCrossRef_t* +CaListOfCrossRefs_removeById(CaListOf_t* clo, const char* sid); + + + + +END_C_DECLS + + + + +LIBCOMBINE_CPP_NAMESPACE_END + + + + +#endif /* !SWIG */ + + + + +#endif /* !CaListOfCrossRefs_H__ */ + + diff --git a/src/omex/CaTypeCodes.cpp b/src/omex/CaTypeCodes.cpp index 56113d4..350cd13 100644 --- a/src/omex/CaTypeCodes.cpp +++ b/src/omex/CaTypeCodes.cpp @@ -7,7 +7,11 @@ * This file is part of libSBML. Please visit http://sbml.org for more * information about SBML, and the latest version of libSBML. * - * Copyright (C) 2013-2016 jointly by the following organizations: + * Copyright (C) 2019 jointly by the following organizations: + * 1. California Institute of Technology, Pasadena, CA, USA + * 2. University of Heidelberg, Heidelberg, Germany + * + * Copyright (C) 2013-2018 jointly by the following organizations: * 1. California Institute of Technology, Pasadena, CA, USA * 2. EMBL European Bioinformatics Institute (EMBL-EBI), Hinxton, UK * 3. University of Heidelberg, Heidelberg, Germany @@ -44,6 +48,7 @@ const char* OMEX_TYPE_CODE_STRINGS[] = "(Unknown OMEX Type)" , "Content" , "OmexManifest" + , "CrossRef" , "CaListOf" }; diff --git a/src/omex/CaTypeCodes.h b/src/omex/CaTypeCodes.h index 4785acd..cff9e02 100644 --- a/src/omex/CaTypeCodes.h +++ b/src/omex/CaTypeCodes.h @@ -7,7 +7,11 @@ * This file is part of libSBML. Please visit http://sbml.org for more * information about SBML, and the latest version of libSBML. * - * Copyright (C) 2013-2016 jointly by the following organizations: + * Copyright (C) 2019 jointly by the following organizations: + * 1. California Institute of Technology, Pasadena, CA, USA + * 2. University of Heidelberg, Heidelberg, Germany + * + * Copyright (C) 2013-2018 jointly by the following organizations: * 1. California Institute of Technology, Pasadena, CA, USA * 2. EMBL European Bioinformatics Institute (EMBL-EBI), Hinxton, UK * 3. University of Heidelberg, Heidelberg, Germany @@ -30,7 +34,7 @@ * available online as http://sbml.org/software/libsbml/license.html * ------------------------------------------------------------------------ --> * - * @class + * @class CaTypeCodes * @sbmlbrief{} TODO:Definition of the CaTypeCodes class. */ @@ -61,6 +65,7 @@ typedef enum OMEX_UNKNOWN = 0 , LIB_COMBINE_CONTENT , LIB_COMBINE_OMEXMANIFEST + , LIB_COMBINE_CROSSREF , OMEX_LIST_OF } CaTypeCode_t; diff --git a/src/omex/CaTypes.h b/src/omex/CaTypes.h index 133dd8f..f0f6d8e 100644 --- a/src/omex/CaTypes.h +++ b/src/omex/CaTypes.h @@ -7,7 +7,11 @@ * This file is part of libSBML. Please visit http://sbml.org for more * information about SBML, and the latest version of libSBML. * - * Copyright (C) 2013-2016 jointly by the following organizations: + * Copyright (C) 2019 jointly by the following organizations: + * 1. California Institute of Technology, Pasadena, CA, USA + * 2. University of Heidelberg, Heidelberg, Germany + * + * Copyright (C) 2013-2018 jointly by the following organizations: * 1. California Institute of Technology, Pasadena, CA, USA * 2. EMBL European Bioinformatics Institute (EMBL-EBI), Hinxton, UK * 3. University of Heidelberg, Heidelberg, Germany @@ -44,9 +48,11 @@ #include #include +#include #include #include +#include #endif /* CaTypes_h */ diff --git a/src/omex/common/combinefwd.h b/src/omex/common/combinefwd.h index 3084016..77efb7e 100644 --- a/src/omex/common/combinefwd.h +++ b/src/omex/common/combinefwd.h @@ -7,7 +7,11 @@ * This file is part of libSBML. Please visit http://sbml.org for more * information about SBML, and the latest version of libSBML. * - * Copyright (C) 2013-2016 jointly by the following organizations: + * Copyright (C) 2019 jointly by the following organizations: + * 1. California Institute of Technology, Pasadena, CA, USA + * 2. University of Heidelberg, Heidelberg, Germany + * + * Copyright (C) 2013-2018 jointly by the following organizations: * 1. California Institute of Technology, Pasadena, CA, USA * 2. EMBL European Bioinformatics Institute (EMBL-EBI), Hinxton, UK * 3. University of Heidelberg, Heidelberg, Germany @@ -36,6 +40,8 @@ #define combinefwd_H__ +#include + /** * Forward declaration of all opaque C types. * @@ -57,6 +63,7 @@ LIBCOMBINE_CPP_NAMESPACE_BEGIN typedef CLASS_OR_STRUCT CaContent CaContent_t; typedef CLASS_OR_STRUCT CaOmexManifest CaOmexManifest_t; +typedef CLASS_OR_STRUCT CaCrossRef CaCrossRef_t; typedef CLASS_OR_STRUCT CaBase CaBase_t; typedef CLASS_OR_STRUCT CaListOf CaListOf_t; typedef CLASS_OR_STRUCT CaReader CaReader_t; @@ -68,6 +75,25 @@ typedef CLASS_OR_STRUCT CaError CaError_t; LIBCOMBINE_CPP_NAMESPACE_END + +#include + +LIBSBML_CPP_NAMESPACE_BEGIN + +/** + * @var typedef class ASTNode ASTNode_t + * @copydoc ASTNode + */ +typedef CLASS_OR_STRUCT ASTNode ASTNode_t; + +/** + * @var typedef class XMLNode XMLNode_t + * @copydoc XMLNode + */ +typedef CLASS_OR_STRUCT XMLNode XMLNode_t; + +LIBSBML_CPP_NAMESPACE_END + #undef CLASS_OR_STRUCT diff --git a/src/test/combine_test_create.cpp b/src/test/combine_test_create.cpp index b9440a8..117ce16 100644 --- a/src/test/combine_test_create.cpp +++ b/src/test/combine_test_create.cpp @@ -73,6 +73,16 @@ SCENARIO("creating a new combine archive", "[combine]") REQUIRE(entry->getLocation() == "./model/BorisEJB.xml"); REQUIRE(entry->getFormat() == "http://identifiers.org/combine.specifications/sbml"); REQUIRE(entry->isFormat("sbml")); + REQUIRE(entry->getNumCrossRefs() == 0); + + CaCrossRef* ref = entry->createCrossRef(); + ref->setLocation("foo.xml"); + + REQUIRE(entry->getNumCrossRefs() == 1); + REQUIRE(entry->getCrossRef(0) != NULL); + REQUIRE(entry->getCrossRef(0)->getLocation() == "foo.xml"); + + entry->removeCrossRef(0); std::string modelContent = archive.extractEntryToString("./model/BorisEJB.xml"); REQUIRE(!modelContent.empty());