fw4spl
IBuilder.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/builder/factory/new.hpp"
10 #include "fwActivities/builder/registry/detail.hpp"
11 #include "fwActivities/config.hpp"
12 #include "fwActivities/registry/Activities.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 IBuilder : public ::fwCore::BaseObject
30 {
31 
32 public:
33 
34  typedef ::fwActivities::builder::factory::Key Key;
35  typedef ::fwMedData::ActivitySeries::ConfigIdType ConfigIdType;
36 
43  template <typename T>
44  class Registrar
45  {
46  public:
47  Registrar(std::string functorKey)
48  {
49  ::fwActivities::builder::registry::get()->addFactory( functorKey,
50  &::fwActivities::builder::factory::New<T> );
51  }
52  };
53 
55 
62  FWACTIVITIES_API virtual ::fwMedData::ActivitySeries::sptr buildData(
63  const ::fwActivities::registry::ActivityInfo& activityInfo,
64  const CSPTR(::fwData::Vector)& currentSelection ) const = 0;
65 
66 protected:
67 
68  FWACTIVITIES_API virtual SPTR(::fwData::Vector) getType( const CSPTR(::fwData::Vector)& currentSelection,
69  const std::string& type ) const;
70 };
71 
72 } // namespace fwActivities
#define SPTR(_cls_)
#define CSPTR(_cls_)
#define fwCoreNonInstanciableClassDefinitionsMacro(_classinfo_)
Generate common code for Non Instanciable classes (Interfaces, Abstract classes, ...)
Base class for all FW4SPL&#39;s classes.
Definition: BaseObject.hpp:22
Key class used to restrict access to Object construction. See http://www.drdobbs.com/184402053.
STL namespace.
This class defines a vector of objects.
Class used to register a class factory in factory registry. This class defines also the object factor...
Definition: IBuilder.hpp:44
Namespace containing activities data and builder.
Contains the representation of the data objects used in the framework.
Base class for all fwActivities builder&#39;s classes.
Definition: IBuilder.hpp:29