ADMB Documentation  -a65f1c97
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Member Functions | Private Member Functions | Private Attributes | List of all members
cifstream Class Reference

#include <cifstrem.h>

Public Member Functions

 cifstream (const char *, int=std::ios_base::in, char cc= '#')
 
virtual ~cifstream ()
 Destructor. More...
 
char * comment ()
 Returns the last comment line. More...
 
void filter ()
 Move file pointer past comments and empty lines to next data field. More...
 
adstring get_file_name (void)
 
cifstreamgetline (char *, int, char= '\n')
 
void open (const char *, int)
 
cifstreamoperator>> (const dvariable &z)
 Reads input into var from comment formatted input file. More...
 
cifstreamoperator>> (long long &i)
 Reads to i from input cifstream. More...
 
cifstreamoperator>> (const long long &i)
 Reads to _i from input cifstream. More...
 
cifstreamoperator>> (const long &i)
 Reads to i from input cifstream. More...
 
cifstreamoperator>> (const int &i)
 Reads to i from input cifstream. More...
 
cifstreamoperator>> (const double &x)
 Reads to _x from input cifstream. More...
 
cifstreamoperator>> (const float &x)
 Reads to x from input cifstream. More...
 
cifstreamoperator>> (char *x)
 Reads to c from input cifstream. More...
 
cifstreamoperator>> (const char *x)
 Reads to c from input cifstream. More...
 
cifstreamoperator>> (const adstring &x)
 Reads to _s from input cifstream. More...
 
cifstreamoperator>> (adstring &x)
 Reads to s from input cifstream. More...
 
cifstreamoperator>> (const line_adstring &x)
 Reads to str from input cifstream. More...
 
cifstreamoperator>> (line_adstring &x)
 Reads to str from input cifstream. More...
 
cifstreamoperator>> (const dvar_vector &z)
 Reads input into var from comment formatted input file. More...
 
cifstreamoperator>> (const dvector &z)
 Reads values into dvec from cifstream. More...
 
cifstreamoperator>> (const lvector &z)
 Reads values into lvec from cifstream. More...
 
cifstreamoperator>> (const ivector &z)
 Reads values into ivec from istr. More...
 
void set_ignore_eof ()
 
void set_use_eof ()
 
char * signature ()
 Get the signature line of inputfile. More...
 

Private Member Functions

void get_field (char *s, int space_flag=0)
 Extract a single field into s from data file. More...
 
void report_error (const char *s=NULL)
 
void set_eof_bit (void)
 

Private Attributes

streambuf * bp
 
char COMMENT_CHAR
 
char comment_line [SIGNATURE_LENGTH+1]
 
int field
 
adstring file_name
 
int ignore_eof
 
int line
 
char signature_line [SIGNATURE_LENGTH+1]
 

Detailed Description

Definition at line 117 of file cifstrem.h.

Constructor & Destructor Documentation

cifstream::cifstream ( const char *  fn,
int  open_m = std::ios_base::in,
char  cc = '#' 
)

Definition at line 86 of file cifstrem.cpp.

cifstream::~cifstream ( )
virtual

Destructor.

Definition at line 27 of file cifstrem.cpp.

Member Function Documentation

char* cifstream::comment ( )
inline

Returns the last comment line.

Definition at line 177 of file cifstrem.h.

void cifstream::filter ( )

Move file pointer past comments and empty lines to next data field.

Also, sets comment_line and signature_line instances if found.

Definition at line 124 of file cifstrem.cpp.

Referenced by init_line_adstring::allocate(), get_field(), getline(), and operator>>().

void cifstream::get_field ( char *  s,
int  space_flag = 0 
)
private

Extract a single field into s from data file.

Parameters
sstores the data field
space_flagincludes spaces in data field when active. (default off)

Definition at line 171 of file cifstrem.cpp.

Referenced by operator>>().

adstring cifstream::get_file_name ( void  )
cifstream & cifstream::getline ( char *  s,
int  k,
char  d = '\n' 
)
Todo:
Need Test case

Definition at line 473 of file cifstrem.cpp.

Referenced by init_line_adstring::allocate(), and operator>>().

void cifstream::open ( const char *  ,
int   
)
cifstream & cifstream::operator>> ( const dvariable var)

Reads input into var from comment formatted input file.

Parameters
vardvariable

Definition at line 25 of file dfadcif.cpp.

Referenced by operator>>().

cifstream & cifstream::operator>> ( long long &  i)

Reads to i from input cifstream.

