From e8175c2a3d6584778311e75300c17ee77ff5ecf6 Mon Sep 17 00:00:00 2001
From: Aaron Cuevas Lopez <aacuelo@teleco.upv.es>
Date: Tue, 10 Jan 2017 04:21:45 +0100
Subject: [PATCH] Add machine descriptor field to metadata descriptor

---
 Source/Processors/Channel/MetaData.cpp |  7 ++++---
 Source/Processors/Channel/MetaData.h   | 28 +++++++++++++++++++++-----
 2 files changed, 27 insertions(+), 8 deletions(-)

diff --git a/Source/Processors/Channel/MetaData.cpp b/Source/Processors/Channel/MetaData.cpp
index 850c50f1a..2458f09bf 100644
--- a/Source/Processors/Channel/MetaData.cpp
+++ b/Source/Processors/Channel/MetaData.cpp
@@ -44,8 +44,8 @@ bool checkMetaDataType(MetaDataDescriptor::MetaDataTypes baseType)
 
 //MetaDataDescriptor
 
-MetaDataDescriptor::MetaDataDescriptor(MetaDataDescriptor::MetaDataTypes t, unsigned int length, String n, String d)
-	: m_type(t), m_length(length), m_name(n), m_desc(d)
+MetaDataDescriptor::MetaDataDescriptor(MetaDataDescriptor::MetaDataTypes t, unsigned int length, String n, String d, String dm)
+	: m_name(n), m_description(d), m_descriptor(dm), m_type(t), m_length(length)
 {};
 
 MetaDataDescriptor::~MetaDataDescriptor() {};
@@ -54,7 +54,8 @@ MetaDataDescriptor::MetaDataTypes MetaDataDescriptor::getType() const { return m
 unsigned int MetaDataDescriptor::getLength() const { return m_length; }
 size_t MetaDataDescriptor::getDataSize() const { return m_length*getTypeSize(m_type); }
 String MetaDataDescriptor::getName() const { return m_name; }
-String MetaDataDescriptor::getDescription() const { return m_desc; }
+String MetaDataDescriptor::getDescription() const { return m_description; }
+String MetaDataDescriptor::getDescriptor() const { return m_descriptor; }
 
 bool MetaDataDescriptor::isEqual(const MetaDataDescriptor& other) const
 {
diff --git a/Source/Processors/Channel/MetaData.h b/Source/Processors/Channel/MetaData.h
index ffcf5e9df..db5b8481f 100644
--- a/Source/Processors/Channel/MetaData.h
+++ b/Source/Processors/Channel/MetaData.h
@@ -57,13 +57,30 @@ public:
 		DOUBLE
 	};
 
-	MetaDataDescriptor(MetaDataTypes type, unsigned int length, String name, String desc);
+	/**
+	MetaData descriptor constructor
+	@param type The primitive type this metadata field will hold
+	@param length The length of the data. 1 for single value or mroe for arrays.
+	@param name The human-readable name of this metadata field
+	@param humanDescription A human-readable description of what this field represents
+	@param machineDescriptor A simple machine-readable name for this metadata value
+
+	name and humanDescription will be saved in most data formats for latter reference
+	*/
+	MetaDataDescriptor(MetaDataTypes type, unsigned int length, String name, String humanDescription, String machineDescriptor);
 	~MetaDataDescriptor();
+	/** Gets the primitive type of this field */
 	MetaDataTypes getType() const;
+	/** Gets the number of elements in this field */
 	unsigned int getLength() const;
+	/** Gets the total data in bytes for this field */
 	size_t getDataSize() const;
+	/** Gets the human-readable name of this field */
 	String getName() const;
+	/** Gets the human-readable description of the field */
 	String getDescription() const;
+	/** Gets the machine-readable descriptor for this field */
+	String getDescriptor() const;
 
 	bool isEqual(const MetaDataDescriptor& other) const;
 	bool operator==(const MetaDataDescriptor& other) const;
@@ -71,10 +88,11 @@ public:
 	static size_t getTypeSize(MetaDataTypes type);
 private:
 	MetaDataDescriptor() = delete;
-	String m_name;
-	String m_desc;
-	MetaDataTypes m_type;
-	unsigned int m_length;
+	const String m_name;
+	const String m_descriptor;
+	const String m_description;
+	const MetaDataTypes m_type;
+	const unsigned int m_length;
 
 	JUCE_LEAK_DETECTOR(MetaDataDescriptor);
 };
-- 
GitLab