Changeset 82:ef501464f31c in rrlib_design_patterns
- Timestamp:
- 06.02.2021 21:13:33 (17 months ago)
- Branch:
- 17.03
- Phase:
- public
- Location:
- factory
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
factory/tCloneFactory.h
r67 r82 81 81 tTypeInfoWrapper(const TAbstractProduct &type) : type(typeid(type)) {} 82 82 tTypeInfoWrapper(const TAbstractProduct *type) : type(typeid(*type)) {} 83 constbool operator < (const tTypeInfoWrapper &other) const83 bool operator < (const tTypeInfoWrapper &other) const 84 84 { 85 85 return other.type.before(this->type); … … 112 112 113 113 template <typename TProduct> 114 constbool Register(const tIdentifier &id)114 bool Register(const tIdentifier &id) 115 115 { 116 116 return this->Register(id, &factory::DefaultCopyCloner<TProduct>); -
factory/tFactory.h
r79 r82 86 86 {}; 87 87 88 constbool Register(const TIdentifier &id, const TProductCreator &product_creator)88 bool Register(const TIdentifier &id, const TProductCreator &product_creator) 89 89 { 90 90 return this->id_to_creator_map.insert(std::make_pair(id, product_creator)).second; … … 92 92 93 93 template <typename TProduct> 94 constbool Register(const TIdentifier &id)94 bool Register(const TIdentifier &id) 95 95 { 96 96 return this->Register(id, factory::DefaultNewCreator<TProduct>()); 97 97 } 98 98 99 constbool Unregister(const TIdentifier &id)99 bool Unregister(const TIdentifier &id) 100 100 { 101 101 return this->id_to_creator_map.erase(id) == 1;
Note: See TracChangeset
for help on using the changeset viewer.