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

Legend:

Unmodified
Added
Removed
  • src/Patterns/Factory_impl.hpp

    r1afcbe rd76c105  
    7272 *
    7373 */
    74 #define seqitems_as_enum_key_map(z,n,seq_with_elements, map, keytype, name_space, suffix) \
    75   map [ \
    76   BOOST_PP_SEQ_ELEM(n, seq_with_elements) \
    77   ] = keytype< name_space BOOST_PP_SEQ_ELEM(n, seq_with_elements) suffix > ();
     74#define seqitems_as_enum_key_map(z,n,_seq_with_elements, _map, _keytype, _key_name_space, _type_name_space, _type_suffix) \
     75  _map [ _key_name_space \
     76  BOOST_PP_SEQ_ELEM(n, _seq_with_elements) \
     77  ] = _keytype< _type_name_space BOOST_PP_SEQ_ELEM(n, _seq_with_elements) _type_suffix > ();
    7878
    7979/** Functions that allows to print a given seq of elements in the way of
     
    105105 * EnumMap[ "four" ] = test:: four;
    106106 */
    107 #define seqitems_as_enum_value_map(z,n,seq_with_elements, map, type_specifier, type_suffix, enum_name_space) \
    108   map [ type_specifier  \
    109   BOOST_PP_SEQ_ELEM(n, seq_with_elements) \
    110   type_suffix \
    111   ] = enum_name_space BOOST_PP_SEQ_ELEM(n, seq_with_elements);
     107#define seqitems_as_enum_value_map(z,n,_seq_with_elements, _map, _type_specifier, _type_suffix, _enum_name_space) \
     108  _map [ _type_specifier  \
     109  BOOST_PP_SEQ_ELEM(n, _seq_with_elements) \
     110  _type_suffix \
     111  ] = _enum_name_space BOOST_PP_SEQ_ELEM(n, _seq_with_elements);
    112112
    113113
     
    137137{
    138138  // fill PrototypeTable
    139 #define BOOST_PP_LOCAL_MACRO(n) seqitems_as_enum_key_map(~, n, type_seq, PrototypeTable, new Creator< Abstract_Interface_Class BOOST_PP_COMMA() Abstract_Encapsulation_Class, type_name_space, type_name_space_suffix > )
     139#define BOOST_PP_LOCAL_MACRO(n) seqitems_as_enum_key_map(~, n, type_seq, PrototypeTable, new Creator< Abstract_Interface_Class BOOST_PP_COMMA() Abstract_Encapsulation_Class, FactoryTypeList<Abstract_Interface_Class>::, type_name_space, type_name_space_suffix > )
    140140#define BOOST_PP_LOCAL_LIMITS  (0, BOOST_PP_SEQ_SIZE(type_seq)-1 )
    141141#include BOOST_PP_LOCAL_ITERATE()
Note: See TracChangeset for help on using the changeset viewer.