ADMB Documentation  -a65f1c97
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
dvec_io2.cpp
Go to the documentation of this file.
1 /*
2  * $Id$
3  *
4  * Author: David Fournier
5  * Copyright (c) 2008-2012 Regents of the University of California
6  */
11 // file: dvect_io.cpp
12 
13 // i/o ooperations for class dvector
14 #include "fvar.hpp"
15 
16 #ifdef __TURBOC__
17  #pragma hdrstop
18  #include <iostream.h>
19  #include <iomanip.h>
20  #include <fstream.h>
21  #define __USE_IOSTREAM__
22 #endif
23 
24 #ifdef __ZTC__
25  #include <iostream.hpp>
26  #include <iomanip.hpp>
27  #include <fstream.hpp>
28  #define __USE_IOSTREAM__
29 #endif
30 
31 #include <string.h>
32 
33 
34 #ifdef __USE_IOSTREAM__
35 
40 uistream& operator>>(const uistream& istr, const dvector& _z)
41 {
43  z.read_from(istr);
44  return (uistream&)istr;
45 }
46 
51 uostream& operator<<(const uostream& ostr,const dvector& z)
52 {
53  z.write_on(ostr);
54 
55  return (uostream&)ostr;
56 }
57 
62 void dvector::write_on(const uostream& _s) const
63 {
65  int mmin = indexmin();
66  int mmax = indexmax();
67  for (int i=mmin;i<=mmax;i++)
68  {
69  s.write((char*)&((*this)[i]), sizeof(double) );
70  }
71 }
72 
78 {
80  int mmin = indexmin();
81  int mmax = indexmax();
82  for (int i=mmin;i<=mmax;i++)
83  {
84  s.read((char*)&((*this)[i]), sizeof(double) );
85  }
86 }
87 #endif
#define ADUNCONST(type, obj)
Creates a shallow copy of obj that is not CONST.
Definition: fvar.hpp:140
Vector of double precision numbers.
Definition: dvector.h:50
int indexmin() const
Get minimum valid index.
Definition: dvector.h:199
void write_on(const ostream &) const
Description not yet available.
Definition: dvect_io.cpp:49
Description not yet available.
Definition: fvar.hpp:3398
int indexmax() const
Get maximum valid index.
Definition: dvector.h:204
Author: David Fournier Copyright (c) 2008-2012 Regents of the University of California.
istream & operator>>(const istream &input, const d3_array &arr3)
Read values from input stream into arr3.
Definition: d3_io.cpp:60
ostream & operator<<(const ostream &_s, preshowpoint p)
Description not yet available.
Definition: admanip.cpp:48
Description not yet available.
Definition: fvar.hpp:3516
void read_from(const uistream &)
Description not yet available.
Definition: dvec_io2.cpp:77