/* ----------------------------------------------------------------------------
 * This file was automatically generated by SWIG (http://www.swig.org).
 * Version 2.0.0
 *
 * Do not make changes to this file unless you know what you are doing--modify
 * the SWIG interface file instead.
 * ----------------------------------------------------------------------------- */

namespace libsbml {

using System;
using System.Runtime.InteropServices;

public class SBMLDocument : SBase {
	private HandleRef swigCPtr;
	
	internal SBMLDocument(IntPtr cPtr, bool cMemoryOwn) : base(libsbmlPINVOKE.SBMLDocument_SWIGUpcast(cPtr), cMemoryOwn)
	{
		//super(libsbmlPINVOKE.SBMLDocumentUpcast(cPtr), cMemoryOwn);
		swigCPtr = new HandleRef(this, cPtr);
	}
	
	internal static HandleRef getCPtr(SBMLDocument obj)
	{
		return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
	}
	
	internal static HandleRef getCPtrAndDisown (SBMLDocument obj)
	{
		HandleRef ptr = new HandleRef(null, IntPtr.Zero);
		
		if (obj != null)
		{
			ptr             = obj.swigCPtr;
			obj.swigCMemOwn = false;
		}
		
		return ptr;
	}

  ~SBMLDocument() {
    Dispose();
  }

  public override void Dispose() {
    lock(this) {
      if (swigCPtr.Handle != IntPtr.Zero) {
        if (swigCMemOwn) {
          swigCMemOwn = false;
          libsbmlPINVOKE.delete_SBMLDocument(swigCPtr);
        }
        swigCPtr = new HandleRef(null, IntPtr.Zero);
      }
      GC.SuppressFinalize(this);
      base.Dispose();
    }
  }

  public static long getDefaultLevel() { return (long)libsbmlPINVOKE.SBMLDocument_getDefaultLevel(); }

  public static long getDefaultVersion() { return (long)libsbmlPINVOKE.SBMLDocument_getDefaultVersion(); }

  public SBMLDocument(long level, long version) : this(libsbmlPINVOKE.new_SBMLDocument__SWIG_0(level, version), true) {
    if (libsbmlPINVOKE.SWIGPendingException.Pending) throw libsbmlPINVOKE.SWIGPendingException.Retrieve();
  }

  public SBMLDocument(long level) : this(libsbmlPINVOKE.new_SBMLDocument__SWIG_1(level), true) {
    if (libsbmlPINVOKE.SWIGPendingException.Pending) throw libsbmlPINVOKE.SWIGPendingException.Retrieve();
  }

  public SBMLDocument() : this(libsbmlPINVOKE.new_SBMLDocument__SWIG_2(), true) {
    if (libsbmlPINVOKE.SWIGPendingException.Pending) throw libsbmlPINVOKE.SWIGPendingException.Retrieve();
  }

  public SBMLDocument(SBMLNamespaces sbmlns) : this(libsbmlPINVOKE.new_SBMLDocument__SWIG_3(SBMLNamespaces.getCPtr(sbmlns)), true) {
    if (libsbmlPINVOKE.SWIGPendingException.Pending) throw libsbmlPINVOKE.SWIGPendingException.Retrieve();
  }

  public SBMLDocument(SBMLDocument rhs) : this(libsbmlPINVOKE.new_SBMLDocument__SWIG_4(SBMLDocument.getCPtr(rhs)), true) {
    if (libsbmlPINVOKE.SWIGPendingException.Pending) throw libsbmlPINVOKE.SWIGPendingException.Retrieve();
  }

  public new SBMLDocument clone() {
    IntPtr cPtr = libsbmlPINVOKE.SBMLDocument_clone(swigCPtr);
    SBMLDocument ret = (cPtr == IntPtr.Zero) ? null : new SBMLDocument(cPtr, true);
    return ret;
  }

  public new Model getModel() {
    IntPtr cPtr = libsbmlPINVOKE.SBMLDocument_getModel__SWIG_0(swigCPtr);
    Model ret = (cPtr == IntPtr.Zero) ? null : new Model(cPtr, false);
    return ret;
  }

  public bool expandFunctionDefinitions() {
    bool ret = libsbmlPINVOKE.SBMLDocument_expandFunctionDefinitions(swigCPtr);
    return ret;
  }

  public bool expandInitialAssignments() {
    bool ret = libsbmlPINVOKE.SBMLDocument_expandInitialAssignments(swigCPtr);
    return ret;
  }

  public bool setLevelAndVersion(long level, long version, bool strict) {
    bool ret = libsbmlPINVOKE.SBMLDocument_setLevelAndVersion__SWIG_0(swigCPtr, level, version, strict);
    return ret;
  }

