source: src/Patterns/unittests/stubs/CommonStub.cpp@ d76c105

Last change on this file since d76c105 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
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 * CommonStub.cpp
10 *
11 * Created on: Jan 4, 2011
12 * Author: heber
13 */
14
15// include config.h
16#ifdef HAVE_CONFIG_H
17#include <config.h>
18#endif
19
20#include "CommonStub.hpp"
21
22namespace teststubs {
23 Iclass::~Iclass() {};
24
25 Aclass::Aclass() :
26 counter(0)
27 {};
28
29 Aclass::~Aclass() {};
30
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
44 Bclass::Bclass() :
45 counter(0.)
46 {};
47
48 Bclass::~Bclass() {};
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 };
61};
Note: See TracBrowser for help on using the repository browser.