Ignore:
Timestamp:
Jan 5, 2011, 11:08:49 AM (15 years ago)
Author:
Frederik Heber <heber@…>
Children:
d76c105
Parents:
724564
Message:

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.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/Patterns/unittests/stubs/CommonStub.cpp

    r724564 r1afcbe  
    2121
    2222namespace teststubs {
     23  Iclass::~Iclass() {};
     24
    2325  Aclass::Aclass() :
    2426    counter(0)
     
    2729  Aclass::~Aclass() {};
    2830
     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
    2944  Bclass::Bclass() :
    30     counter(256)
     45    counter(0.)
    3146  {};
    3247
    3348  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  };
    3461};
Note: See TracChangeset for help on using the changeset viewer.