From 6bc93cb4d04ce6818bb00225e4d1bbbbb6bf62e4 Mon Sep 17 00:00:00 2001
From: Jan Travnicek <Jan.Travnicek@fit.cvut.cz>
Date: Wed, 23 Jan 2019 17:49:30 +0100
Subject: [PATCH] wip add unregister methods to registry classes

---
 .../src/registry/AlgorithmRegistry.cpp        | 25 ++++++++++++++++++-
 .../src/registry/AlgorithmRegistry.hpp        | 25 +++++++++++++++++++
 .../src/registry/CastRegistry.hpp             | 12 +++++++++
 .../src/registry/ContainerRegistry.cpp        |  2 +-
 .../src/registry/ContainerRegistry.hpp        | 25 ++++++++++++++++---
 .../src/registry/ImmediateRegistry.hpp        | 10 ++++++++
 .../src/registry/NormalizeRegistry.hpp        | 20 ++++++++++++---
 .../src/registry/ValuePrinterRegistry.hpp     | 10 ++++++++
 alib2raw/src/registry/RawReaderRegistry.hpp   | 10 ++++++++
 alib2raw/src/registry/RawWriterRegistry.hpp   | 10 ++++++++
 .../src/registry/StringReaderRegistry.hpp     |  8 ++++++
 .../src/registry/StringWriterRegistry.hpp     | 10 ++++++++
 alib2xml/src/registry/XmlComposerRegistry.hpp | 10 ++++++++
 .../registry/XmlContainerParserRegistry.cpp   |  2 +-
 .../registry/XmlContainerParserRegistry.hpp   | 25 ++++++++++++++++---
 alib2xml/src/registry/XmlParserRegistry.hpp   | 10 ++++++++
 16 files changed, 199 insertions(+), 15 deletions(-)

