Index: src/Fragmentation/Exporters/SaturatedFragment.cpp
===================================================================
--- src/Fragmentation/Exporters/SaturatedFragment.cpp	(revision 7d5fcdb109e3bb01fe2b96e13f2ba11ded123b04)
+++ src/Fragmentation/Exporters/SaturatedFragment.cpp	(revision 7d5fcdb109e3bb01fe2b96e13f2ba11ded123b04)
@@ -0,0 +1,78 @@
+/*
+ * Project: MoleCuilder
+ * Description: creates and alters molecular systems
+ * Copyright (C)  2013 University of Bonn. All rights reserved.
+ * 
+ *
+ *   This file is part of MoleCuilder.
+ *
+ *    MoleCuilder is free software: you can redistribute it and/or modify
+ *    it under the terms of the GNU General Public License as published by
+ *    the Free Software Foundation, either version 2 of the License, or
+ *    (at your option) any later version.
+ *
+ *    MoleCuilder is distributed in the hope that it will be useful,
+ *    but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *    GNU General Public License for more details.
+ *
+ *    You should have received a copy of the GNU General Public License
+ *    along with MoleCuilder.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+/*
+ * SaturatedFragment.cpp
+ *
+ *  Created on: Mar 3, 2013
+ *      Author: heber
+ */
+
+// include config.h
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include "CodePatterns/MemDebug.hpp"
+
+#include "SaturatedFragment.hpp"
+
+#include "CodePatterns/Assert.hpp"
+
+#include "Fragmentation/Exporters/HydrogenPool.hpp"
+
+SaturatedFragment::SaturatedFragment(
+    const KeySet &_set,
+    KeySetsInUse_t &_container,
+    HydrogenPool &_hydrogens) :
+  container(_container),
+  set(_set),
+  hydrogens(_hydrogens),
+  FullMolecule(set)
+{
+  // add to in-use container
+  ASSERT( container.find(set) == container.end(),
+      "SaturatedFragment::SaturatedFragment() - the set "
+      +toString(set)+" is already marked as in use.");
+  container.insert(set);
+
+  // so far, we don't saturate anything
+  SaturationHydrogens.clear();
+}
+
+SaturatedFragment::~SaturatedFragment()
+{
+  // release all saturation hydrogens if present
+  for (KeySet::iterator iter = SaturationHydrogens.begin();
+      !SaturationHydrogens.empty();
+      iter = SaturationHydrogens.begin()) {
+    hydrogens.releaseHydrogen(*iter);
+    SaturationHydrogens.erase(iter);
+  }
+
+  // remove ourselves from in-use container
+  KeySetsInUse_t::iterator iter = container.find(set);
+  ASSERT( container.find(set) != container.end(),
+      "SaturatedFragment::SaturatedFragment() - the set "
+      +toString(set)+" is not marked as in use.");
+  container.erase(iter);
+}
Index: src/Fragmentation/Exporters/SaturatedFragment.hpp
===================================================================
--- src/Fragmentation/Exporters/SaturatedFragment.hpp	(revision 7d5fcdb109e3bb01fe2b96e13f2ba11ded123b04)
+++ src/Fragmentation/Exporters/SaturatedFragment.hpp	(revision 7d5fcdb109e3bb01fe2b96e13f2ba11ded123b04)
@@ -0,0 +1,77 @@
+/*
+ * SaturatedFragment.hpp
+ *
+ *  Created on: Mar 3, 2013
+ *      Author: heber
+ */
+
+#ifndef SATURATEDFRAGMENT_HPP_
+#define SATURATEDFRAGMENT_HPP_
+
+// include config.h
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <set>
+
+#include "Fragmentation/KeySet.hpp"
+
+class HydrogenPool;
+
+/** The SaturatedFragment class acts as a wrapper to a KeySet by adding a list
+ * of saturation hydrogens.
+ *
+ * This SaturatedFragment along with a currently leased set of hydrogens from the
+ * HydrogenPool is all that is required to create a fully storable molecular
+ * fragment from a given Keyset.
+ *
+ * The instance notes down its existence in an external container.
+ *
+ */
+class SaturatedFragment
+{
+public:
+  //!> typedef to a container to mark keysets that are in use
+  typedef std::set<KeySet> KeySetsInUse_t;
+
+  /** Constructor of SaturatedFragment requires \a set which we are tightly
+   * associated.
+   *
+   * \param _set KeySet which this instance is associated with
+   * \param _container container to add KeySet as in-use
+   * \param _hydrogens pool with hydrogens for saturation
+   */
+  SaturatedFragment(
+      const KeySet &_set,
+      KeySetsInUse_t &_container,
+      HydrogenPool &_hydrogens);
+
+  /** Destructor of class SaturatedFragment.
+   *
+   */
+  ~SaturatedFragment();
+
+  /** Getter for the KeySet this instance is associated with.
+   *
+   * \return const ref to KeySet
+   */
+  const KeySet & getKeySet() const
+  {
+    return set;
+  }
+
+private:
+  //!> container to mark ourselves RAII-style
+  KeySetsInUse_t &container;
+  //!> key set this fragment is associated with.
+  const KeySet &set;
+  //!> pool with saturation hydrogens
+  HydrogenPool &hydrogens;
+  //!> key set containing all atoms used for e.g. storing this to file
+  KeySet FullMolecule;
+  //!> key set containing the ids of all hydrogens added for saturation
+  KeySet SaturationHydrogens;
+};
+
+#endif /* SATURATEDFRAGMENT_HPP_ */
Index: src/Fragmentation/Exporters/unittests/Makefile.am
===================================================================
--- src/Fragmentation/Exporters/unittests/Makefile.am	(revision c3df2354750ff648d82e55250da81445e260d5f0)
+++ src/Fragmentation/Exporters/unittests/Makefile.am	(revision 7d5fcdb109e3bb01fe2b96e13f2ba11ded123b04)
@@ -3,11 +3,14 @@
 
 FRAGMENTATIONEXPORTERSSOURCES = \
