Index: ThirdParty/CodePatterns/src/Observer/unittests/stubs/ObserverStub.cpp
===================================================================
--- ThirdParty/CodePatterns/src/Observer/unittests/stubs/ObserverStub.cpp	(revision 41e8e2a5c8c564e7fcb9688c8fe826715131b8f5)
+++ ThirdParty/CodePatterns/src/Observer/unittests/stubs/ObserverStub.cpp	(revision 41e8e2a5c8c564e7fcb9688c8fe826715131b8f5)
@@ -0,0 +1,293 @@
+/*
+ * 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.
+ */
+
+/*
+ * ObserverStub.cpp
+ *
+ *  Created on: Jan 19, 2010
+ *      Author: crueger
+ */
+
+// include config.h
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <cppunit/extensions/HelperMacros.h>
+
+#include "CodePatterns/Assert.hpp"
+
+#include "ObserverStub.hpp"
+
+#include "CodePatterns/Observer/Channels.hpp"
+#include "CodePatterns/Observer/Notification.hpp"
+
+/************ UpdateCountObserver **************/
+
+UpdateCountObserver::UpdateCountObserver() :
+  Observer("UpdateCountObserver"),
+  updates(0)
+{};
+
+UpdateCountObserver::~UpdateCountObserver()
+{}
+
+void UpdateCountObserver::update(Observable *publisher){
+  updates++;
+}
+
+void UpdateCountObserver::subjectKilled(Observable *publisher) {
+}
+
+/*************** SimpleObservable **************/
+
+SimpleObservable::SimpleObservable() :
+  Observable("SimpleObservable")
+{}
+
+void SimpleObservable::changeMethod() {
+  OBSERVE;
+  int i = 0;
+  i++;
+}
+
+/************** CallObservable *****************/
+
+CallObservable::CallObservable() :
+  Observable("CallObservable")
+{}
+
+void CallObservable::changeMethod1() {
+  OBSERVE;
+  int i = 0;
+  i++;
+}
+
+void CallObservable::changeMethod2() {
+  OBSERVE;
+  int i = 0;
+  i++;
+  changeMethod1();
+}
+
+/************* BlockObservable *****************/
+
+BlockObservable::BlockObservable() :
+  Observable("BlockObservable")
+{}
+
+void BlockObservable::changeMethod1(){
+  OBSERVE;
+  // test if we report correctly as blocked
+  CPPUNIT_ASSERT(isBlocked());
+}
+
+void BlockObservable::changeMethod2(){
+  OBSERVE;
+  internalMethod1();
+  internalMethod2();
+}
+
+void BlockObservable::internalMethod1(){
+  // we did not block, but our caller did...
+  // see if this is found
+  CPPUNIT_ASSERT(isBlocked());
+}
+
+void BlockObservable::internalMethod2(){
+  OBSERVE;
+  // Both this method and the caller do block
+  // Does the reporting still work as expected?
+  CPPUNIT_ASSERT(isBlocked());
+}
+
+void BlockObservable::noChangeMethod(){
+  // No Block introduced here
+  // reported correctely?
+  CPPUNIT_ASSERT(!isBlocked());
+}
+
+/*************** SuperObservable ***************/
+
+SuperObservable::SuperObservable():
+  Observable("SuperObservable")
+{
+  subObservable = new SimpleObservable();
+  subObservable->signOn(this);
+}
+SuperObservable::~SuperObservable(){
+  delete subObservable;
+}
+void SuperObservable::changeMethod() {
+  OBSERVE;
+  int i = 0;
+  i++;
+  subObservable->changeMethod();
+}
+
+/************* NotificationObservable **********/
+
+NotificationObservable::NotificationObservable() :
+  Observable("NotificationObservable")
+{
+  Channels *OurChannel = new Channels();
+  Observable::insertNotificationChannel( std::make_pair(this, OurChannel) );
+  OurChannel->addChannel(Operation1Notify);
+  OurChannel->addChannel(Operation2Notify);
+}
+
+NotificationObservable::~NotificationObservable()
+{
+  Observable::eraseNotificationChannel(this);
+}
+
+void NotificationObservable::operation1(){
+  OBSERVE;
+  NOTIFY(Operation1Notify);
+}
+
+void NotificationObservable::operation2(){
+  OBSERVE;
+  NOTIFY(Operation2Notify);
+}
+
+/*********** NotificationObserver **************/
+
+NotificationObserver::NotificationObserver(Notification_ptr notification) :
+  Observer("NotificationObserver"),
+  requestedNotification(notification),
+  wasNotified(false)
+{}
+
+NotificationObserver::~NotificationObserver()
+{}
+
+void NotificationObserver::update(Observable*){}
+void NotificationObserver::subjectKilled(Observable*){}
+void NotificationObserver::recieveNotification(Observable *publisher, Notification_ptr notification){
+  CPPUNIT_ASSERT(requestedNotification==notification);
+  wasNotified = true;
+}
+
+/**************** ObservableSet ****************/
+
+ObservableSet::ObservableSet(int _num) :
+  Observable("ObservableCollection"),
+  num(_num)
+{
+  for(int i=0; i<num; ++i){
+    SimpleObservable *content = new SimpleObservable();
+    content->signOn(this);
+    theSet.insert(content);
+  }
+}
+
+ObservableSet::~ObservableSet(){
+  set::iterator iter;
+  for(iter=theSet.begin(); iter!=theSet.end(); ++iter ){
+    delete (*iter);
+  }
+}
+
+ObservableSet::iterator ObservableSet::begin(){
+  return iterator(theSet.begin(),this);
+}
+
+ObservableSet::iterator ObservableSet::end(){
+  return iterator(theSet.end(),this);
+}
+
+/************** ObservableMap ******************/
+
+ObservableMap::ObservableMap(int _num) :
+  Observable("ObservableCollection"),
+  num(_num)
+{
+  for(int i=0; i<num; ++i){
+    SimpleObservable *content = new SimpleObservable();
+    content->signOn(this);
+    theSet.insert(std::make_pair(i,content));
+  }
+}
+
+ObservableMap::~ObservableMap(){
+  set::iterator iter;
+  for(iter=theSet.begin(); iter!=theSet.end(); ++iter ){
+    delete iter->second;
+  }
+}
+
+ObservableMap::iterator ObservableMap::begin(){
+  return iterator(theSet.begin(),this);
+}
+
+ObservableMap::iterator ObservableMap::end(){
+  return iterator(theSet.end(),this);
+}
+
+/****************** Relay *********************/
+
+RelayTest::RelayTest() :
+    Relay(std::string("RelayTest"))
+{}
+
+RelayTest::~RelayTest()
+{}
+
+/************ RelayNotification ***************/
+
+RelayNotification::RelayNotification() :
+    Relay(std::string("RelayTest"))
+{
+  Channels *OurChannel = new Channels();
+  Observable::insertNotificationChannel( std::make_pair(this, OurChannel) );
+  OurChannel->addChannel(NotificationObservable::Operation1Notify);
+  OurChannel->addChannel(NotificationObservable::Operation2Notify);
+}
+
+RelayNotification::~RelayNotification()
+{}
+
+/************ RelayCountObserver ***************/
+
+RelayCountObserver::RelayCountObserver(const Observable * const _relay) :
+    Observer("RelayCountObserver"),
+    updates(0),
+    relay(_relay)
+{}
+
+RelayCountObserver::~RelayCountObserver()
+{}
+
+void RelayCountObserver::update(Observable *publisher){
+  // check that we are not called by the relay itself
+  CPPUNIT_ASSERT(publisher != relay);
+  updates++;
+}
+
+void RelayCountObserver::subjectKilled(Observable *publisher) {
+}
+
+/********* RelayNotificationObserver ***********/
+
+RelayNotificationObserver::RelayNotificationObserver(const Observable * const _relay) :
+  Observer("RelayNotificationObserver"),
+  wasNotified(false),
+  relay(_relay)
+{}
+
+RelayNotificationObserver::~RelayNotificationObserver()
+{}
+
+void RelayNotificationObserver::update(Observable*){}
+void RelayNotificationObserver::subjectKilled(Observable*){}
+void RelayNotificationObserver::recieveNotification(Observable *publisher, Notification_ptr notification){
+  // check that we are not called by the relay itself
+  CPPUNIT_ASSERT(publisher != relay);
+  wasNotified = true;
+}
+
Index: ThirdParty/CodePatterns/src/Observer/unittests/stubs/ObserverStub.hpp
===================================================================
--- ThirdParty/CodePatterns/src/Observer/unittests/stubs/ObserverStub.hpp	(revision 41e8e2a5c8c564e7fcb9688c8fe826715131b8f5)
+++ ThirdParty/CodePatterns/src/Observer/unittests/stubs/ObserverStub.hpp	(revision 41e8e2a5c8c564e7fcb9688c8fe826715131b8f5)
@@ -0,0 +1,172 @@
+/*
+ * ObserverStub.hpp
+ *
+ *  Created on: Jan 16, 2011
+ *      Author: heber
+ */
+
+#ifndef OBSERVERSTUB_HPP_
+#define OBSERVERSTUB_HPP_
+
+#include "CodePatterns/Observer/Observer.hpp"
+#include "CodePatterns/Observer/Observable.hpp"
+#include "CodePatterns/Observer/ObservedIterator.hpp"
+#include "CodePatterns/Observer/Relay.hpp"
+
+class UpdateCountObserver : public Observer {
+public:
+  UpdateCountObserver();
+  virtual ~UpdateCountObserver();
+
+  void update(Observable *publisher);
+  void subjectKilled(Observable *publisher);
+
+  int updates;
+};
+
+class SimpleObservable : public Observable {
+public:
+  SimpleObservable();
+
+  void changeMethod();
+};
+
+class CallObservable : public Observable {
+public:
+  CallObservable();
+
+  void changeMethod1();
+  void changeMethod2();
+};
+
+class BlockObservable : public Observable {
+public:
+  BlockObservable();
+
+  void changeMethod1();
+  void changeMethod2();
+
+  void internalMethod1();
+  void internalMethod2();
+
+  void noChangeMethod();
+};
+
+class SuperObservable : public Observable {
+public:
+  SuperObservable();
+  virtual ~SuperObservable();
+
+  void changeMethod();
+
+  SimpleObservable *subObservable;
+};
+
+class NotificationObservable : public Observable {
+public:
+  NotificationObservable();
+  virtual ~NotificationObservable();
+
+  enum NotificationType {
+    Operation1Notify = 0,
+    Operation2Notify = 1
+  };
+
+  void operation1();
+  void operation2();
+};
+
+class NotificationObserver : public Observer {
+public:
+  NotificationObserver(Notification_ptr notification);
+  virtual ~NotificationObserver();
+
+  void update(Observable*);
+  void subjectKilled(Observable*);
+  void recieveNotification(Observable *publisher, Notification_ptr notification);
+
+  Notification_ptr requestedNotification;
+
+  bool wasNotified;
+};
+
+class ObservableSet : public Observable {
+public:
+  typedef std::set<SimpleObservable*> set;
+  typedef ObservedIterator<set> iterator;
+  typedef set::const_iterator const_iterator;
+
+  ObservableSet(int _num);
+  virtual ~ObservableSet();
+
+  iterator begin();
+  iterator end();
+
+  const int num;
+
+private:
+  set theSet;
+};
+
+class ObservableMap : public Observable {
+public:
+  typedef std::map<int,SimpleObservable*> set;
+  typedef ObservedIterator<set> iterator;
+  typedef set::const_iterator const_iterator;
+
+  ObservableMap(int _num);
+  virtual ~ObservableMap();
+
+  iterator begin();
+  iterator end();
+
+  const int num;
+
+private:
+  set theSet;
+};
+
+class RelayTest : public Relay
+{
+public:
+  RelayTest();
+  ~RelayTest();
+private:
+};
+
+class RelayCountObserver : public Observer {
+public:
+  RelayCountObserver(const Observable * const relay);
+  virtual ~RelayCountObserver();
+
+  void update(Observable *publisher);
+  void subjectKilled(Observable *publisher);
+
+  int updates;
+private:
+  const Observable * const relay;
+};
+
+class RelayNotification : public Relay
+{
+public:
+  RelayNotification();
+  ~RelayNotification();
+private:
+};
+
+class RelayNotificationObserver : public Observer {
+public:
+  RelayNotificationObserver(const Observable * const _relay);
+  virtual ~RelayNotificationObserver();
+
+  void update(Observable*);
+  void subjectKilled(Observable*);
+  void recieveNotification(Observable *publisher, Notification_ptr notification);
+
+  bool wasNotified;
+private:
+  const Observable * const relay;
+};
+
+#endif /* OBSERVERSTUB_HPP_ */
