write record count (as a comment at the end of the relation) v_0
authorFrantišek Kučera <franta-hg@frantovo.cz>
Sat, 10 Sep 2022 19:27:47 +0200
branchv_0
changeset 15 e5421eea0583
parent 14 c8e34cb506a4
child 16 1731e8dff446
write record count (as a comment at the end of the relation)
src/RecfileHandler.h
--- a/src/RecfileHandler.h	Sat Dec 04 21:14:52 2021 +0100
+++ b/src/RecfileHandler.h	Sat Sep 10 19:27:47 2022 +0200
@@ -84,12 +84,20 @@
 		output << std::endl;
 	}
 
+	void writeRecordCount() {
+		if (attributeCount) {
+			output << std::endl << "# Record count: " << (valueCount / attributeCount) << std::endl;
+		}
+	}
+
 public:
 
 	RecfileHandler(std::ostream& output) : output(output) {
 	}
 
 	void startRelation(string_t name, std::vector<handlers::AttributeMetadata> attributes) override {
+		writeRecordCount();
+
 		valueCount = 0;
 		attributeCount = 0;
 
@@ -118,6 +126,7 @@
 	}
 
 	void endOfPipe() {
+		writeRecordCount();
 		if (valueCount) writeSeparator();
 	}