| Last change
 on this file since 9cc4ac was             1afcbe, checked in by Frederik Heber <heber@…>, 15 years ago | 
        
          | 
Added Clone pattern.
 Clone is necessary for having prototypes, i.e. it defines an interface class
that has a virtual * clone() const function that each derived type has to
implement.
Added unit test.
made CommonStub a bit cleaner.
updated documentation fo Factory and FactoryTypeList
Library version is now 2:2:0, API is 1.0.4.
 | 
        
          | 
              
Property                 mode
 set to                 100644 | 
        
          | File size:
            967 bytes | 
      
      
| Rev | Line |  | 
|---|
| [746ff1] | 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 | /* | 
|---|
| [724564] | 9 | * CommonStub.cpp | 
|---|
| [746ff1] | 10 | * | 
|---|
|  | 11 | *  Created on: Jan 4, 2011 | 
|---|
|  | 12 | *      Author: heber | 
|---|
|  | 13 | */ | 
|---|
|  | 14 |  | 
|---|
| [724564] | 15 | // include config.h | 
|---|
|  | 16 | #ifdef HAVE_CONFIG_H | 
|---|
|  | 17 | #include <config.h> | 
|---|
|  | 18 | #endif | 
|---|
|  | 19 |  | 
|---|
|  | 20 | #include "CommonStub.hpp" | 
|---|
|  | 21 |  | 
|---|
| [746ff1] | 22 | namespace teststubs { | 
|---|
| [1afcbe] | 23 | Iclass::~Iclass() {}; | 
|---|
|  | 24 |  | 
|---|
| [724564] | 25 | Aclass::Aclass() : | 
|---|
|  | 26 | counter(0) | 
|---|
|  | 27 | {}; | 
|---|
|  | 28 |  | 
|---|
|  | 29 | Aclass::~Aclass() {}; | 
|---|
|  | 30 |  | 
|---|
| [1afcbe] | 31 | void Aclass::count() { | 
|---|
|  | 32 | ++counter; | 
|---|
|  | 33 | } | 
|---|
|  | 34 |  | 
|---|
|  | 35 | int Aclass::getcount() const { | 
|---|
|  | 36 | return counter; | 
|---|
|  | 37 | }; | 
|---|
|  | 38 |  | 
|---|
|  | 39 | void Aclass::setcount(int const _counter) { | 
|---|
|  | 40 | counter = _counter; | 
|---|
|  | 41 | }; | 
|---|
|  | 42 |  | 
|---|
|  | 43 |  | 
|---|
| [724564] | 44 | Bclass::Bclass() : | 
|---|
| [1afcbe] | 45 | counter(0.) | 
|---|
| [724564] | 46 | {}; | 
|---|
|  | 47 |  | 
|---|
|  | 48 | Bclass::~Bclass() {}; | 
|---|
| [1afcbe] | 49 |  | 
|---|
|  | 50 | void Bclass::count() { | 
|---|
|  | 51 | counter+=1.; | 
|---|
|  | 52 | } | 
|---|
|  | 53 |  | 
|---|
|  | 54 | int Bclass::getcount() const { | 
|---|
|  | 55 | return (int)counter; | 
|---|
|  | 56 | }; | 
|---|
|  | 57 |  | 
|---|
|  | 58 | void Bclass::setcount(int const _counter) { | 
|---|
|  | 59 | counter = (double)_counter; | 
|---|
|  | 60 | }; | 
|---|
| [746ff1] | 61 | }; | 
|---|
       
      
  Note:
 See   
TracBrowser
 for help on using the repository browser.