fw4spl
core/fwActivities/include/fwActivities/builder/factory/new.hpp
1 /* ***** BEGIN LICENSE BLOCK *****
2  * FW4SPL - Copyright (C) IRCAD, 2009-2017.
3  * Distributed under the terms of the GNU Lesser General Public License (LGPL) as
4  * published by the Free Software Foundation.
5  * ****** END LICENSE BLOCK ****** */
6 
7 #ifndef __FWACTIVITIES_BUILDER_FACTORY_NEW_HPP__
8 #define __FWACTIVITIES_BUILDER_FACTORY_NEW_HPP__
9 
10 #include "fwActivities/builder/registry/detail.hpp"
11 #include "fwActivities/config.hpp"
12 
13 #include <string>
14 
15 namespace fwActivities
16 {
17 
18 class IBuilder;
19 
20 namespace builder
21 {
22 namespace factory
23 {
24 
25 template<class CLASSNAME > SPTR( CLASSNAME ) New();
26 
31 class Key
32 {
33 template<typename CLASSNAME>
34 friend SPTR( CLASSNAME ) fwActivities::builder::factory::New();
35 
36 Key()
37 {
38 }
39 };
40 
41 FWACTIVITIES_API SPTR( ::fwActivities::IBuilder ) New( const ::fwActivities::builder::registry::KeyType & classname );
42 
43 template<class CLASSNAME > SPTR( CLASSNAME ) New()
44 {
45  SPTR(CLASSNAME) builder = std::make_shared< CLASSNAME >( Key() );
46  return builder;
47 }
48 
49 } // namespace factory
50 } // namespace builder
51 } // namespace fwActivities
52 
53 #endif /* __FWACTIVITIES_BUILDER_FACTORY_NEW_HPP__ */
54 
#define SPTR(_cls_)
Key class used to restrict access to Object construction. See http://www.drdobbs.com/184402053.
Contains fwAtomsFilter::factory utilities.
Namespace containing activities data and builder.
Base class for all fwActivities builder&#39;s classes.
Definition: IBuilder.hpp:29