src/RecfileHandler.h
branchv_0
changeset 15 e5421eea0583
parent 7 d59f31fa7009
child 16 1731e8dff446
equal deleted inserted replaced
14:c8e34cb506a4 15:e5421eea0583
    82 		}
    82 		}
    83 
    83 
    84 		output << std::endl;
    84 		output << std::endl;
    85 	}
    85 	}
    86 
    86 
       
    87 	void writeRecordCount() {
       
    88 		if (attributeCount) {
       
    89 			output << std::endl << "# Record count: " << (valueCount / attributeCount) << std::endl;
       
    90 		}
       
    91 	}
       
    92 
    87 public:
    93 public:
    88 
    94 
    89 	RecfileHandler(std::ostream& output) : output(output) {
    95 	RecfileHandler(std::ostream& output) : output(output) {
    90 	}
    96 	}
    91 
    97 
    92 	void startRelation(string_t name, std::vector<handlers::AttributeMetadata> attributes) override {
    98 	void startRelation(string_t name, std::vector<handlers::AttributeMetadata> attributes) override {
       
    99 		writeRecordCount();
       
   100 
    93 		valueCount = 0;
   101 		valueCount = 0;
    94 		attributeCount = 0;
   102 		attributeCount = 0;
    95 
   103 
    96 		if (relationCount) writeSeparator();
   104 		if (relationCount) writeSeparator();
    97 
   105 
   116 		valueCount++;
   124 		valueCount++;
   117 		writeAttribute(attributeNames[i], attributeTypes[i], value);
   125 		writeAttribute(attributeNames[i], attributeTypes[i], value);
   118 	}
   126 	}
   119 
   127 
   120 	void endOfPipe() {
   128 	void endOfPipe() {
       
   129 		writeRecordCount();
   121 		if (valueCount) writeSeparator();
   130 		if (valueCount) writeSeparator();
   122 	}
   131 	}
   123 
   132 
   124 };
   133 };
   125 
   134