diff --git a/alib2abstraction/src/registry/AlgorithmRegistry.cpp b/alib2abstraction/src/registry/AlgorithmRegistry.cpp
index 394bb6810b..bbed267255 100644
--- a/alib2abstraction/src/registry/AlgorithmRegistry.cpp
+++ b/alib2abstraction/src/registry/AlgorithmRegistry.cpp
@@ -26,7 +26,30 @@ void AlgorithmRegistry::registerInternal ( std::string algorithm, ext::vector <
 	auto & group = getEntries ( ) [ ext::make_pair ( std::move ( algorithm ), std::move ( templateParams ) ) ];
 
 	ext::pair < ext::pair < std::string, ext::set < abstraction::ParamQualifiers::ParamQualifier > >, std::shared_ptr < Entry > > entryValue = ext::make_pair ( std::move ( result ), std::move ( value ) );
-	group.push_back ( ext::make_tuple ( category, std::move ( params ), entryValue ) );
+	group.insert ( group.end ( ), ext::make_tuple ( category, std::move ( params ), entryValue ) );
+}
+
+void AlgorithmRegistry::unregisterInternal ( std::string algorithm, ext::vector < std::string > templateParams, AlgorithmCategories::AlgorithmCategory category, ext::vector < ext::tuple < std::string, ext::set < abstraction::ParamQualifiers::ParamQualifier >, std::string > > params ) {
+	auto & group = getEntries ( ) [ ext::make_pair ( std::move ( algorithm ), std::move ( templateParams ) ) ];
+	auto iter = find_if ( group.begin ( ), group.end ( ), [ & ] ( const ext::tuple < AlgorithmCategories::AlgorithmCategory, ext::vector < ext::tuple < std::string, ext::set < abstraction::ParamQualifiers::ParamQualifier >, std::string > >, ext::pair < ext::pair < std::string, ext::set < abstraction::ParamQualifiers::ParamQualifier > >, std::shared_ptr < Entry > > > & entry ) {
+				if ( std::get < 0 > ( entry ) != category )
+					return false;
+
+				const ext::vector < ext::tuple < std::string, ext::set < abstraction::ParamQualifiers::ParamQualifier >, std::string > > & entryParams = std::get < 1 > ( entry );
+				if ( entryParams.size ( ) != params.size ( ) )
+					return false;
+
+				for ( unsigned i = 0; i < params.size ( ); ++ i ) {
+					if ( std::get < 0 > ( params [ i ] ) != std::get < 0 > ( entryParams [ i ] ) )
+						return false;
+					if ( std::get < 1 > ( params [ i ] ) != std::get < 1 > ( entryParams [ i ] ) )
+						return false;
+				}
+
+				return true;
+			} );
+	if ( iter != group.end ( ) )
+		group.erase ( iter );
 }
 
 ext::map < ext::pair < std::string, ext::vector < std::string > >, ext::list < ext::tuple < AlgorithmCategories::AlgorithmCategory, ext::vector < ext::tuple < std::string, ext::set < abstraction::ParamQualifiers::ParamQualifier >, std::string > >, ext::pair < ext::pair < std::string, ext::set < abstraction::ParamQualifiers::ParamQualifier > >, std::shared_ptr < AlgorithmRegistry::Entry > > > > >::const_iterator AlgorithmRegistry::findAbstractionGroup ( const std::string & name, const ext::vector < std::string > & templateParams ) {
diff --git a/alib2abstraction/src/registry/AlgorithmRegistry.hpp b/alib2abstraction/src/registry/AlgorithmRegistry.hpp
index 4445b3c833..2c3f453930 100644
--- a/alib2abstraction/src/registry/AlgorithmRegistry.hpp
+++ b/alib2abstraction/src/registry/AlgorithmRegistry.hpp
@@ -116,9 +116,34 @@ class AlgorithmRegistry {
 
 	static void registerInternal ( std::string algorithm, ext::vector < std::string > templateParams, AlgorithmCategories::AlgorithmCategory category, ext::pair < std::string, ext::set < abstraction::ParamQualifiers::ParamQualifier > > result, ext::vector < ext::tuple < std::string, ext::set < abstraction::ParamQualifiers::ParamQualifier >, std::string > > params, std::shared_ptr < Entry > value );
 
+	static void unregisterInternal ( std::string algorithm, ext::vector < std::string > templateParams, AlgorithmCategories::AlgorithmCategory category, ext::vector < ext::tuple < std::string, ext::set < abstraction::ParamQualifiers::ParamQualifier >, std::string > > params );
+
 	static ext::map < ext::pair < std::string, ext::vector < std::string > >, ext::list < ext::tuple < AlgorithmCategories::AlgorithmCategory, ext::vector < ext::tuple < std::string, ext::set < abstraction::ParamQualifiers::ParamQualifier >, std::string > >, ext::pair < ext::pair < std::string, ext::set < abstraction::ParamQualifiers::ParamQualifier > >, std::shared_ptr < Entry > > > > >::const_iterator findAbstractionGroup ( const std::string & algorithm, const ext::vector < std::string > & templateParams );
 
 public:
+	template < class Algo, class ObjectType, class ... ParamTypes >
+	static void unregisterMethod ( std::string methodName ) {
+		AlgorithmCategories::AlgorithmCategory category = AlgorithmCategories::AlgorithmCategory::DEFAULT;
+		std::string algorithm = ext::to_string < Algo > ( ) + "::" + methodName;
+		ext::vector < std::string > templateParams;
+
+		ext::vector < ext::tuple < std::string, ext::set < abstraction::ParamQualifiers::ParamQualifier >, std::string > > params = convertParamTypes < ParamTypes ... > ( std::array < std::string, sizeof ... ( ParamTypes ) > { } );
+		params.insert ( params.begin ( ), convertParamType < ObjectType & > ( "object" ) );
+
+		unregisterInternal ( std::move ( algorithm ), std::move ( templateParams ), category, std::move ( params ) );
+	}
+
+	template < class Algo, class ... ParamTypes >
+	static void unregisterAlgorithm ( AlgorithmCategories::AlgorithmCategory category ) {
+		std::string algorithm = ext::to_string < Algo > ( );
+		ext::vector < std::string > templateParams = ext::get_template_info ( algorithm );
+		algorithm = ext::erase_template_info ( algorithm );
+
+		ext::vector < ext::tuple < std::string, ext::set < abstraction::ParamQualifiers::ParamQualifier >, std::string > > params = convertParamTypes < ParamTypes ... > ( std::array < std::string, sizeof ... ( ParamTypes ) > { } );
+
+		unregisterInternal ( std::move ( algorithm ), std::move ( templateParams ), category, std::move ( params ) );
+	}
+
 	template < class Algo, class ObjectType, class ReturnType, class ... ParamTypes >
 	static void registerMethod ( ReturnType ( ObjectType:: * callback ) ( ParamTypes ... ), std::string methodName, std::array < std::string, sizeof ... ( ParamTypes ) > paramNames ) {
 		AlgorithmCategories::AlgorithmCategory category = AlgorithmCategories::AlgorithmCategory::DEFAULT;
diff --git a/alib2abstraction/src/registry/CastRegistry.hpp b/alib2abstraction/src/registry/CastRegistry.hpp
index 9cb3097bcc..c99e8e0e03 100644
--- a/alib2abstraction/src/registry/CastRegistry.hpp
+++ b/alib2abstraction/src/registry/CastRegistry.hpp
@@ -53,6 +53,18 @@ class CastRegistry {
 	};
 
 public:
+	static void unregisterCast ( std::string target, std::string param ) {
+		getEntries ( ).erase ( std::make_pair ( target, param ) );
+	}
+
+	template < class TargetType, class ParamType >
+	static void unregisterCast ( ) {
+		std::string target = ext::to_string < TargetType > ( );
+		std::string param = ext::to_string < ParamType > ( );
+
+		unregisterCast ( target, param );
+	}
+
 	template < class TargetType, class ParamType >
 	static void registerCast ( std::string target, std::string param ) {
 		if ( ! getEntries ( ).insert ( std::make_pair ( std::make_pair ( target, param ), std::unique_ptr < Entry > ( new DefaultEntryImpl < TargetType, ParamType > ( ) ) ) ).second )
diff --git a/alib2abstraction/src/registry/ContainerRegistry.cpp b/alib2abstraction/src/registry/ContainerRegistry.cpp
index 430acd89d8..e5f0b55cac 100644
--- a/alib2abstraction/src/registry/ContainerRegistry.cpp
+++ b/alib2abstraction/src/registry/ContainerRegistry.cpp
@@ -42,7 +42,7 @@ ext::set < std::string > ContainerRegistry::listOverloads ( const std::string &
 ext::set < std::string > ContainerRegistry::list ( ) {
 	ext::set < std::string > res;
 
-	for ( const std::pair < const std::string, ext::vector < ext::pair < std::string, std::shared_ptr < Entry > > > > & groups : getEntries ( ) )
+	for ( const std::pair < const std::string, ext::list < ext::pair < std::string, std::shared_ptr < Entry > > > > & groups : getEntries ( ) )
 		res.insert ( groups.first );
 
 	return res;
diff --git a/alib2abstraction/src/registry/ContainerRegistry.hpp b/alib2abstraction/src/registry/ContainerRegistry.hpp
index 441ee1d26e..c923a329db 100644
--- a/alib2abstraction/src/registry/ContainerRegistry.hpp
+++ b/alib2abstraction/src/registry/ContainerRegistry.hpp
@@ -10,7 +10,7 @@
 
 #include <alib/functional>
 #include <alib/memory>
-#include <alib/vector>
+#include <alib/list>
 #include <alib/string>
 #include <alib/set>
 #include <alib/map>
@@ -39,12 +39,29 @@ class ContainerRegistry {
 		}
 	};
 
-	static ext::map < std::string, ext::vector < ext::pair < std::string, std::shared_ptr < Entry > > > > & getEntries ( ) {
-		static ext::map < std::string, ext::vector < ext::pair < std::string, std::shared_ptr < Entry > > > > containerGroups;
+	static ext::map < std::string, ext::list < ext::pair < std::string, std::shared_ptr < Entry > > > > & getEntries ( ) {
+		static ext::map < std::string, ext::list < ext::pair < std::string, std::shared_ptr < Entry > > > > containerGroups;
 		return containerGroups;
 	};
 
 public:
+	static void unregisterSet ( std::string param ) {
+		std::string container = "Set";
+
+		auto & group = getEntries ( ) [ container ];
+		auto iter = find_if ( group.begin ( ), group.end ( ), [ & ] ( const ext::pair < std::string, std::shared_ptr < Entry > > & entry ) {
+				return entry.first == param;
+				} );
+		if ( iter != group.end ( ) )
+			group.erase ( iter );
+	}
+
+	template < class ParamTypes >
+	static void unregisterSet ( ) {
+		std::string param = ext::to_string < typename std::decay < ParamTypes >::type > ( );
+		unregisterSet ( param );
+	}
+
 	template < class ParamTypes >
 	static void registerSet ( std::string param ) {
 		std::string container = "Set";
@@ -55,7 +72,7 @@ public:
 				throw std::invalid_argument ( "Callback for " + container + " already registered." );
 
 		std::shared_ptr < Entry > entryValue = std::make_shared < SetEntryImpl < ParamTypes > > ( );
-		group.push_back ( ext::make_pair ( param, entryValue ) );
+		group.insert ( group.end ( ), ext::make_pair ( param, entryValue ) );
 	}
 
 	template < class ParamTypes >
diff --git a/alib2abstraction/src/registry/ImmediateRegistry.hpp b/alib2abstraction/src/registry/ImmediateRegistry.hpp
index 2556cc4ef7..d20e413796 100644
--- a/alib2abstraction/src/registry/ImmediateRegistry.hpp
+++ b/alib2abstraction/src/registry/ImmediateRegistry.hpp
@@ -45,6 +45,16 @@ class ImmediateRegistry {
 	}
 
 public:
+	static void unregisterImmediate ( std::string result ) {
+		getEntries ( ).erase ( result );
+	}
+
+	template < class ResultType >
+	static void unregisterImmediate ( ) {
+		std::string result = ext::to_string < ResultType > ( );
+		unregisterImmediate ( std::move ( result ) );
+	}
+
 	template < class ResultType >
 	static void registerImmediate ( std::string result ) {
 		if ( ! getEntries ( ).insert ( std::make_pair ( result, std::unique_ptr < Entry > ( new EntryImpl < ResultType > ( ) ) ) ).second )
diff --git a/alib2abstraction/src/registry/NormalizeRegistry.hpp b/alib2abstraction/src/registry/NormalizeRegistry.hpp
index 2e347212f1..7d8365e4eb 100644
--- a/alib2abstraction/src/registry/NormalizeRegistry.hpp
+++ b/alib2abstraction/src/registry/NormalizeRegistry.hpp
@@ -49,14 +49,26 @@ class NormalizeRegistry {
 
 public:
 	template < class ParamType >
-	static void registerNormalize ( std::string param ) {
-		getEntries ( ) [ param ].push_back ( std::unique_ptr < Entry > ( new EntryImpl < ParamType > ( ) ) );
+	static void unregisterNormalize ( std::string param, std::list < std::unique_ptr < Entry > >::const_iterator iter ) {
+		getEntries ( ) [ param ].erase ( iter );
 	}
 
 	template < class ParamType >
-	static void registerNormalize ( ) {
+	static void unregisterNormalize ( std::list < std::unique_ptr < Entry > >::const_iterator iter ) {
 		std::string param = ext::to_string < ParamType > ( );
-		registerNormalize < ParamType > ( std::move ( param ) );
+		unregisterNormalize < ParamType > ( std::move ( param ), iter );
+	}
+
+	template < class ParamType >
+	static std::list < std::unique_ptr < Entry > >::const_iterator registerNormalize ( std::string param ) {
+		auto & entry = getEntries ( ) [ param ];
+		return entry.insert ( entry.end ( ), std::unique_ptr < Entry > ( new EntryImpl < ParamType > ( ) ) );
+	}
+
+	template < class ParamType >
+	static std::list < std::unique_ptr < Entry > >::const_iterator registerNormalize ( ) {
+		std::string param = ext::to_string < ParamType > ( );
+		return registerNormalize < ParamType > ( std::move ( param ) );
 	}
 
 	static bool hasNormalize ( const std::string & param );
diff --git a/alib2abstraction/src/registry/ValuePrinterRegistry.hpp b/alib2abstraction/src/registry/ValuePrinterRegistry.hpp
index 111d1f8929..9563dc7606 100644
--- a/alib2abstraction/src/registry/ValuePrinterRegistry.hpp
+++ b/alib2abstraction/src/registry/ValuePrinterRegistry.hpp
@@ -45,6 +45,16 @@ class ValuePrinterRegistry {
 	}
 
 public:
+	static void unregisterValuePrinter ( std::string param ) {
+		getEntries ( ).erase ( param );
+	}
+
+	template < class ParamType >
+	static void unregisterValuePrinter ( ) {
+		std::string param = ext::to_string < ParamType > ( );
+		unregisterValuePrinter ( std::move ( param ) );
+	}
+
 	template < class ParamType >
 	static void registerValuePrinter ( std::string param ) {
 		if ( ! getEntries ( ).insert ( std::make_pair ( param, std::unique_ptr < Entry > ( new EntryImpl < ParamType > ( ) ) ) ).second )
diff --git a/alib2raw/src/registry/RawReaderRegistry.hpp b/alib2raw/src/registry/RawReaderRegistry.hpp
index 156c584985..2714eb86cf 100644
--- a/alib2raw/src/registry/RawReaderRegistry.hpp
+++ b/alib2raw/src/registry/RawReaderRegistry.hpp
@@ -42,6 +42,16 @@ class RawReaderRegistry {
 	}
 
 public:
+	static void unregisterRawReader ( std::string type ) {
+		getEntries ( ).erase ( type );
+	}
+
+	template < class ReturnType >
+	static void unregisterRawReader ( ) {
+		std::string type = ext::to_string < ReturnType > ( );
+		unregisterRawReader ( std::move ( type ) );
+	}
+
 	template < class ReturnType >
 	static void registerRawReader ( std::string type ) {
 		if ( ! getEntries ( ).insert ( std::make_pair ( std::move ( type ), std::unique_ptr < Entry > ( new EntryImpl < ReturnType > ( ) ) ) ).second )
diff --git a/alib2raw/src/registry/RawWriterRegistry.hpp b/alib2raw/src/registry/RawWriterRegistry.hpp
index 886ee8553b..e4f48da19d 100644
--- a/alib2raw/src/registry/RawWriterRegistry.hpp
+++ b/alib2raw/src/registry/RawWriterRegistry.hpp
@@ -45,6 +45,16 @@ class RawWriterRegistry {
 	}
 
 public:
+	static void unregisterRawWriter ( std::string param ) {
+		getEntries ( ).erase ( param );
+	}
+
+	template < class ParamType >
+	static void unregisterRawWriter ( ) {
+		std::string param = ext::to_string < ParamType > ( );
+		unregisterRawWriter ( std::move ( param ) );
+	}
+
 	template < class ParamType >
 	static void registerRawWriter ( std::string param ) {
 		if ( ! getEntries ( ).insert ( std::make_pair ( std::move ( param ), std::unique_ptr < Entry > ( new EntryImpl < ParamType > ( ) ) ) ).second )
diff --git a/alib2str/src/registry/StringReaderRegistry.hpp b/alib2str/src/registry/StringReaderRegistry.hpp
index 5f33c77682..688572360b 100644
--- a/alib2str/src/registry/StringReaderRegistry.hpp
+++ b/alib2str/src/registry/StringReaderRegistry.hpp
@@ -45,6 +45,14 @@ class StringReaderRegistry {
 	}
 
 public:
+	template < class Group, class ReturnType >
+	static void unregisterStringReader ( ) {
+		std::string group = ext::to_string < Group > ( );
+		std::string returnType = ext::to_string < ReturnType > ( );
+
+		getEntries ( ) [ group ].erase ( returnType );
+	}
+
 	template < class Group, class ReturnType >
 	static void registerStringReader ( ) {
 		std::string group = ext::to_string < Group > ( );
diff --git a/alib2str/src/registry/StringWriterRegistry.hpp b/alib2str/src/registry/StringWriterRegistry.hpp
index 5aca32764f..9e4ff0573f 100644
--- a/alib2str/src/registry/StringWriterRegistry.hpp
+++ b/alib2str/src/registry/StringWriterRegistry.hpp
@@ -46,6 +46,16 @@ class StringWriterRegistry {
 	}
 
 public:
+	static void unregisterStringWriter ( std::string param ) {
+		getEntries ( ).erase ( param );
+	}
+
+	template < class ParamType >
+	static void unregisterStringWriter ( ) {
+		std::string param = ext::to_string < ParamType > ( );
+		unregisterStringWriter ( std::move ( param ) );
+	}
+
 	template < class ParamType >
 	static void registerStringWriter ( std::string param ) {
 		if ( ! getEntries ( ).insert ( std::make_pair ( std::move ( param ), std::unique_ptr < Entry > ( new EntryImpl < ParamType > ( ) ) ) ).second )
diff --git a/alib2xml/src/registry/XmlComposerRegistry.hpp b/alib2xml/src/registry/XmlComposerRegistry.hpp
index b2161fc090..3ef67205fa 100644
--- a/alib2xml/src/registry/XmlComposerRegistry.hpp
+++ b/alib2xml/src/registry/XmlComposerRegistry.hpp
@@ -46,6 +46,16 @@ class XmlComposerRegistry {
 	}
 
 public:
+	static void unregisterXmlComposer ( std::string param ) {
+		getEntries ( ).erase ( param );
+	}
+
+	template < class ParamType >
+	static void unregisterXmlComposer ( ) {
+		std::string param = ext::to_string < ParamType > ( );
+		unregisterXmlComposer ( std::move ( param ) );
+	}
+
 	template < class ParamType >
 	static void registerXmlComposer ( std::string param ) {
 		if ( ! getEntries ( ).insert ( std::make_pair ( param, std::unique_ptr < Entry > ( new EntryImpl < ParamType > ( ) ) ) ).second )
diff --git a/alib2xml/src/registry/XmlContainerParserRegistry.cpp b/alib2xml/src/registry/XmlContainerParserRegistry.cpp
index f696ab1384..9aab4578a8 100644
--- a/alib2xml/src/registry/XmlContainerParserRegistry.cpp
+++ b/alib2xml/src/registry/XmlContainerParserRegistry.cpp
@@ -41,7 +41,7 @@ ext::set < std::string > XmlContainerParserRegistry::listOverloads ( const std::
 ext::set < std::string > XmlContainerParserRegistry::list ( ) {
 	ext::set < std::string > res;
 
-	for ( const std::pair < const std::string, ext::vector < ext::pair < std::string, std::shared_ptr < Entry > > > > & groups : getEntries ( ) )
+	for ( const std::pair < const std::string, ext::list < ext::pair < std::string, std::shared_ptr < Entry > > > > & groups : getEntries ( ) )
 		res.insert ( groups.first );
 
 	return res;
diff --git a/alib2xml/src/registry/XmlContainerParserRegistry.hpp b/alib2xml/src/registry/XmlContainerParserRegistry.hpp
index dbe0c6ef86..e13b4bb4d1 100644
--- a/alib2xml/src/registry/XmlContainerParserRegistry.hpp
+++ b/alib2xml/src/registry/XmlContainerParserRegistry.hpp
@@ -10,7 +10,7 @@
 
 #include <alib/functional>
 #include <alib/memory>
-#include <alib/vector>
+#include <alib/list>
 #include <alib/string>
 #include <alib/set>
 #include <alib/map>
@@ -39,12 +39,29 @@ class XmlContainerParserRegistry {
 		}
 	};
 
-	static ext::map < std::string, ext::vector < ext::pair < std::string, std::shared_ptr < Entry > > > > & getEntries ( ) {
-		static ext::map < std::string, ext::vector < ext::pair < std::string, std::shared_ptr < Entry > > > > containerGroups;
+	static ext::map < std::string, ext::list < ext::pair < std::string, std::shared_ptr < Entry > > > > & getEntries ( ) {
+		static ext::map < std::string, ext::list < ext::pair < std::string, std::shared_ptr < Entry > > > > containerGroups;
 		return containerGroups;
 	};
 
 public:
+	static void unregisterSet ( std::string param ) {
+		std::string container = "Set";
+
+		auto & group = getEntries ( ) [ container ];
+		auto iter = find_if ( group.begin ( ), group.end ( ), [ & ] ( const ext::pair < std::string, std::shared_ptr < Entry > > & entry ) {
+				return entry.first == param;
+				} );
+		if ( iter != group.end ( ) )
+			group.erase ( iter );
+	}
+
+	template < class ParamTypes >
+	static void unregisterSet ( ) {
+		std::string param = ext::to_string < typename std::decay < ParamTypes >::type > ( );
+		unregisterSet ( param );
+	}
+
 	template < class ParamTypes >
 	static void registerSet ( std::string param ) {
 		std::string container = "Set";
@@ -55,7 +72,7 @@ public:
 				throw exception::CommonException ( "Callback for " + container + " already registered." );
 
 		std::shared_ptr < Entry > entryValue = std::make_shared < SetEntryImpl < ParamTypes > > ( );
-		group.push_back ( ext::make_pair ( param, entryValue ) );
+		group.insert ( group.end ( ), ext::make_pair ( param, entryValue ) );
 	}
 
 	template < class ParamTypes >
diff --git a/alib2xml/src/registry/XmlParserRegistry.hpp b/alib2xml/src/registry/XmlParserRegistry.hpp
index e2ea08c121..e920e20b19 100644
--- a/alib2xml/src/registry/XmlParserRegistry.hpp
+++ b/alib2xml/src/registry/XmlParserRegistry.hpp
@@ -45,6 +45,16 @@ class XmlParserRegistry {
 	}
 
 public:
+	static void unregisterXmlParser ( std::string result ) {
+		getEntries ( ).erase ( result );
+	}
+
+	template < class ReturnType >
+	static void unregisterXmlParser ( ) {
+		std::string ret = core::xmlApi < ReturnType >::xmlTagName ( );
+		unregisterXmlParser ( ret );
+	}
+
 	template < class ReturnType >
 	static void registerXmlParser ( std::string result ) {
 		if ( ! getEntries ( ).insert ( std::make_pair ( result, std::unique_ptr < Entry > ( new EntryImpl < ReturnType > ( ) ) ) ).second )
-- 
GitLab