Main Page   Class Hierarchy   Compound List   File List   Compound Members   File Members  

Reference_Reader.cc

Go to the documentation of this file.
00001 
00018 // ===================================================================
00019 // INCLUDES
00020 
00021 #include <assert.h>
00022 #include <stdio.h>
00023 #include <stdlib.h>
00024 #include <sys/errno.h>
00025 #include "Reference_Reader.hh"
00026 #include "types-and-constants.hh"
00027 // ===================================================================
00028 
00029 
00030 
00031 // ===================================================================
00032 Reference_Reader::Reference_Reader
00033 (const char* const reference_trace_pathname) {
00034 
00035   // Attempt to open the trace file.
00036   reference_stream = fopen(reference_trace_pathname, "r");
00037 
00038   // Did the reference trace open correctly?
00039   if (reference_stream == NULL) {
00040 
00041     // No.  Emit the error and exit.
00042     perror("Failed opening reference trace");
00043     exit(1);
00044 
00045   }
00046 } // Reference_Reader
00047 // ===================================================================
00048 
00049 
00050 
00051 // ===================================================================
00052 Reference_Reader::~Reference_Reader () {
00053 
00054   // Was the reference stream opened?  (A subclass is not required to
00055   // use this data member.)
00056   if (reference_stream != NULL) {
00057 
00058     // Yes.  Attempt to close it, ensuring success.
00059     int reference_result = fclose(reference_stream);
00060     if (reference_result == EOF) {
00061       perror("Failed closing reference trace");
00062       exit(1);
00063     }
00064 
00065   }
00066 } // ~Consumer
00067 // ===================================================================

Generated on Fri Jan 31 10:33:35 2003 for Laplace-merge by doxygen1.3-rc2