fw4spl
core/fwAtomsFilter/include/fwAtomsFilter/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 __FWATOMSFILTER_FACTORY_NEW_HPP__
8 #define __FWATOMSFILTER_FACTORY_NEW_HPP__
9 
10 #include "fwAtomsFilter/config.hpp"
11 #include "fwAtomsFilter/registry/detail.hpp"
12 
13 #include <string>
14 
15 namespace fwAtomsFilter
16 {
17 
18 class IFilter;
19 
20 namespace factory
21 {
22 
23 template<class CLASSNAME > SPTR( CLASSNAME ) New();
24 
29 class Key
30 {
31 template<typename CLASSNAME>
32 friend SPTR( CLASSNAME ) fwAtomsFilter::factory::New();
33 
34 Key()
35 {
36 }
37 };
38 
39 FWATOMSFILTER_API SPTR(::fwAtomsFilter::IFilter) New(
40  const ::fwAtomsFilter::registry::KeyType & classname );
41 
42 template<class CLASSNAME > SPTR( CLASSNAME ) New()
43 {
44  SPTR(CLASSNAME) obj = std::make_shared< CLASSNAME >( Key() );
45 
46  return obj;
47 }
48 
49 } // namespace factory
50 
51 } // namespace fwAtomsFilter
52 
53 #endif /* __FWATOMSFILTER_FACTORY_NEW_HPP__ */
54 
#define SPTR(_cls_)
Contains fwAtomsFilter::factory utilities.
Removes atom attributes which are not managed by a context.
Key class used to restrict access to Object construction. See http://www.drdobbs.com/184402053.