documentation for RelationalWriter and DataTypeWriterBase v_0
authorFrantišek Kučera <franta-hg@frantovo.cz>
Wed, 25 Jul 2018 01:33:57 +0200
branchv_0
changeset 18 90efe2db1ca8
parent 17 f2cccaa9dd38
child 19 98b901d7bb95
documentation for RelationalWriter and DataTypeWriterBase
include/RelationalWriter.h
src/DataTypeWriterBase.h
--- a/include/RelationalWriter.h	Sun Jul 22 22:21:49 2018 +0200
+++ b/include/RelationalWriter.h	Wed Jul 25 01:33:57 2018 +0200
@@ -15,12 +15,31 @@
 
 	virtual ~RelationalWriter() = default;
 
+	/**
+	 * @param typeCode string type code as defined in Specification
+	 * @return numeric id of given type
+	 * @throws RelpipeWriterException on unsupported typeCode
+	 */
 	virtual TypeId toTypeId(const string_t typeCode) = 0;
 
+	/**
+	 * @param typeId numeric type id as defined in Specification
+	 * @return string code of given type
+	 * @throws RelpipeWriterException on unsupported typeId
+	 */
 	virtual string_t toTypeCode(const TypeId typeId) = 0;
 
+	/**
+	 * @param name name of the relation (table)
+	 * @param attributes list of attributes (columns) containing their names and types
+	 * @param writeHeader header might be omitted – when appending new records to a stream alreaready containing the header
+	 */
 	virtual void startRelation(string_t name, std::vector<std::pair<string_t, TypeId>> attributes, boolean_t writeHeader) = 0;
 
+	/**
+	 * Writes a single attribute.
+	 * @param value string representation of value of given attribute type as defined in Specification
+	 */
 	virtual void writeAttribute(const string_t& value) = 0;
 
 	// TODO: fluent interface?
@@ -29,6 +48,13 @@
 	// virtual void writeBitmap(...) = 0;
 	// virtual void writeAttribute(string_t attribute) = 0;
 
+	/**
+	 * Writes a single attribute.
+	 * @param value raw pointer to the value in format of given attribute type as defined in Specification
+	 * @param type used as a safety mechanism to avoid wrong pointer interpretation;
+	 * should be called in this way: writeAttribute(&value, typeid(value));
+	 * if the type does not match, the RelpipeWriterException is thrown
+	 */
 	virtual void writeAttribute(const void* value, const std::type_info& type) = 0;
 
 };
--- a/src/DataTypeWriterBase.h	Sun Jul 22 22:21:49 2018 +0200
+++ b/src/DataTypeWriterBase.h	Wed Jul 25 01:33:57 2018 +0200
@@ -35,7 +35,7 @@
 	 * @param output output stream, should be at position where the value is to be written; the stream will not be closed not flushed after writing
 	 * @param value raw pointer to the value, must exactly match data type of this writer
 	 * @param type used as a safety mechanism to avoid wrong pointer interpretation;
-	 * should be called in this way: writeRaw(output, valuePointer, typeid(valuePointer));
+	 * should be called in this way: writeRaw(output, &value, typeid(value));
 	 * if the type does not match, the RelpipeWriterException is thrown
 	 */
 	virtual void writeRaw(std::ostream& output, const void * value, const std::type_info& type) = 0;