Ignore:
Timestamp:
Jan 5, 2011, 1:48:15 PM (15 years ago)
Author:
Frederik Heber <heber@…>
Children:
567640
Parents:
1afcbe
git-author:
Frederik Heber <heber@…> (01/05/11 11:26:48)
git-committer:
Frederik Heber <heber@…> (01/05/11 13:48:15)
Message:

Added Prototype Factory pattern.

  • the Prototype Factory basically stores Clone instead of Creator patterns in its lookup tables to produce.
  • Clone has not protected cstor/dstor but is friend with CloneTest and PrototypeFactoryStub to grant them access.
  • also these prototypes may be manipulated by befriended classes.
  • added unit test and stub.
  • Library version is now 3:0:0, API version is 1.0.5.
Location:
src/Patterns/unittests
Files:
6 added
2 edited

Legend:

Unmodified
Added
Removed
  • src/Patterns/unittests/Makefile.am

    r1afcbe rd76c105  
    1414  FactoryUnitTest \
    1515  ObserverUnitTest \
     16  PrototypeFactoryUnitTest \
    1617  RegistryUnitTest \
    1718  SingletonUnitTest
     
    7374ObserverUnitTest_LDADD = $(TESTLIBS)
    7475
     76PrototypeFactoryUnitTest_SOURCES = $(top_srcdir)/src/unittests/UnitTestMain.cpp \
     77        PrototypeFactoryUnitTest.cpp \
     78        PrototypeFactoryUnitTest.hpp \
     79        stubs/CloneStub.cpp \
     80        stubs/CloneStub.hpp \
     81        stubs/CommonStub.cpp \
     82        stubs/CommonStub.hpp \
     83        stubs/PrototypeFactoryStub.hpp \
     84        stubs/PrototypeFactoryStub.cpp \
     85        ../PrototypeFactory.hpp \
     86        ../FactoryTypeList.hpp \
     87        ../PrototypeFactory_impl.hpp
     88PrototypeFactoryUnitTest_LDADD = $(TESTLIBS)
     89
    7590RegistryUnitTest_SOURCES = $(top_srcdir)/src/unittests/UnitTestMain.cpp \
    7691        RegistryUnitTest.cpp \
  • src/Patterns/unittests/stubs/CloneStub.hpp

    r1afcbe rd76c105  
    2424};
    2525
     26class CloneTest;
     27class PrototypeFactoryStub;
     28
    2629template <class T>
    2730class Prototype :
     
    2932  public Clone<IPrototype>
    3033{
    31 public:
     34    /**
     35     * Prototype Factory is friend because it needs to access protected cstor
     36     * to instantiate prototypes.
     37     */
     38    friend class PrototypeFactoryStub;
     39
     40    /**
     41     * Test is friend such that it can access protected cstor.
     42     */
     43    friend class CloneTest;
     44
     45protected:
    3246    Prototype() {
    3347      member.setcount(0);
     
    3549    ~Prototype() {};
    3650
     51public:
    3752    void count() {
    3853      member.count();
Note: See TracChangeset for help on using the changeset viewer.