001/* ---------------------------------------------------------------------------- 002 * This file was automatically generated by SWIG (http://www.swig.org). 003 * Version 2.0.11 004 * 005 * Do not make changes to this file unless you know what you are doing--modify 006 * the SWIG interface file instead. 007 * ----------------------------------------------------------------------------- */ 008 009package org.sbml.libsbml; 010 011/** 012 * Wrapper class for the C++ standard streams <code>cout</code>, 013 * <code>cerr</code>, and <code>clog</code>. 014 * <p> 015 * A few libSBML methods accept an argument for indicating where to send 016 * text string output. An example is the {@link SBMLDocument#printErrors(OStream 017 * stream)} method. However, the methods use C++ style streams and not Java 018 * stream objects. The {@link OStream} object exists to bridge the Java and 019 * underlying native implementation. It is a simple wrapper around the 020 * underlying stream object and provides a few basic methods for 021 * manipulating it. 022 * <p> 023 */ 024 025public class OStream { 026 private long swigCPtr; 027 protected boolean swigCMemOwn; 028 029 protected OStream(long cPtr, boolean cMemoryOwn) 030 { 031 swigCMemOwn = cMemoryOwn; 032 swigCPtr = cPtr; 033 } 034 035 protected static long getCPtr(OStream obj) 036 { 037 return (obj == null) ? 0 : obj.swigCPtr; 038 } 039 040 protected static long getCPtrAndDisown (OStream obj) 041 { 042 long ptr = 0; 043 044 if (obj != null) 045 { 046 ptr = obj.swigCPtr; 047 obj.swigCMemOwn = false; 048 } 049 050 return ptr; 051 } 052 053 protected void finalize() { 054 delete(); 055 } 056 057 public synchronized void delete() { 058 if (swigCPtr != 0) { 059 if (swigCMemOwn) { 060 swigCMemOwn = false; 061 libsbmlJNI.delete_OStream(swigCPtr); 062 } 063 swigCPtr = 0; 064 } 065 } 066 067 068/** 069 * Creates a new {@link OStream} object with one of standard output stream objects. 070 * <p> 071 * @param sot a value from the StdOSType enumeration(COUT, CERR, or CLOG) 072 * indicating the type of stream to create. 073 */ public 074 OStream(int sot) { 075 this(libsbmlJNI.new_OStream__SWIG_0(sot), true); 076 } 077 078 079/** 080 * Creates a new {@link OStream} object with one of standard output stream objects. 081 * <p> 082 * @param sot a value from the StdOSType enumeration(COUT, CERR, or CLOG) 083 * indicating the type of stream to create. 084 */ public 085 OStream() { 086 this(libsbmlJNI.new_OStream__SWIG_1(), true); 087 } 088 089 090/** 091 * Returns the stream object. 092 * <p> 093 * @return the stream object 094 */ public 095 SWIGTYPE_p_std__ostream get_ostream() { 096 long cPtr = libsbmlJNI.OStream_get_ostream(swigCPtr, this); 097 return (cPtr == 0) ? null : new SWIGTYPE_p_std__ostream(cPtr, false); 098 } 099 100 101/** 102 * Writes an end-of-line character on this tream. 103 */ public 104 void endl() { 105 libsbmlJNI.OStream_endl(swigCPtr, this); 106 } 107 108 // StdOSType 109 public final static int COUT = 0; 110 public final static int CERR = COUT + 1; 111 public final static int CLOG = CERR + 1; 112 113}