anatomist  5.1.2
3D neuroimaging data viewer
fusionFactory.h
Go to the documentation of this file.
1 /* This software and supporting documentation are distributed by
2  * Institut Federatif de Recherche 49
3  * CEA/NeuroSpin, Batiment 145,
4  * 91191 Gif-sur-Yvette cedex
5  * France
6  *
7  * This software is governed by the CeCILL-B license under
8  * French law and abiding by the rules of distribution of free software.
9  * You can use, modify and/or redistribute the software under the
10  * terms of the CeCILL-B license as circulated by CEA, CNRS
11  * and INRIA at the following URL "http://www.cecill.info".
12  *
13  * As a counterpart to the access to the source code and rights to copy,
14  * modify and redistribute granted by the license, users are provided only
15  * with a limited warranty and the software's author, the holder of the
16  * economic rights, and the successive licensors have only limited
17  * liability.
18  *
19  * In this respect, the user's attention is drawn to the risks associated
20  * with loading, using, modifying and/or developing or reproducing the
21  * software by the user in light of its specific status of free software,
22  * that may mean that it is complicated to manipulate, and that also
23  * therefore means that it is reserved for developers and experienced
24  * professionals having in-depth computer knowledge. Users are therefore
25  * encouraged to load and test the software's suitability as regards their
26  * requirements in conditions enabling the security of their systems and/or
27  * data to be ensured and, more generally, to use and operate it in the
28  * same conditions as regards security.
29  *
30  * The fact that you are presently reading this means that you have had
31  * knowledge of the CeCILL-B license and that you accept its terms.
32  */
33 
34 
35 #ifndef ANA_FUSION_FUSIONFACTORY_H
36 #define ANA_FUSION_FUSIONFACTORY_H
37 
38 
39 #include <list>
40 #include <set>
41 #include <map>
42 #include <vector>
43 #include <string>
44 
45 
46 namespace anatomist
47 {
48 
49  class AObject;
50 
51 
57  {
58  public:
60  virtual ~FusionMethod();
61 
65  virtual int canFusion( const std::set<AObject *> & ) = 0;
67  virtual AObject* fusion( const std::vector<AObject *> & ) = 0;
69  virtual std::string ID() const = 0;
70  virtual bool orderingMatters() const;
71  virtual std::string generatedObjectType() const = 0;
72  };
73 
74 
80  {
81  public:
83  virtual ~FusionFactory();
84 
89  virtual FusionMethod* chooseMethod( const std::set<AObject *> & );
90  virtual FusionMethod* chooseMethod( std::vector<AObject *> &,
91  bool allowreorder = false );
94  virtual std::multimap<int, std::string>
95  allowedMethods( const std::set<AObject *> & ) const;
97  virtual FusionMethod* method( const std::string & name ) const;
98 
100  static FusionFactory* factory() { return( _theFactory ); }
105  static bool canFusion( const std::set<AObject *> & );
106  static std::set<std::string> methods();
107 
108  protected:
110  static std::set<FusionMethod *> _methods;
111 
112  private:
113  };
114 
115 }
116 
117 
118 #endif
Base Anatomist object (abstract)
Definition: Object.h:96
Handles creation of various fusion objects.
Definition: fusionFactory.h:80
static bool registerMethod(FusionMethod *method)
returns false if the method was already registered
virtual FusionMethod * chooseMethod(const std::set< AObject * > &)
Chooses one method which can fusion these objects.
static std::set< FusionMethod * > _methods
virtual std::multimap< int, std::string > allowedMethods(const std::set< AObject * > &) const
lists all possible fusions on the given objects, classed with a priority
virtual FusionMethod * chooseMethod(std::vector< AObject * > &, bool allowreorder=false)
static FusionFactory * factory()
virtual FusionMethod * method(const std::string &name) const
Selects the method with ID name (if any)
static bool canFusion(const std::set< AObject * > &)
is there at least one method which can actually make a fusion with these objects ?
static FusionFactory * _theFactory
static std::set< std::string > methods()
Fusion method interface.
Definition: fusionFactory.h:57
virtual bool orderingMatters() const
virtual AObject * fusion(const std::vector< AObject * > &)=0
creates the fusion
virtual std::string generatedObjectType() const =0
virtual std::string ID() const =0
identifier for the method
virtual int canFusion(const std::set< AObject * > &)=0
returns 0 if fusion is not possible on the given objects, or a positive number if it is allowed.