Index: configure.ac
===================================================================
--- configure.ac	(revision 746ff1e6abdd4d0f2841706e63c0d09e2ec65671)
+++ configure.ac	(revision 7245643e0267aa45e523605af141c1d6d5d8261f)
@@ -3,5 +3,5 @@
 
 AC_PREREQ([2.65])
-AC_INIT([CodePatterns], [1.0.2], [heber@ins.uni-bonn.de], [codepatterns], [http://trac.ins.uni-bonn.de/projects/CodePatterns/])
+AC_INIT([CodePatterns], [1.0.3], [heber@ins.uni-bonn.de], [codepatterns], [http://trac.ins.uni-bonn.de/projects/CodePatterns/])
 AC_CONFIG_AUX_DIR(config)
 AC_CONFIG_SRCDIR([src/Patterns/Singleton_impl.hpp])
@@ -25,6 +25,6 @@
 # refer to the libtool manual, section "Updating library version information":
 # http://www.gnu.org/software/libtool/manual/html_node/Updating-version-info.html
-AC_SUBST([CODEPATTERNS_SO_VERSION], [2:0:0])
-AC_SUBST([CODEPATTERNS_API_VERSION], [1.0.2])
+AC_SUBST([CODEPATTERNS_SO_VERSION], [2:1:0])
+AC_SUBST([CODEPATTERNS_API_VERSION], [1.0.3])
 
 # Checks for libraries.
Index: src/Patterns/Factory.hpp
===================================================================
--- src/Patterns/Factory.hpp	(revision 746ff1e6abdd4d0f2841706e63c0d09e2ec65671)
+++ src/Patterns/Factory.hpp	(revision 7245643e0267aa45e523605af141c1d6d5d8261f)
@@ -15,4 +15,7 @@
 
 #include <map>
+#include <typeinfo>
+
+#include "Assert.hpp"
 
 #include "Creator.hpp"
@@ -285,4 +288,15 @@
   }
 
+  /** Getter for desired type of product.
+   *
+   * @param type_info object of the desired type
+   * @return reference to copy of current type product or NULL if type mismatch
+   */
+  T* getProduct(const std::type_info &instance_type_info) const
+  {
+    ASSERT(types.count(instance_type_info.name()) != 0,
+        "Factory<"+toString(typeid(T).name())+">::getProduct() - type info name "+instance_type_info.name()+" is not registered.");
+    return PrototypeTable[ types[instance_type_info.name()] ]->create();
+  }
 
   /** Getter for current type of product.
@@ -330,4 +344,8 @@
   void FillEnumTable();
 
+  typedef std::map<
+      std::string,
+      TypeList
+      > TypeMap;
   typedef std::map<
       std::string,
@@ -344,4 +362,5 @@
 
   static TypeList currenttype;
+  static TypeMap types;
   static EnumMap enums;
   static InstanceTable PrototypeTable;
@@ -350,4 +369,5 @@
 
 template <class T> typename Factory<T>::TypeList Factory<T>::currenttype = (typename Factory<T>::TypeList)0;
+template <class T> typename Factory<T>::TypeMap Factory<T>::types;
 template <class T> typename Factory<T>::EnumMap Factory<T>::enums;
 template <class T> typename Factory<T>::NameMap Factory<T>::names;
Index: src/Patterns/Factory_impl.hpp
===================================================================
--- src/Patterns/Factory_impl.hpp	(revision 746ff1e6abdd4d0f2841706e63c0d09e2ec65671)
+++ src/Patterns/Factory_impl.hpp	(revision 7245643e0267aa45e523605af141c1d6d5d8261f)
@@ -16,4 +16,5 @@
 #include <boost/preprocessor/punctuation/comma.hpp>
 #include <boost/preprocessor/punctuation/comma_if.hpp>
+#include <boost/preprocessor/punctuation/paren.hpp>
 #include <boost/preprocessor/seq/elem.hpp>
 #include <boost/preprocessor/seq/size.hpp>
@@ -52,27 +53,4 @@
 #endif
 
-/** Functions that allows to print a given seq of elements in the way of
- *  std::map from strings to enums.
- *
- * e.g. let "seq" be defined as
- * #define seq (one)(two)(three)(four)
- *
- * then we use
- * #define BOOST_PP_LOCAL_MACRO(n) seqitems_as_string_enum_map(seqsize, n, seq, EnumMap, name_space)
- * #define BOOST_PP_LOCAL_LIMITS  (0, BOOST_PP_SEQ_SIZE(seq)-1 )
- * #include BOOST_PP_LOCAL_ITERATE()
- *
- * which expands by the preprocessor to:
- * EnumMap["one"] = test:: one;
- * EnumMap["two"] = test:: two;
- * EnumMap["three"] = test:: three;
- * EnumMap["four"] = test:: four;
-
- */
-#define seqitems_as_string_enum_map(z,n,seq_with_elements, map, name_space) \
-  map [BOOST_PP_STRINGIZE( \
-  BOOST_PP_SEQ_ELEM(n, seq_with_elements) \
-  )] = name_space BOOST_PP_SEQ_ELEM(n, seq_with_elements) \
-  ;
 
 /** Functions that allows to print a given seq of elements in the way of
@@ -92,5 +70,5 @@
  * EnumMap[three] = test::three;
  * EnumMap[four] = test::four;
-
+ *
  */
 #define seqitems_as_enum_key_map(z,n,seq_with_elements, map, keytype, name_space, suffix) \
@@ -99,4 +77,38 @@
   ] = keytype< name_space BOOST_PP_SEQ_ELEM(n, seq_with_elements) suffix > ();
 
+/** Functions that allows to print a given seq of elements in the way of
+ *  std::map from strings to enums.
+ *
+ * e.g. let "seq" be defined as
+ * #define seq (one)(two)(three)(four)
+ *
+ * then we use
+ * #define BOOST_PP_LOCAL_MACRO(n) seqitems_as_enum_value_map(seqsize, n, seq, EnumMap, typid BOOST_PP_LPAREN() super:: , BOOST_PP_RPAREN().name() , test::)
+ * #define BOOST_PP_LOCAL_LIMITS  (0, BOOST_PP_SEQ_SIZE(seq)-1 )
+ * #include BOOST_PP_LOCAL_ITERATE()
+ *
+ * which expands by the preprocessor to:
+ * EnumMap[ typeid ( super:: one ) .name() ] = test::one;
+ * EnumMap[ typeid ( super:: two ) .name() ] = test::two;
+ * EnumMap[ typeid ( super:: three ) .name() ] = test::three;
+ * EnumMap[ typeid ( super:: four ) .name() ] = test::four;
+ *
+ * or we use
+ * #define BOOST_PP_LOCAL_MACRO(n) seqitems_as_enum_value_map(seqsize, n, seq, EnumMap, BOOST_PP_STRINGIZE BOOST_PP_LPAREN() , BOOST_PP_RPAREN() , test::)
+ * #define BOOST_PP_LOCAL_LIMITS  (0, BOOST_PP_SEQ_SIZE(seq)-1 )
+ * #include BOOST_PP_LOCAL_ITERATE()
+ *
+ * which expands by the preprocessor to:
+ * EnumMap[ "one" ] = test:: one;
+ * EnumMap[ "two" ] = test:: two;
+ * EnumMap[ "three" ] = test:: three;
+ * EnumMap[ "four" ] = test:: four;
+ */
+#define seqitems_as_enum_value_map(z,n,seq_with_elements, map, type_specifier, type_suffix, enum_name_space) \
+  map [ type_specifier  \
+  BOOST_PP_SEQ_ELEM(n, seq_with_elements) \
+  type_suffix \
+  ] = enum_name_space BOOST_PP_SEQ_ELEM(n, seq_with_elements);
+
 
 template <>
@@ -104,5 +116,10 @@
 {
   // insert all known (enum, string) keys
-#define BOOST_PP_LOCAL_MACRO(n) seqitems_as_string_enum_map(~, n, type_seq, enums, FactoryTypeList<Abstract_Interface_Class>::)
+#define BOOST_PP_LOCAL_MACRO(n) seqitems_as_enum_value_map(~, n, type_seq, enums, BOOST_PP_STRINGIZE BOOST_PP_LPAREN() , BOOST_PP_RPAREN() , FactoryTypeList<Abstract_Interface_Class>::)
+#define BOOST_PP_LOCAL_LIMITS  (0, BOOST_PP_SEQ_SIZE(type_seq)-1 )
+#include BOOST_PP_LOCAL_ITERATE()
+
+  // insert all known (type, enum) keys
+#define BOOST_PP_LOCAL_MACRO(n) seqitems_as_enum_value_map(~, n, type_seq, types, typeid BOOST_PP_LPAREN() type_name_space , type_name_space_suffix BOOST_PP_RPAREN() .name(), FactoryTypeList<Abstract_Interface_Class>::)
 #define BOOST_PP_LOCAL_LIMITS  (0, BOOST_PP_SEQ_SIZE(type_seq)-1 )
 #include BOOST_PP_LOCAL_ITERATE()
Index: src/Patterns/unittests/CreatorUnitTest.cpp
===================================================================
--- src/Patterns/unittests/CreatorUnitTest.cpp	(revision 746ff1e6abdd4d0f2841706e63c0d09e2ec65671)
+++ src/Patterns/unittests/CreatorUnitTest.cpp	(revision 7245643e0267aa45e523605af141c1d6d5d8261f)
@@ -25,4 +25,5 @@
 
 #include "Creator.hpp"
+#include "stubs/CommonStub.hpp"
 #include "stubs/CreatorStub.hpp"
 
Index: src/Patterns/unittests/FactoryUnitTest.cpp
===================================================================
--- src/Patterns/unittests/FactoryUnitTest.cpp	(revision 746ff1e6abdd4d0f2841706e63c0d09e2ec65671)
+++ src/Patterns/unittests/FactoryUnitTest.cpp	(revision 7245643e0267aa45e523605af141c1d6d5d8261f)
@@ -22,4 +22,5 @@
 #include "FactoryUnitTest.hpp"
 
+#include "stubs/CommonStub.hpp"
 #include "stubs/FactoryStub.hpp"
 
@@ -68,9 +69,16 @@
 void FactoryTest::setUp()
 {
-  FactoryStub::getInstance();
+  rndA =
+      FactoryStub::getInstance().
+      PrototypeTable[FactoryStub::Aclass]->create();
+  rndB =
+      FactoryStub::getInstance().
+      PrototypeTable[FactoryStub::Bclass]->create();
 }
 
 void FactoryTest::tearDown()
 {
+  delete rndA;
+  delete rndB;
   FactoryStub::purgeInstance();
 }
@@ -93,12 +101,37 @@
   }
 
-  // check one of the distributions in the table
-  ICreatorStub * rnd =
-      FactoryStub::getInstance().
-      PrototypeTable[FactoryStub::Aclass]->create();
+  // check distributions in the table
   CPPUNIT_ASSERT_EQUAL(
       std::string(typeid(teststubs::Aclass).name()),
-      rnd->name()
+      rndA->name()
   );
-  delete rnd;
+  CPPUNIT_ASSERT_EQUAL(
+      std::string(typeid(teststubs::Bclass).name()),
+      rndB->name()
+  );
 }
+
+
+void FactoryTest::getProductEnumTest()
+{
+  ICreatorStub * rndA_1 =
+      FactoryStub::getInstance().getProduct(FactoryStub::Aclass);
+  CPPUNIT_ASSERT( typeid(*rndA) == typeid(*rndA_1) );
+  delete rndA_1;
+}
+
+void FactoryTest::getProductNameTest()
+{
+  ICreatorStub * rndA_1 =
+      FactoryStub::getInstance().getProduct(std::string("Aclass"));
+  CPPUNIT_ASSERT( typeid(*rndA) == typeid(*rndA_1) );
+  delete rndA_1;
+}
+
+void FactoryTest::getProductTypeTest()
+{
+  ICreatorStub * rndA_1 =
+      FactoryStub::getInstance().getProduct( typeid(teststubs::Aclass) );
+  CPPUNIT_ASSERT( typeid(*rndA) == typeid(*rndA_1) );
+  delete rndA_1;
+}
Index: src/Patterns/unittests/FactoryUnitTest.hpp
===================================================================
--- src/Patterns/unittests/FactoryUnitTest.hpp	(revision 746ff1e6abdd4d0f2841706e63c0d09e2ec65671)
+++ src/Patterns/unittests/FactoryUnitTest.hpp	(revision 7245643e0267aa45e523605af141c1d6d5d8261f)
@@ -14,4 +14,5 @@
 #endif
 
+class ICreatorStub;
 
 #include <cppunit/extensions/HelperMacros.h>
@@ -21,4 +22,7 @@
   CPPUNIT_TEST_SUITE( FactoryTest );
   CPPUNIT_TEST ( DistributionTest );
+  CPPUNIT_TEST ( getProductEnumTest );
+  CPPUNIT_TEST ( getProductNameTest );
+  CPPUNIT_TEST ( getProductTypeTest );
   CPPUNIT_TEST_SUITE_END();
 
@@ -28,6 +32,11 @@
 
   void DistributionTest();
+  void getProductEnumTest();
+  void getProductNameTest();
+  void getProductTypeTest();
 
 private:
+  ICreatorStub * rndA;
+  ICreatorStub * rndB;
 };
 