  public bool setLevelAndVersion(long level, long version) {
    bool ret = libsbmlPINVOKE.SBMLDocument_setLevelAndVersion__SWIG_1(swigCPtr, level, version);
    return ret;
  }

  public int setModel(Model m) {
    int ret = libsbmlPINVOKE.SBMLDocument_setModel(swigCPtr, Model.getCPtr(m));
    return ret;
  }

  public Model createModel(string sid) {
    IntPtr cPtr = libsbmlPINVOKE.SBMLDocument_createModel__SWIG_0(swigCPtr, sid);
    Model ret = (cPtr == IntPtr.Zero) ? null : new Model(cPtr, false);
    if (libsbmlPINVOKE.SWIGPendingException.Pending) throw libsbmlPINVOKE.SWIGPendingException.Retrieve();
    return ret;
  }

  public Model createModel() {
    IntPtr cPtr = libsbmlPINVOKE.SBMLDocument_createModel__SWIG_1(swigCPtr);
    Model ret = (cPtr == IntPtr.Zero) ? null : new Model(cPtr, false);
    return ret;
  }

  public void setConsistencyChecks(int category, bool apply) {
    libsbmlPINVOKE.SBMLDocument_setConsistencyChecks(swigCPtr, category, apply);
  }

  public void setConsistencyChecksForConversion(int category, bool apply) {
    libsbmlPINVOKE.SBMLDocument_setConsistencyChecksForConversion(swigCPtr, category, apply);
  }

  public long checkConsistency() { return (long)libsbmlPINVOKE.SBMLDocument_checkConsistency(swigCPtr); }

  public long checkInternalConsistency() { return (long)libsbmlPINVOKE.SBMLDocument_checkInternalConsistency(swigCPtr); }

  public long checkL1Compatibility() { return (long)libsbmlPINVOKE.SBMLDocument_checkL1Compatibility(swigCPtr); }

  public long checkL2v1Compatibility() { return (long)libsbmlPINVOKE.SBMLDocument_checkL2v1Compatibility(swigCPtr); }

  public long checkL2v2Compatibility() { return (long)libsbmlPINVOKE.SBMLDocument_checkL2v2Compatibility(swigCPtr); }

  public long checkL2v3Compatibility() { return (long)libsbmlPINVOKE.SBMLDocument_checkL2v3Compatibility(swigCPtr); }

  public long checkL2v4Compatibility() { return (long)libsbmlPINVOKE.SBMLDocument_checkL2v4Compatibility(swigCPtr); }

  public long checkL3v1Compatibility() { return (long)libsbmlPINVOKE.SBMLDocument_checkL3v1Compatibility(swigCPtr); }

  public SBMLError getError(long n) {
    IntPtr cPtr = libsbmlPINVOKE.SBMLDocument_getError(swigCPtr, n);
    SBMLError ret = (cPtr == IntPtr.Zero) ? null : new SBMLError(cPtr, false);
    return ret;
  }

  public long getNumErrors() { return (long)libsbmlPINVOKE.SBMLDocument_getNumErrors(swigCPtr); }

  public void printErrors(OStream stream) {
    libsbmlPINVOKE.SBMLDocument_printErrors__SWIG_0(swigCPtr, SWIGTYPE_p_std__ostream.getCPtr(stream.get_ostream()));
    if (libsbmlPINVOKE.SWIGPendingException.Pending) throw libsbmlPINVOKE.SWIGPendingException.Retrieve();
  }

  public void printErrors() {
    libsbmlPINVOKE.SBMLDocument_printErrors__SWIG_1(swigCPtr);
  }

  public override int getTypeCode() {
    int ret = libsbmlPINVOKE.SBMLDocument_getTypeCode(swigCPtr);
    return ret;
  }

  public override string getElementName() {
    string ret = libsbmlPINVOKE.SBMLDocument_getElementName(swigCPtr);
    return ret;
  }

  public SBMLErrorLog getErrorLog() {
    IntPtr cPtr = libsbmlPINVOKE.SBMLDocument_getErrorLog(swigCPtr);
    SBMLErrorLog ret = (cPtr == IntPtr.Zero) ? null : new SBMLErrorLog(cPtr, false);
    return ret;
  }

  public override XMLNamespaces getNamespaces() {
    IntPtr cPtr = libsbmlPINVOKE.SBMLDocument_getNamespaces(swigCPtr);
    XMLNamespaces ret = (cPtr == IntPtr.Zero) ? null : new XMLNamespaces(cPtr, false);
    return ret;
  }

}

}
