Skip to content

Commit

Permalink
reorganize code
Browse files Browse the repository at this point in the history
  • Loading branch information
FJShen committed Oct 8, 2024
1 parent a3ab0aa commit 0929b87
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions gpu-simulator/trace-parser/trace_parser.h
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,13 @@ class PipeReader {
public:
PipeReader(const std::string &filePath);

// Destructor to close the pipe
~PipeReader() {
if (pipe) {
pclose(pipe); // Close the pipe when done
}
}

// It does not make sense to implement copy semantics for PipeReader,
// because each instance should hold a unique Linux pipe handle
PipeReader(const PipeReader&) = delete;
Expand All @@ -88,15 +95,6 @@ class PipeReader {
PipeReader(PipeReader &&) noexcept;
PipeReader& operator=(PipeReader&&) noexcept;

void OpenFile(const std::string &filePath);

// Destructor to close the pipe
~PipeReader() {
if (pipe) {
pclose(pipe); // Close the pipe when done
}
}

// Read one line
bool readLine(std::string &line);

Expand All @@ -107,6 +105,8 @@ class PipeReader {
// Helper function to check if a string ends with a specific suffix (file
// extension)
bool hasEnding(const std::string &fullString, const std::string &ending);

void OpenFile(const std::string &filePath);
};

struct kernel_trace_t {
Expand Down

0 comments on commit 0929b87

Please sign in to comment.