Index: src/Patterns/unittests/Makefile.am
===================================================================
--- src/Patterns/unittests/Makefile.am	(revision 746ff1e6abdd4d0f2841706e63c0d09e2ec65671)
+++ src/Patterns/unittests/Makefile.am	(revision 7245643e0267aa45e523605af141c1d6d5d8261f)
@@ -37,6 +37,7 @@
 	CreatorUnitTest.hpp \
 	../Creator.hpp \
-	stubs/CreatorStub.hpp \
-	stubs/CreatorStub.cpp
+	stubs/CommonStub.cpp \
+	stubs/CommonStub.hpp \
+	stubs/CreatorStub.hpp
 CreatorUnitTest_LDADD = $(TESTLIBS)
 
@@ -44,6 +45,7 @@
 	FactoryUnitTest.cpp \
 	FactoryUnitTest.hpp \
+	stubs/CommonStub.cpp \
+	stubs/CommonStub.hpp \
 	stubs/CreatorStub.hpp \
-	stubs/CreatorStub.cpp \
 	stubs/FactoryStub.hpp \
 	stubs/FactoryStub.cpp \
Index: src/Patterns/unittests/stubs/CommonStub.cpp
===================================================================
--- src/Patterns/unittests/stubs/CommonStub.cpp	(revision 7245643e0267aa45e523605af141c1d6d5d8261f)
+++ src/Patterns/unittests/stubs/CommonStub.cpp	(revision 7245643e0267aa45e523605af141c1d6d5d8261f)
@@ -0,0 +1,34 @@
+/*
+ * Project: MoleCuilder
+ * Description: creates and alters molecular systems
+ * Copyright (C)  2010 University of Bonn. All rights reserved.
+ * Please see the LICENSE file or "Copyright notice" in builder.cpp for details.
+ */
+
+/*
+ * CommonStub.cpp
+ *
+ *  Created on: Jan 4, 2011
+ *      Author: heber
+ */
+
+// include config.h
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include "CommonStub.hpp"
+
+namespace teststubs {
+  Aclass::Aclass() :
+    counter(0)
+  {};
+
+  Aclass::~Aclass() {};
+
+  Bclass::Bclass() :
+    counter(256)
+  {};
+
+  Bclass::~Bclass() {};
+};
Index: src/Patterns/unittests/stubs/CommonStub.hpp
===================================================================
--- src/Patterns/unittests/stubs/CommonStub.hpp	(revision 7245643e0267aa45e523605af141c1d6d5d8261f)
+++ src/Patterns/unittests/stubs/CommonStub.hpp	(revision 7245643e0267aa45e523605af141c1d6d5d8261f)
@@ -0,0 +1,36 @@
+/*
+ * CommonStub.hpp
+ *
+ *  Created on: Jan 4, 2011
+ *      Author: heber
+ */
+
+#ifndef COMMONSTUB_HPP_
+#define COMMONSTUB_HPP_
+
+// include config.h
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+namespace teststubs {
+  class Aclass
+  {
+  public:
+    Aclass();
+    ~Aclass();
+
+    int counter;
+  };
+
+  class Bclass
+  {
+  public:
+    Bclass();
+    ~Bclass();
+
+    int counter;
+  };
+};
+
+#endif /* COMMONSTUB_HPP_ */
Index: c/Patterns/unittests/stubs/CreatorStub.cpp
===================================================================
--- src/Patterns/unittests/stubs/CreatorStub.cpp	(revision 746ff1e6abdd4d0f2841706e63c0d09e2ec65671)
+++ 	(revision )
@@ -1,18 +1,0 @@
-/*
- * Project: MoleCuilder
- * Description: creates and alters molecular systems
- * Copyright (C)  2010 University of Bonn. All rights reserved.
- * Please see the LICENSE file or "Copyright notice" in builder.cpp for details.
- */
-
-/*
- * CreatorStub.cpp
- *
- *  Created on: Jan 4, 2011
- *      Author: heber
- */
-
-namespace teststubs {
-  class Aclass {};
-  class Bclass {};
-};
Index: src/Patterns/unittests/stubs/CreatorStub.hpp
===================================================================
--- src/Patterns/unittests/stubs/CreatorStub.hpp	(revision 746ff1e6abdd4d0f2841706e63c0d09e2ec65671)
+++ src/Patterns/unittests/stubs/CreatorStub.hpp	(revision 7245643e0267aa45e523605af141c1d6d5d8261f)
@@ -8,4 +8,9 @@
 #ifndef CREATORSTUB_HPP_
 #define CREATORSTUB_HPP_
