fw4spl
DefaultActivity.cpp
1 /* ***** BEGIN LICENSE BLOCK *****
2  * FW4SPL - Copyright (C) IRCAD, 2016.
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 #include "fwActivities/validator/DefaultActivity.hpp"
8 #include "fwActivities/validator/registry/macros.hpp"
9 
10 #include <fwData/Composite.hpp>
11 #include <fwData/Vector.hpp>
12 
13 #include <fwMedData/ActivitySeries.hpp>
14 
15 
16 namespace fwActivities
17 {
18 namespace validator
19 {
20 
21 fwActivitiesValidatorRegisterMacro(
22  ::fwActivities::validator::DefaultActivity, "::fwActivities::validator::DefaultActivity");
23 
24 //-----------------------------------------------------------------------------
25 
27 {
28 }
29 
30 //-----------------------------------------------------------------------------
31 
33 {
34 }
35 
36 //-----------------------------------------------------------------------------
37 
38 IValidator::ValidationType DefaultActivity::validate(const ::fwMedData::ActivitySeries::csptr &activitySeries ) const
39 {
40  IValidator::ValidationType validation;
41 
42  validation = IActivityValidator::checkRequirements(activitySeries);
43 
44  if (validation.first)
45  {
46  validation = IActivityValidator::checkParameters(activitySeries);
47  }
48 
49  return validation;
50 }
51 
52 //-----------------------------------------------------------------------------
53 
54 } // namespace validator
55 } // namespace fwActivities
56 
57 
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
FWACTIVITIES_API ValidationType checkRequirements(const std::shared_ptr< const ::fwMedData::ActivitySeries > &activity) const
Checks if all the required data are present in the activity series.
virtual FWACTIVITIES_API ~DefaultActivity()
Destructor. Do nothing.
FWACTIVITIES_API ValidationType checkParameters(const std::shared_ptr< const ::fwMedData::ActivitySeries > &activity) const
Checks if all the activity&#39;s AppConfig parameters are valid.
Defines a validator which checks that activity requirements are valid.
FWACTIVITIES_API DefaultActivity(::fwActivities::IValidator::Key key)
Constructor. Do nothing.
virtual FWACTIVITIES_API IValidator::ValidationType validate(const std::shared_ptr< const ::fwMedData::ActivitySeries > &activitySeries) const override
Checks if all the required data are present and if the appConfig parameters are found.
Namespace containing activities data and builder.
Key class used to restrict access to Object construction. See http://www.drdobbs.com/184402053.