ADMB Documentation  -a65f1c97
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
ivec_io1.cpp
Go to the documentation of this file.
1 
5 #include "fvar.hpp"
6 
7 #ifdef __TURBOC__
8  #pragma hdrstop
9  #include <iostream.h>
10  #include <iomanip.h>
11  #include <fstream.h>
12 #endif
13 
14 #ifdef __ZTC__
15  #include <iostream.hpp>
16  #include <iomanip.hpp>
17  #include <fstream.hpp>
18 #endif
19 
20 #ifndef OPT_LIB
21  #include <cassert>
22 #endif
23 
30 uistream& operator>>(const uistream& input, const ivector& values)
31 {
32  const_cast<ivector&>(values).read_from(input);
33  return const_cast<uistream&>(input);
34 }
40 void ivector::read_from(const uistream& input)
41 {
42 #ifndef OPT_LIB
43  assert(indexmax() >= indexmin());
44 #endif
45 
46  char* p = (char*)(v + indexmin());
47  int n = indexmax() - indexmin() + 1;
48  n *= (int)sizeof(int);
49 
50  const_cast<uistream&>(input).read(p, n);
51 }
59 {
60  const_cast<ivector&>(values).write_on(output);
61  return const_cast<uostream&>(output);
62 }
68 void ivector::write_on(const uostream& output) const
69 {
70 #ifndef OPT_LIB
71  assert(indexmax() >= indexmin());
72 #endif
73 
74  char* p = (char*)(v + indexmin());
75  int n = indexmax() - indexmin() + 1;
76  n *= (int)sizeof(int);
77 
78  const_cast<uostream&>(output).write(p, n);
79 }
void read(const test_smartlist &, void *, int nsize)
void read_from(const istream &s)
Reads all the elements from istream _s.
Definition: ivect_io.cpp:93
Array of integers(int) with indexes from index_min to indexmax.
Definition: ivector.h:50
Description not yet available.
Definition: fvar.hpp:3398
Author: David Fournier Copyright (c) 2008-2012 Regents of the University of California.
int indexmin() const
Definition: ivector.h:99
int indexmax() const
Definition: ivector.h:104
values
Definition: adjson.h:22
const int output
Definition: fvar.hpp:9505
void write(const test_smartlist &, void *, int nsize)
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
void write_on(const ostream &s) const
Writes all the elements to the ostream _s.
Definition: ivect_io.cpp:42
Description not yet available.
Definition: fvar.hpp:3516
int * v
Definition: ivector.h:55