Functions
contrib/mul/mbl/mbl_parse_tuple.h File Reference

Convenience function a tuple of PODs from a config file. More...

#include <vcl_istream.h>
#include <vcl_sstream.h>
#include <mbl/mbl_exception.h>

Go to the source code of this file.

Functions

template<class T , class U >
void mbl_parse_tuple (vcl_istream &afs, T &a, U &b)
 Read a 2-tuple of PODs from a config file.
template<class T , class U , class V >
void mbl_parse_tuple (vcl_istream &afs, T &a, U &b, V &c)
 Read a 3-tuple of PODs from a config file.
template<class T , class U , class V , class W >
void mbl_parse_tuple (vcl_istream &afs, T &a, U &b, V &c, W &d)
 Read a 4-tuple of PODs from a config file.
template<class T , class U , class V , class W , class X >
void mbl_parse_tuple (vcl_istream &afs, T &a, U &b, V &c, W &d, X &e)
 Read a 5-tuple of PODs from a config file.
template<class T , class U , class V , class W , class X , class Y >
void mbl_parse_tuple (vcl_istream &afs, T &a, U &b, V &c, W &d, X &e, Y &f)
 Read a 6-tuple of PODs from a config file.

Detailed Description

Convenience function a tuple of PODs from a config file.

Author:
Ian Scott
Date:
6-Feb-2008

Definition in file mbl_parse_tuple.h.


Function Documentation

template<class T , class U >
void mbl_parse_tuple ( vcl_istream &  afs,
T &  a,
U &  b 
) [inline]

Read a 2-tuple of PODs from a config file.

This function will read through a stream, and store the text found to a string. The function reads 2 elements. If there was an opening brace it will also consume the closing brace. Other conditions will cause an exception to be thrown, and the stream's fail bit to be set

Exceptions:
mbl_exception_parse_errorif unrecoverable parse error.

Example:

   vcl_istringstream ss("{ 1.0 4 }");
   float a;
   int b;
   mbl_parse_tuple(ss, a, b)

Definition at line 30 of file mbl_parse_tuple.h.

template<class T , class U , class V >
void mbl_parse_tuple ( vcl_istream &  afs,
T &  a,
U &  b,
V &  c 
) [inline]

Read a 3-tuple of PODs from a config file.

This function will read through a stream, and store the text found to a string. The function reads 3 elements. If there was an opening brace it will also consume the closing brace. Other conditions will cause an exception to be thrown, and the stream's fail bit to be set

Exceptions:
mbl_exception_parse_errorif unrecoverable parse error.
   Example:
   vcl_istringstream ss("{ 1.0 -5 4 }");
   float a;
   int b;
   unsigned c;
   mbl_parse_tuple(ss, a, b, c)
   

Definition at line 75 of file mbl_parse_tuple.h.

template<class T , class U , class V , class W >
void mbl_parse_tuple ( vcl_istream &  afs,
T &  a,
U &  b,
V &  c,
W &  d 
) [inline]

Read a 4-tuple of PODs from a config file.

This function will read through a stream, and store the text found to a string. The function reads 4 elements. If there was an opening brace it will also consume the closing brace. Other conditions will cause an exception to be thrown, and the stream's fail bit to be set

Exceptions:
mbl_exception_parse_errorif unrecoverable parse error.
   Example:
   vcl_istringstream ss("{ 1.0 -5 4 a }");
   float a;
   int b;
   unsigned c;
   char d;
   mbl_parse_tuple(ss, a, b, c, d)
   

Definition at line 122 of file mbl_parse_tuple.h.

template<class T , class U , class V , class W , class X >
void mbl_parse_tuple ( vcl_istream &  afs,
T &  a,
U &  b,
V &  c,
W &  d,
X &  e 
) [inline]

Read a 5-tuple of PODs from a config file.

This function will read through a stream, and store the text found to a string. The function reads 5 elements. If there was an opening brace it will also consume the closing brace. Other conditions will cause an exception to be thrown, and the stream's fail bit to be set

Exceptions:
mbl_exception_parse_errorif unrecoverable parse error.
   Example:
   vcl_istringstream ss("{ 1.0 -5 4 k l }");
   float a;
   int b;
   unsigned c;
   char d, e;
   mbl_parse_tuple(ss, a, b, c, d, e)
   

Definition at line 169 of file mbl_parse_tuple.h.

template<class T , class U , class V , class W , class X , class Y >
void mbl_parse_tuple ( vcl_istream &  afs,
T &  a,
U &  b,
V &  c,
W &  d,
X &  e,
Y &  f 
) [inline]

Read a 6-tuple of PODs from a config file.

This function will read through a stream, and store the text found to a string. The function reads 6 elements. If there was an opening brace it will also consume the closing brace. Other conditions will cause an exception to be thrown, and the stream's fail bit to be set

Exceptions:
mbl_exception_parse_errorif unrecoverable parse error.
   Example:
   vcl_istringstream ss("{ 1.0 -3.4 -5 4 k l }");
   float a;
   double b;
   int c;
   unsigned d;
   char e, f;
   mbl_parse_tuple(ss, a, b, c, d, e, f)
   

Definition at line 217 of file mbl_parse_tuple.h.