The Gaudi Framework  master (594c33fa)
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 99 of file pfm_gen_analysis.cpp.

Constructor & Destructor Documentation

◆ PipeReader()

PipeReader::PipeReader ( const char *  cmd)
inline

Definition at line 101 of file pfm_gen_analysis.cpp.

101  {
102  pipe = popen( cmd, "r" );
103  if ( !pipe ) {
104  printf( "Cannot open pipe. Exiting...\n" );
105  exit( 1 );
106  }
107  char buffer[PIPE_BUFFER_LENGTH];
108  bzero( buffer, PIPE_BUFFER_LENGTH );
109  std::string result = "";
110  while ( !feof( pipe ) ) {
111  if ( fgets( buffer, PIPE_BUFFER_LENGTH, pipe ) != NULL ) { result += buffer; }
112  bzero( buffer, PIPE_BUFFER_LENGTH );
113  }
114  iss = new std::istringstream( result, std::istringstream::in );
115  }

◆ ~PipeReader()

PipeReader::~PipeReader ( void  )
inline

Definition at line 117 of file pfm_gen_analysis.cpp.

117  {
118  pclose( pipe );
119  delete iss;
120  }

Member Function Documentation

◆ output()

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

Definition at line 122 of file pfm_gen_analysis.cpp.

122 { return *iss; }

Member Data Documentation

◆ iss

std::istringstream* PipeReader::iss
private

Definition at line 126 of file pfm_gen_analysis.cpp.

◆ pipe

FILE* PipeReader::pipe
private

Definition at line 125 of file pfm_gen_analysis.cpp.


The documentation for this class was generated from the following file:
std::string
STL class.
PipeReader::iss
std::istringstream * iss
Definition: pfm_gen_analysis.cpp:126
std::istringstream
STL class.
std::feof
T feof(T... args)
std::fgets
T fgets(T... args)
PipeReader::pipe
FILE * pipe
Definition: pfm_gen_analysis.cpp:125
std::printf
T printf(T... args)
PIPE_BUFFER_LENGTH
#define PIPE_BUFFER_LENGTH
Definition: pfm_gen_analysis.cpp:97
std::exit
T exit(T... args)