Refactor templated type type name

Delete duplicated templated of element structure.

Test: mma
Change-Id: I72e344a648e44a2804d8d3a776cda0c143bcd140
diff --git a/EnumType.cpp b/EnumType.cpp
index 4826557..4502a5e 100644
--- a/EnumType.cpp
+++ b/EnumType.cpp
@@ -799,8 +799,8 @@
     return true;
 }
 
-std::string BitFieldType::typeName() const {
-    return "mask of " + mElementType->typeName();
+std::string BitFieldType::templatedTypeName() const {
+    return "mask";
 }
 
 bool BitFieldType::isCompatibleElementType(const Type* elementType) const {
diff --git a/EnumType.h b/EnumType.h
index d565fcd..269b08d 100644
--- a/EnumType.h
+++ b/EnumType.h
@@ -159,7 +159,7 @@
 struct BitFieldType : public TemplatedType {
     BitFieldType(Scope* parent);
 
-    std::string typeName() const override;
+    std::string templatedTypeName() const override;
 
     bool isBitField() const override;
 
diff --git a/FmqType.cpp b/FmqType.cpp
index 51d0bd9..38a984e 100644
--- a/FmqType.cpp
+++ b/FmqType.cpp
@@ -26,8 +26,8 @@
 FmqType::FmqType(const char* nsp, const char* name, Scope* parent)
     : TemplatedType(parent), mNamespace(nsp), mName(name) {}
 
-std::string FmqType::typeName() const {
-    return mName + " of " + mElementType->typeName();
+std::string FmqType::templatedTypeName() const {
+    return mName;
 }
 
 std::string FmqType::fullName() const {
diff --git a/FmqType.h b/FmqType.h
index 88b991a..d8e4397 100644
--- a/FmqType.h
+++ b/FmqType.h
@@ -27,7 +27,7 @@
 
     std::string fullName() const;
 
-    std::string typeName() const;
+    std::string templatedTypeName() const;
 
     std::string getCppType(
             StorageMode mode,
diff --git a/RefType.cpp b/RefType.cpp
index 441a38f..87c5cd5 100644
--- a/RefType.cpp
+++ b/RefType.cpp
@@ -26,8 +26,8 @@
 
 RefType::RefType(Scope* parent) : TemplatedType(parent) {}
 
-std::string RefType::typeName() const {
-    return "ref of " + mElementType->typeName();
+std::string RefType::templatedTypeName() const {
+    return "ref";
 }
 
 std::vector<const Reference<Type>*> RefType::getStrongReferences() const {
diff --git a/RefType.h b/RefType.h
index 3af6424..9dffdac 100644
--- a/RefType.h
+++ b/RefType.h
@@ -28,7 +28,7 @@
 struct RefType : public TemplatedType {
     RefType(Scope* parent);
 
-    std::string typeName() const override;
+    std::string templatedTypeName() const override;
 
     bool isCompatibleElementType(const Type* elementType) const override;
 
diff --git a/Type.cpp b/Type.cpp
index 82efab2..e4a8e58 100644
--- a/Type.cpp
+++ b/Type.cpp
@@ -631,6 +631,10 @@
 
 TemplatedType::TemplatedType(Scope* parent) : Type(parent) {}
 
+std::string TemplatedType::typeName() const {
+    return templatedTypeName() + " of " + mElementType->typeName();
+}
+
 void TemplatedType::setElementType(const Reference<Type>& elementType) {
     // can only be set once.
     CHECK(mElementType.isEmptyReference());
diff --git a/Type.h b/Type.h
index b5b3a3e..731441e 100644
--- a/Type.h
+++ b/Type.h
@@ -316,6 +316,9 @@
     void setElementType(const Reference<Type>& elementType);
     const Type* getElementType() const;
 
+    virtual std::string templatedTypeName() const = 0;
+    std::string typeName() const override;
+
     bool isTemplatedType() const override;
 
     virtual bool isCompatibleElementType(const Type* elementType) const = 0;
diff --git a/VectorType.cpp b/VectorType.cpp
index aa50fae..524be55 100644
--- a/VectorType.cpp
+++ b/VectorType.cpp
@@ -27,8 +27,8 @@
 
 VectorType::VectorType(Scope* parent) : TemplatedType(parent) {}
 
-std::string VectorType::typeName() const {
-    return "vector of " + mElementType->typeName();
+std::string VectorType::templatedTypeName() const {
+    return "vector";
 }
 
 bool VectorType::isCompatibleElementType(const Type* elementType) const {
diff --git a/VectorType.h b/VectorType.h
index 0623496..4b8cad8 100644
--- a/VectorType.h
+++ b/VectorType.h
@@ -31,7 +31,7 @@
     bool isVector() const override;
     bool isVectorOfBinders() const;
 
-    std::string typeName() const override;
+    std::string templatedTypeName() const override;
     bool isCompatibleElementType(const Type* elementType) const override;
 
     std::vector<const Reference<Type>*> getStrongReferences() const override;