+
+// include config.h
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
 
 #include <typeinfo>
@@ -19,28 +24,4 @@
   virtual int getcount() = 0;
   virtual std::string name() = 0;
-};
-
-namespace teststubs {
-  class Aclass
-  {
-  public:
-    Aclass() :
-      counter(0)
-    {};
-    ~Aclass() {};
-
-    int counter;
-  };
-
-  class Bclass
-  {
-  public:
-    Bclass() :
-      counter(256)
-    {};
-    ~Bclass() {};
-
-    int counter;
-  };
 };
 
Index: src/Patterns/unittests/stubs/FactoryStub.cpp
===================================================================
--- src/Patterns/unittests/stubs/FactoryStub.cpp	(revision 746ff1e6abdd4d0f2841706e63c0d09e2ec65671)
+++ src/Patterns/unittests/stubs/FactoryStub.cpp	(revision 7245643e0267aa45e523605af141c1d6d5d8261f)
@@ -13,6 +13,12 @@
  */
 
+// include config.h
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
 #include "Singleton_impl.hpp"
 
+#include "CommonStub.hpp"
 #include "FactoryStub.hpp"
 
Index: src/Patterns/unittests/stubs/FactoryStub.hpp
===================================================================
--- src/Patterns/unittests/stubs/FactoryStub.hpp	(revision 746ff1e6abdd4d0f2841706e63c0d09e2ec65671)
+++ src/Patterns/unittests/stubs/FactoryStub.hpp	(revision 7245643e0267aa45e523605af141c1d6d5d8261f)
@@ -9,9 +9,16 @@
 #define FACTORYSTUB_HPP_
 
+// include config.h
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
 #include "CreatorStub.hpp"
 
-// has to be appear BEFORE Factory.hpp is included!
+// triple has to be appear BEFORE Factory.hpp is included!
 #include "FactoryStub.def"
 #include "FactoryTypeList.hpp"
+#include "FactoryStub.undef"
+
 #include "Factory.hpp"
 
@@ -27,5 +34,4 @@
   virtual ~FactoryStub();
 };
-#include "FactoryStub.undef"
 
 #endif /* FACTORYSTUB_HPP_ */
