ADMB Documentation  -a65f1c97
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
lvec_io1.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 #include "fvar.hpp"
13 
14 // i/o ooperations for class lvector
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 #ifndef OPT_LIB
33  #include <cassert>
34 #endif
35 
36 // unformatted
37 
38 #ifdef __USE_IOSTREAM__
39 
44 uistream& operator>>(const uistream& _istr, const lvector& _z)
45 {
47  uistream & istr = (uistream&) _istr;
48  z.read_from(istr);
49 
50  return istr;
51 }
52 
58 {
60  char* p = (char*)(v + indexmin());
61 #ifndef OPT_LIB
62  assert(indexmax() >= indexmin());
63 #endif
64  int n = indexmax() - indexmin() + 1;
65  n *= (int)sizeof(int);
66  s.read(p, n);
67 }
68 
73 uostream& operator<<(const uostream& _ostr, const lvector& z)
74 {
75  uostream & ostr = (uostream&) _ostr;
76  z.write_on(ostr);
77 
78  return ostr;
79 }
80 
85 void lvector::write_on(const uostream& _s) const
86 {
88  char* p = (char*)(v + indexmin());
89 #ifndef OPT_LIB
90  assert(indexmax() >= indexmin());
91 #endif
92  int n = indexmax() - indexmin() + 1;
93  n *= (int)sizeof(int);
94  s.write(p, n);
95 }
96 #endif
97 
void write_on(const ostream &s) const
Description not yet available.
Definition: lvect_io.cpp:48
AD_LONG_INT * v
Definition: fvar.hpp:658
#define ADUNCONST(type, obj)
Creates a shallow copy of obj that is not CONST.
Definition: fvar.hpp:140
int indexmin() const
Definition: fvar.hpp:676
Description not yet available.
Definition: fvar.hpp:656
int indexmax() const
Definition: fvar.hpp:681
Description not yet available.
Definition: fvar.hpp:3398
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 istream &s)
Description not yet available.
Definition: lvect_io.cpp:109