Jpp  18.6.0-rc.1
the software that should make you happy
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Classes | Namespaces | Macros | Functions
JStreamAvailable.cc File Reference

Example program to test JLANG::JStreamAvailable class. More...

#include <iostream>
#include <iomanip>
#include <vector>
#include "JLang/JStreamAvailable.hh"
#include "JLang/JBool.hh"
#include "Jeep/JParser.hh"
#include "Jeep/JMessage.hh"

Go to the source code of this file.

Classes

struct  __A__
 
struct  __B__< T >
 
struct  __C__
 

Namespaces

 std
 

Macros

#define PRINT(OUT, CLASS)
 Print class parameters. More...
 

Functions

template<class T >
std::ostream & operator<< (std::ostream &out, const __B__< T > &object)
 Write object to output. More...
 
std::istream & std::operator>> (std::istream &in, std::vector< int > &object)
 Read std::vector<int> from input. More...
 
std::ostream & std::operator<< (std::ostream &out, const std::vector< int > &object)
 Write std::vector<int> to output. More...
 
int main (int argc, char **argv)
 

Detailed Description

Example program to test JLANG::JStreamAvailable class.

Author
mdejong

Definition in file JStreamAvailable.cc.

Macro Definition Documentation

#define PRINT (   OUT,
  CLASS 
)
Value:
OUT << std::setw(12) << std::left << #CLASS << ' ' ; \
OUT << JStreamAvailable<CLASS>::has_istream << '/'; \
OUT << JStreamAvailable<CLASS>::has_ostream << std::endl;

Print class parameters.

Parameters
OUToutput stream
CLASSclass

Definition at line 132 of file JStreamAvailable.cc.

Function Documentation

template<class T >
std::ostream& operator<< ( std::ostream &  out,
const __B__< T > &  object 
)
inline

Write object to output.

Parameters
outoutput stream
objectobject
Returns
output stream

Definition at line 39 of file JStreamAvailable.cc.

40 {
41  return out << "__B__";
42 }
int main ( int  argc,
char **  argv 
)

Definition at line 145 of file JStreamAvailable.cc.

146 {
147  using namespace std;
148  using namespace JPP;
149 
150  int debug;
151 
152  try {
153 
154  JParser<> zap("Example program to test availability of I/O stream redirection.");
155 
156  zap['d'] = make_field(debug) = 3;
157 
158  zap(argc, argv);
159  }
160  catch(const exception &error) {
161  FATAL(error.what() << endl);
162  }
163 
164 
165  if (debug >= debug_t) {
166 
167  cout << setw(12) << left << "class" << " I/O" << endl;
168  cout << setw(12) << right << setfill('-') << "" << "+---" << setfill(' ') << endl;
169 
170  PRINT(cout, double);
171  PRINT(cout, __A__);
172  PRINT(cout, __B__<int>);
173  PRINT(cout, __C__);
174  PRINT(cout, vector<int>);
175 
176  print(cout, vector<int>(5, 1));
177  print(cout, vector<double>(5, 1.0));
178 
179  __A__ a;
180  __B__<int> b;
181  __C__ c;
182 
183  cout << "STREAM << __A__: " << STREAM("?") << a << endl;
184  cout << "STREAM << __B__: " << STREAM("?") << b << endl;
185  cout << "STREAM << __C__: " << STREAM("?") << c << endl;
186  }
187 
190  ASSERT(!JStreamAvailable< __B__<int> >::has_istream);
191  ASSERT( JStreamAvailable< __B__<int> >::has_ostream);
194  ASSERT( JStreamAvailable< std::vector<int> >::has_istream);
195  ASSERT( JStreamAvailable< vector<int> >::has_ostream);
196  ASSERT(!JStreamAvailable< vector<double> >::has_istream);
197  ASSERT(!JStreamAvailable< vector<double> >::has_ostream);
198 
199  return 0;
200 }
Utility class to parse command line options.
Definition: JParser.hh:1711
debug
Definition: JMessage.hh:29
Test availability of stream operators.
#define ASSERT(A,...)
Assert macro.
Definition: JMessage.hh:90
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
Definition: JParser.hh:2158
then JCalibrateToT a
Definition: JTuneHV.sh:107
Auxiliary data structure for handling std::ostream.
print
Definition: JConvertDusj.sh:44
#define FATAL(A)
Definition: JMessage.hh:67
#define PRINT(OUT, CLASS)
Print class parameters.
$WORKDIR ev_configure_dqsimulator txt echo process $DQ_SIMULATOR $i $SOURCE_HOST[$index] csh c(setenv ROOTSYS $ROOTSYS &&source $JPP_DIR/setenv.csh $JPP_DIR &&($DQ_SIMULATOR\-u\$NAME\$\-H\$SERVER\$\-M\$LOGGER\$\-d $DEBUG</dev/null > &/dev/null &))'
int debug
debug level