aimsdata  5.0.5
Neuroimaging data handling
aimsGraphW.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  * Region Of Interest
36  */
37 #ifndef AIMS_IO_AIMSGRAPHW_H
38 #define AIMS_IO_AIMSGRAPHW_H
39 
40 #include <aims/io/process.h>
42 
43 class Graph;
44 
45 namespace aims
46 {
47  struct AimsGraphWriter_Private;
48 
49  namespace internal
50  {
51  struct AimsGraphWriter_ElemStruct;
52  }
53 
54 
55  class AimsGraphWriter : public Process
56  {
57  public:
59  {
60  Keep,
62  Local
63  };
64 
65  struct Wrapper
66  {
67  friend class AimsGraphWriter;
68 
69  virtual ~Wrapper() {}
70  virtual void destroy() {}
71 
72  virtual std::string objectType() const = 0;
73  virtual std::string dataType() const = 0;
74 
75  private:
76  virtual int freeindex() const = 0;
77  virtual bool write( const AimsGraphWriter & ) const = 0;
78  };
79 
80  template<typename T> struct ObjectWrapper : public Wrapper
81  {
82  friend class AimsGraphWriter;
83 
84  ObjectWrapper( T* x ) : data( x ) {}
85  virtual ~ObjectWrapper() {}
86  virtual void destroy() { delete data; }
87 
88  virtual std::string objectType() const;
89  virtual std::string dataType() const;
90 
91  T *data;
92 
93  private:
94  virtual int freeindex() const;
95  virtual bool write( const AimsGraphWriter & ) const;
96  };
97 
98  struct ElementInfo
99  {
102  std::string attribute;
104  };
105 
106  template<typename T> friend struct ObjectWrapper;
107 
108  AimsGraphWriter( const std::string & filename );
109  virtual ~AimsGraphWriter();
110 
123  virtual void writeElements( Graph & g, SavingMode newmode = Keep,
124  SavingMode oldmode = Keep,
125  bool saveOnlyModified = false );
126 
127  template<class T>
128  static bool defaultTakeObject( Process &, const std::string &, Finder & );
129 
130  const ElementInfo & elementInfo() const { return( info ); }
131  ElementInfo & elementInfo() { return( info ); }
132 
133  private:
134  template<class T> bool write( const T & ) const;
135  void writeElement( carto::AttributedObject *ao,
136  internal::AimsGraphWriter_ElemStruct & es );
137 
138  mutable ElementInfo info;
139  mutable AimsGraphWriter_Private *d;
140  };
141 
142 }
143 
144 
145 #endif
const ElementInfo & elementInfo() const
Definition: aimsGraphW.h:130
ElementInfo & elementInfo()
Definition: aimsGraphW.h:131
The class for EcatSino data write operation.
Definition: border.h:44
Generic finder / checker for all data objects and file formats This will replace the old AimsFinder...
Definition: finder.h:117
Link mechanism between the Finder and a process operating on arbitrary data types.
Definition: process.h:199
carto::AttributedObject * element
Definition: aimsGraphW.h:101