-	../Fragmentation/Exporters/unittests/HydrogenPoolUnitTest.cpp
+	../Fragmentation/Exporters/unittests/HydrogenPoolUnitTest.cpp \
+	../Fragmentation/Exporters/unittests/SaturatedFragmentUnitTest.cpp
 
 FRAGMENTATIONEXPORTERSTESTSHEADERS = \
-	../Fragmentation/Exporters/unittests/HydrogenPoolUnitTest.hpp
+	../Fragmentation/Exporters/unittests/HydrogenPoolUnitTest.hpp \
+	../Fragmentation/Exporters/unittests/SaturatedFragmentUnitTest.hpp
 
 FRAGMENTATIONEXPORTERSTESTS = \
-	HydrogenPoolUnitTest
+	HydrogenPoolUnitTest \
+	SaturatedFragmentUnitTest
 
 TESTS += $(FRAGMENTATIONEXPORTERSTESTS)
@@ -26,5 +29,12 @@
 	${FRAGMENTATIONEXPORTERSLIBS} \
 	../libMolecuilderUI.la
-
+	
+SaturatedFragmentUnitTest_SOURCES = $(top_srcdir)/src/unittests/UnitTestMain.cpp \
+	../Fragmentation/Exporters/unittests/SaturatedFragmentUnitTest.cpp \
+	../Fragmentation/Exporters/unittests/SaturatedFragmentUnitTest.hpp
+SaturatedFragmentUnitTest_LDADD = \
+	${FRAGMENTATIONEXPORTERSLIBS} \
+	../libMolecuilderUI.la
+	
 
 #AUTOMAKE_OPTIONS = parallel-tests
