fw4spl
core/fwActivities/include/fwActivities/validator/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_VALIDATOR_FACTORY_NEW_HPP__
8 #define __FWACTIVITIES_VALIDATOR_FACTORY_NEW_HPP__
9 
10 #include "fwActivities/config.hpp"
11 #include "fwActivities/validator/registry/detail.hpp"
12 
13 #include <string>
14 
15 namespace fwActivities
16 {
17 
18 class IValidator;
19 
20 namespace validator
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::validator::factory::New();
35 
36 Key()
37 {
38 }
39 };
40 
41 FWACTIVITIES_API SPTR( ::fwActivities::IValidator ) New( const ::fwActivities::validator::registry::KeyType &
42  classname );
43 
44 template<class CLASSNAME > SPTR( CLASSNAME ) New()
45 {
46  SPTR(CLASSNAME) validator = std::make_shared< CLASSNAME >( Key() );
47  return validator;
48 }
49 
50 } // namespace factory
51 } // namespace validator
52 } // namespace fwActivities
53 
54 #endif /* __FWACTIVITIES_VALIDATOR_FACTORY_NEW_HPP__ */
55 
#define SPTR(_cls_)
Contains fwAtomsFilter::factory utilities.
Base class for all fwActivities validator&#39;s classes.
Definition: IValidator.hpp:29
Namespace containing activities data and builder.
Key class used to restrict access to Object construction. See http://www.drdobbs.com/184402053.