fw4spl
IValidator.hpp
1 /* ***** BEGIN LICENSE BLOCK *****
2  * FW4SPL - Copyright (C) IRCAD, 2009-2018.
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 #pragma once
8 
9 #include "fwActivities/config.hpp"
10 #include "fwActivities/registry/Activities.hpp"
11 #include "fwActivities/validator/factory/new.hpp"
12 #include "fwActivities/validator/registry/detail.hpp"
13 
14 #include <fwCore/base.hpp>
15 
16 #include <fwMedData/ActivitySeries.hpp>
17 
18 namespace fwData
19 {
20 class Vector;
21 }
22 
23 namespace fwActivities
24 {
25 
29 class FWACTIVITIES_CLASS_API IValidator : public ::fwCore::BaseObject
30 {
31 
32 public:
33 
39  typedef std::pair< bool, std::string > ValidationType;
40 
41  typedef ::fwActivities::validator::factory::Key Key;
42 
49  template <typename T>
50  class Registrar
51  {
52  public:
53  Registrar(std::string functorKey)
54  {
55  ::fwActivities::validator::registry::get()->addFactory( functorKey,
56  &::fwActivities::validator::factory::New<T> );
57  }
58  };
59 
61 
70  FWACTIVITIES_API virtual ValidationType validate(
71  const ::fwActivities::registry::ActivityInfo& activityInfo,
72  const CSPTR(::fwData::Vector)& currentSelection ) const = 0;
73 
74 };
75 
76 } // namespace fwActivities
#define CSPTR(_cls_)
#define fwCoreNonInstanciableClassDefinitionsMacro(_classinfo_)
Generate common code for Non Instanciable classes (Interfaces, Abstract classes, ...)
std::pair< bool, std::string > ValidationType
Defines validation result of an activity. First element tells if the activity is validated or not by ...
Definition: IValidator.hpp:39
Base class for all FW4SPL&#39;s classes.
Definition: BaseObject.hpp:22
This class defines a vector of objects.
Base class for all fwActivities validator&#39;s classes.
Definition: IValidator.hpp:29
Namespace containing activities data and builder.
Contains the representation of the data objects used in the framework.
Key class used to restrict access to Object construction. See http://www.drdobbs.com/184402053.
Class used to register a class factory in factory registry. This class defines also the object factor...
Definition: IValidator.hpp:50