Parameters
ilong long

Definition at line 346 of file cifstrem.cpp.

cifstream & cifstream::operator>> ( const long long &  _i)

Reads to _i from input cifstream.

Parameters
_ilong long

Definition at line 323 of file cifstrem.cpp.

cifstream & cifstream::operator>> ( const long &  i)

Reads to i from input cifstream.

Parameters
ilong

Definition at line 291 of file cifstrem.cpp.

cifstream & cifstream::operator>> ( const int &  i)

Reads to i from input cifstream.

Parameters
iint

Definition at line 381 of file cifstrem.cpp.

cifstream & cifstream::operator>> ( const double &  _x)

Reads to _x from input cifstream.

Parameters
_xdouble

Definition at line 406 of file cifstrem.cpp.

cifstream & cifstream::operator>> ( const float &  x)

Reads to x from input cifstream.

Parameters
xfloat

Definition at line 453 of file cifstrem.cpp.

cifstream & cifstream::operator>> ( char *  c)

Reads to c from input cifstream.

Parameters
cchar*

Definition at line 271 of file cifstrem.cpp.

cifstream & cifstream::operator>> ( const char *  c)

Reads to c from input cifstream.

Parameters
cchar*

Definition at line 281 of file cifstrem.cpp.

cifstream & cifstream::operator>> ( const adstring _s)

Reads to _s from input cifstream.

Parameters
_sadstring

Definition at line 235 of file cifstrem.cpp.

cifstream & cifstream::operator>> ( adstring s)

Reads to s from input cifstream.

Parameters
sadstring

Definition at line 222 of file cifstrem.cpp.

cifstream & cifstream::operator>> ( const line_adstring str)

Reads to str from input cifstream.

Parameters
strline_adstring

Definition at line 262 of file cifstrem.cpp.

cifstream & cifstream::operator>> ( line_adstring str)

Reads to str from input cifstream.

Parameters
strline_adstring

Definition at line 249 of file cifstrem.cpp.

cifstream & cifstream::operator>> ( const dvar_vector varvec)

Reads input into var from comment formatted input file.

Parameters
vardvar_vector

Definition at line 35 of file dfadcif.cpp.

cifstream & cifstream::operator>> ( const dvector dvec)

Reads values into dvec from cifstream.

Parameters
dvecdvector

Definition at line 53 of file ad_cif.cpp.

cifstream & cifstream::operator>> ( const lvector lvec)

Reads values into lvec from cifstream.

Parameters
lveclvector

Definition at line 37 of file ad_cif.cpp.

cifstream & cifstream::operator>> ( const ivector ivec)

Reads values into ivec from istr.

Parameters
istrcomment formatted input stream
ivecivector

Definition at line 172 of file ad_cif.cpp.

void cifstream::report_error ( const char *  s = NULL)
private

Definition at line 519 of file cifstrem.cpp.

Referenced by filter(), get_field(), and operator>>().

void cifstream::set_eof_bit ( void  )
private

Definition at line 30 of file cifstrem.cpp.

Referenced by filter(), and get_field().

void cifstream::set_ignore_eof ( )
inline

Definition at line 206 of file cifstrem.h.

void cifstream::set_use_eof ( )
inline

Definition at line 207 of file cifstrem.h.

char * cifstream::signature ( )

Get the signature line of inputfile.

Definition at line 44 of file cifstrem.cpp.

Member Data Documentation

streambuf* cifstream::bp
private

Definition at line 119 of file cifstrem.h.

Referenced by filter(), get_field(), getline(), and signature().

char cifstream::COMMENT_CHAR
private

Definition at line 120 of file cifstrem.h.

char cifstream::comment_line[SIGNATURE_LENGTH+1]
private

Definition at line 121 of file cifstrem.h.

Referenced by comment(), filter(), and signature().

int cifstream::field
private

Definition at line 125 of file cifstrem.h.

Referenced by filter(), and get_field().

adstring cifstream::file_name
private

Definition at line 123 of file cifstrem.h.

Referenced by get_file_name().

int cifstream::ignore_eof
private

Definition at line 126 of file cifstrem.h.

Referenced by set_ignore_eof(), and set_use_eof().

int cifstream::line
private

Definition at line 124 of file cifstrem.h.

Referenced by filter(), operator>>(), and signature().

char cifstream::signature_line[SIGNATURE_LENGTH+1]
private

Definition at line 122 of file cifstrem.h.

Referenced by filter(), and signature().


The documentation for this class was generated from the following files: