|
Last change
on this file since ec61ec was 9b8fa4, checked in by Frederik Heber <heber@…>, 14 years ago |
|
Huge update of file structure to place installation header files into right folder.
- The problem ist that we desire use as include "CodePatterns/...". For this to
work, especially with the new Observer subfolder structure, it has been
necessary to place all header files away from their source files into a
distinct folder called CodePatterns. This emulates the later, after make
install present structure.
- essentially all source and header files had to be changed to adapt the
include.
- all Makefile.am's had to be changed.
- nobase_ ... was removed such that header files are installed flat and not
creating their subfolder along the process.
- We placed Observer into its own convenience library and own folder Observer
away from Patterns.
Some other changes:
- FIX: MemDebug.hpp inclusion has been removed in all stubs.
|
-
Property mode
set to
100644
|
|
File size:
1.5 KB
|
| Line | |
|---|
| 1 | /*
|
|---|
| 2 | * Project: MoleCuilder
|
|---|
| 3 | * Description: creates and alters molecular systems
|
|---|
| 4 | * Copyright (C) 2010 University of Bonn. All rights reserved.
|
|---|
| 5 | * Please see the LICENSE file or "Copyright notice" in builder.cpp for details.
|
|---|
| 6 | */
|
|---|
| 7 |
|
|---|
| 8 | /*
|
|---|
| 9 | * Observer.cpp
|
|---|
| 10 | *
|
|---|
| 11 | * Created on: Jan 19, 2010
|
|---|
| 12 | * Author: crueger
|
|---|
| 13 | */
|
|---|
| 14 |
|
|---|
| 15 | // include config.h
|
|---|
| 16 | #ifdef HAVE_CONFIG_H
|
|---|
| 17 | #include <config.h>
|
|---|
| 18 | #endif
|
|---|
| 19 |
|
|---|
| 20 | #include "CodePatterns/MemDebug.hpp"
|
|---|
| 21 |
|
|---|
| 22 | #include "CodePatterns/Observer/Observer.hpp"
|
|---|
| 23 |
|
|---|
| 24 | #include <iostream>
|
|---|
| 25 |
|
|---|
| 26 | #include "CodePatterns/Assert.hpp"
|
|---|
| 27 | #ifdef LOG_OBSERVER
|
|---|
| 28 | #include "CodePatterns/Observer/ObserverLog.hpp"
|
|---|
| 29 | #endif
|
|---|
| 30 |
|
|---|
| 31 |
|
|---|
| 32 | /** Constructor for class Observer.
|
|---|
| 33 | */
|
|---|
| 34 | Observer::Observer(std::string name)
|
|---|
| 35 | {
|
|---|
| 36 | #ifdef LOG_OBSERVER
|
|---|
| 37 | observerLog().addName(this,name);
|
|---|
| 38 | observerLog().addMessage() << "++ Creating Observer " << observerLog().getName(this);
|
|---|
| 39 | #endif
|
|---|
| 40 | }
|
|---|
| 41 |
|
|---|
| 42 | /**
|
|---|
| 43 | * Base Constructor for class Observer
|
|---|
| 44 | *
|
|---|
| 45 | * only called from Observable Constructor
|
|---|
| 46 | */
|
|---|
| 47 | Observer::Observer(Observer::BaseConstructor){
|
|---|
| 48 | #ifdef LOG_OBSERVER
|
|---|
| 49 | observerLog().addObservable(this);
|
|---|
| 50 | #endif
|
|---|
| 51 | }
|
|---|
| 52 |
|
|---|
| 53 | /** Destructor for class Observer.
|
|---|
| 54 | */
|
|---|
| 55 | Observer::~Observer()
|
|---|
| 56 | {
|
|---|
| 57 | #ifdef LOG_OBSERVER
|
|---|
| 58 | if(!observerLog().isObservable(this)){
|
|---|
| 59 | observerLog().addMessage() << "-- Destroying Observer " << observerLog().getName(this);
|
|---|
| 60 | }
|
|---|
| 61 | #endif
|
|---|
| 62 | }
|
|---|
| 63 |
|
|---|
| 64 | /**
|
|---|
| 65 | * Method for specialized notifications.
|
|---|
| 66 | * Most Observers wont need or use this, so it is implemented
|
|---|
| 67 | * empty in the base case;
|
|---|
| 68 | */
|
|---|
| 69 | void Observer::recieveNotification(Observable *publisher, Notification_ptr notification){
|
|---|
| 70 | ASSERT(0,"Notification received by object that did not sign on for it.");
|
|---|
| 71 | }
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.