ADMB Documentation  11.1.2275
 All Classes Files Functions Variables Typedefs Friends Defines
str_aio.cpp
Go to the documentation of this file.
00001 /*
00002  * $Id: str_aio.cpp 1919 2014-04-22 22:02:01Z johnoel $
00003  *
00004  * Author: David Fournier
00005  * Copyright (c) 2008-2012 Regents of the University of California
00006  */
00007 #include <fvar.hpp>
00008 #include <cifstrem.h>
00009 
00010  ifstream& operator >> (ifstream& ifs,adstring_array& sa)
00011  {
00012    if (sa.ptr)
00013    {
00014      int min=sa.indexmin();
00015      int max=sa.indexmax();
00016      for (int i=min;i<=max;i++)
00017      {
00018        ifs >> sa[i];
00019      }
00020    }
00021    return ifs;
00022  }
00023 
00024  ostream& operator<<(const ostream& _ofs, const adstring_array& sa)
00025  {
00026    ostream& ofs = (ostream&) _ofs;
00027    if (sa.ptr)
00028    {
00029      int min=sa.indexmin();
00030      int max=sa.indexmax();
00031      for (int i=min;i<=max;i++)
00032      {
00033        ofs << sa[i];
00034        if (i<max) ofs << endl;
00035      }
00036    }
00037    return ofs;
00038  }
00039  cifstream& operator >> (cifstream& ifs,adstring_array& sa)
00040  {
00041    if (sa.ptr)
00042    {
00043      int min=sa.indexmin();
00044      int max=sa.indexmax();
00045      for (int i=min;i<=max;i++)
00046      {
00047        ifs >> sa[i];
00048      }
00049    }
00050    return ifs;
00051  }