src/Configuration.h
branchv_0
changeset 8 513ea30d2fa3
parent 0 644fd2ce2580
child 19 e4558df9ba2d
--- a/src/Configuration.h	Sun May 05 23:09:20 2019 +0200
+++ b/src/Configuration.h	Mon May 06 16:00:20 2019 +0200
@@ -24,10 +24,62 @@
 namespace tr {
 namespace awk {
 
+class DefinitionRecipe {
+public:
+
+	virtual ~DefinitionRecipe() {
+	}
+
+	relpipe::writer::string_t name;
+	relpipe::writer::string_t type;
+	relpipe::writer::string_t value;
+};
+
+class RelationConfiguration {
+public:
+
+	virtual ~RelationConfiguration() {
+	}
+
+	relpipe::writer::string_t relation;
+	relpipe::writer::string_t awkBeforeRecords;
+	relpipe::writer::string_t awkAfterRecords;
+	relpipe::writer::string_t awkForEach;
+
+	/**
+	 * Variable definitions for this relation.
+	 * Can be used as a safe way for passing parameters from the outside environment.
+	 * See also Configuration::definitions (can be overridden by relation's definitions)
+	 */
+	std::vector<DefinitionRecipe> definitions;
+
+	/**
+	 * If empty, output relation will have same metadata as the input relation.
+	 */
+	std::vector<relpipe::writer::AttributeMetadata> writerMetadata;
+
+	/**
+	 * Whether original attributes should be appended to those specified using --output-attribute
+	 */
+	bool inputAttributesAppend = false;
+
+	/**
+	 * Whether original attributes should be prepended to those specified using --output-attribute
+	 */
+	bool inputAttributesPrepend = false;
+};
+
 class Configuration {
 public:
 
-	relpipe::writer::string_t awkExpression;
+	vector<RelationConfiguration> relationConfigurations;
+
+	/**
+	 * Global definitions for all relations.
+	 * Can be used as a safe way for passing parameters from the outside environment.
+	 * See also RelationConfiguration::definitions
+	 */
+	std::vector<DefinitionRecipe> definitions;
 
 	virtual ~Configuration() {
 	}