The Gaudi Framework  v31r0 (aeb156f0)
PipeReader Class Reference
Collaboration diagram for PipeReader:

Public Member Functions

 PipeReader (const char *cmd)
 
 ~PipeReader (void)
 
std::istringstreamoutput (void)
 

Private Attributes

FILE * pipe
 
std::istringstreamiss
 

Detailed Description

Definition at line 89 of file pfm_gen_analysis.cpp.

Constructor & Destructor Documentation

PipeReader::PipeReader ( const char *  cmd)
inline

Definition at line 91 of file pfm_gen_analysis.cpp.

91  {
92  pipe = popen( cmd, "r" );
93  if ( !pipe ) {
94  printf( "Cannot open pipe. Exiting...\n" );
95  exit( 1 );
96  }
97  char buffer[PIPE_BUFFER_LENGTH];
98  bzero( buffer, PIPE_BUFFER_LENGTH );
99  std::string result = "";
100  while ( !feof( pipe ) ) {
101  if ( fgets( buffer, PIPE_BUFFER_LENGTH, pipe ) != NULL ) { result += buffer; }
102  bzero( buffer, PIPE_BUFFER_LENGTH );
103  }
104  iss = new std::istringstream( result, std::istringstream::in );
105  }
std::istringstream * iss
T fgets(T...args)
STL class.
T exit(T...args)
#define PIPE_BUFFER_LENGTH
T feof(T...args)
T printf(T...args)
PipeReader::~PipeReader ( void  )
inline

Definition at line 107 of file pfm_gen_analysis.cpp.

107  {
108  pclose( pipe );
109  delete iss;
110  }
std::istringstream * iss

Member Function Documentation

std::istringstream& PipeReader::output ( void  )
inline

Definition at line 112 of file pfm_gen_analysis.cpp.

112 { return *iss; }
std::istringstream * iss

Member Data Documentation

std::istringstream* PipeReader::iss
private

Definition at line 116 of file pfm_gen_analysis.cpp.

FILE* PipeReader::pipe
private

Definition at line 115 of file pfm_gen_analysis.cpp.


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