Index: src/Fragmentation/Exporters/unittests/SaturatedFragmentUnitTest.cpp
===================================================================
--- src/Fragmentation/Exporters/unittests/SaturatedFragmentUnitTest.cpp	(revision 7d5fcdb109e3bb01fe2b96e13f2ba11ded123b04)
+++ src/Fragmentation/Exporters/unittests/SaturatedFragmentUnitTest.cpp	(revision 7d5fcdb109e3bb01fe2b96e13f2ba11ded123b04)
@@ -0,0 +1,85 @@
+/*
+ * Project: MoleCuilder
+ * Description: creates and alters molecular systems
+ * Copyright (C)  2012 University of Bonn. All rights reserved.
+ * 
+ *
+ *   This file is part of MoleCuilder.
+ *
+ *    MoleCuilder is free software: you can redistribute it and/or modify
+ *    it under the terms of the GNU General Public License as published by
+ *    the Free Software Foundation, either version 2 of the License, or
+ *    (at your option) any later version.
+ *
+ *    MoleCuilder is distributed in the hope that it will be useful,
+ *    but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *    GNU General Public License for more details.
+ *
+ *    You should have received a copy of the GNU General Public License
+ *    along with MoleCuilder.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+/*
+ * SaturatedFragmentUnitTest.cpp
+ *
+ *  Created on: Aug 09, 2012
+ *      Author: heber
+ */
+
+// include config.h
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+using namespace std;
+
+#include <cppunit/CompilerOutputter.h>
+#include <cppunit/extensions/TestFactoryRegistry.h>
+#include <cppunit/ui/text/TestRunner.h>
+
+// include headers that implement a archive in simple text format
+#include <boost/archive/text_oarchive.hpp>
+#include <boost/archive/text_iarchive.hpp>
+
+#include "SaturatedFragmentUnitTest.hpp"
+
+#include <boost/assign.hpp>
+
+#include "CodePatterns/Assert.hpp"
+
+
+#ifdef HAVE_TESTRUNNER
+#include "UnitTestMain.hpp"
+#endif /*HAVE_TESTRUNNER*/
+
+using namespace boost::assign;
+
+/********************************************** Test classes **************************************/
+
+// Registers the fixture into the 'registry'
+CPPUNIT_TEST_SUITE_REGISTRATION( SaturatedFragmentTest );
+
+
+void SaturatedFragmentTest::setUp()
+{
+  // failing asserts should be thrown
+  ASSERT_DO(Assert::Throw);
+
+  set = new KeySet;
+  fragment = new SaturatedFragment(*set, KeySetsInUse, hydrogens);
+}
+
+
+void SaturatedFragmentTest::tearDown()
+{
+  delete fragment;
+  delete set;
+}
+
+/** UnitTest for getKeySet()
+ */
+void SaturatedFragmentTest::getKeySet_Test()
+{
+  CPPUNIT_ASSERT_EQUAL( *set, fragment->getKeySet() );
+}
Index: src/Fragmentation/Exporters/unittests/SaturatedFragmentUnitTest.hpp
===================================================================
--- src/Fragmentation/Exporters/unittests/SaturatedFragmentUnitTest.hpp	(revision 7d5fcdb109e3bb01fe2b96e13f2ba11ded123b04)
+++ src/Fragmentation/Exporters/unittests/SaturatedFragmentUnitTest.hpp	(revision 7d5fcdb109e3bb01fe2b96e13f2ba11ded123b04)
@@ -0,0 +1,44 @@
+/*
+ * SaturatedFragmentUnitTest.hpp
+ *
+ *  Created on: Aug 09, 2012
+ *      Author: heber
+ */
+
+#ifndef SATURATEDFRAGMENTUNITTEST_HPP_
+#define SATURATEDFRAGMENTUNITTEST_HPP_
+
+// include config.h
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+
+#include <cppunit/extensions/HelperMacros.h>
+
+#include "Fragmentation/Exporters/HydrogenPool.hpp"
+#include "Fragmentation/Exporters/SaturatedFragment.hpp"
+
+class KeySet;
+
+/********************************************** Test classes **************************************/
+
+class SaturatedFragmentTest : public CppUnit::TestFixture
+{
+    CPPUNIT_TEST_SUITE( SaturatedFragmentTest) ;
+    CPPUNIT_TEST ( getKeySet_Test );
+    CPPUNIT_TEST_SUITE_END();
+
+public:
+      void setUp();
+      void tearDown();
+      void getKeySet_Test();
+
+private:
+      HydrogenPool hydrogens;
+      SaturatedFragment::KeySetsInUse_t KeySetsInUse;
+      KeySet *set;
+      SaturatedFragment *fragment;
+};
+
+#endif /* SATURATEDFRAGMENTUNITTEST_HPP_ */
