ADMB Documentation  11.5.3197
 All Classes Files Functions Variables Typedefs Friends Defines
i4io.cpp
Go to the documentation of this file.
00001 /*
00002  * $Id$
00003  *
00004  * Author: David Fournier
00005  * Copyright (c) 2008-2012 Regents of the University of California
00006  */
00012 // file: dmat_io.cpp
00013 
00014 // i/o operations for class dmatrix
00015 #include "fvar.hpp"
00016 
00017 #ifdef __TURBOC__
00018   #pragma hdrstop
00019   #include <iostream.h>
00020   #include <iomanip.h>
00021   #include <fstream.h>
00022   #define __USE_IOSTREAM__
00023 #endif
00024 
00025 #ifdef __ZTC__
00026   #include <iostream.hpp>
00027   #include <iomanip.hpp>
00028   #include <fstream.hpp>
00029   #define __USE_IOSTREAM__
00030 #endif
00031 
00032 #include <string.h>
00033 //#include "i3_array.h"
00034 
00039 ostream& operator<<(const ostream& _ostr, const i4_array& z)
00040 {
00041   ostream& ostr=(ostream&) _ostr;
00042   for (int i=z.indexmin();i<=z.indexmax();i++)
00043   {
00044     if (allocated(z[i]))
00045     {
00046       ostr << z[i];
00047     }
00048     if (i<z.slicemax())
00049     {
00050       ostr << endl;
00051     }
00052   }
00053   return (ostream&) ostr;
00054 }
00055 
00060 istream& operator>>(const istream& istr, const i4_array& z)
00061 {
00062   for (int i=z.indexmin();i<=z.indexmax();i++)
00063   {
00064     if (allocated(z[i]))
00065     {
00066       istr >> z[i];
00067     }
00068   }
00069   return (istream&) istr;
00070 }