fw4spl
MultiFiles.hpp
1 /* ***** BEGIN LICENSE BLOCK *****
2  * FW4SPL - Copyright (C) IRCAD, 2009-2017.
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 #ifndef __FWDATA_LOCATION_MULTIFILES_HPP__
8 #define __FWDATA_LOCATION_MULTIFILES_HPP__
9 
10 #include "fwData/config.hpp"
11 #include "fwData/location/ILocation.hpp"
12 
13 #include <boost/filesystem/path.hpp>
14 
15 #include <vector>
16 
17 namespace fwData
18 {
19 namespace location
20 {
24 class FWDATA_CLASS_API MultiFiles : public ILocation
25 {
26 public:
27  fwCoreClassDefinitionsWithFactoryMacro( (MultiFiles)(ILocation), (()), ::fwData::factory::New< MultiFiles > );
28 
30  FWDATA_API MultiFiles( ::fwData::Object::Key key );
31 
33  FWDATA_API virtual ~MultiFiles();
34 
36  FWDATA_API void setPaths( VectPathType paths );
37 
39  FWDATA_API VectPathType getPaths();
40 
42  FWDATA_API void cachedDeepCopy(const Object::csptr& _source, DeepCopyCacheType& cache) override;
43 
44 protected:
45 
47  VectPathType m_paths;
48 
49 };
50 
57 template<class RW> // reader or writer class should only need to implement get/setLocation
59 {
64  enableMultiFiles(RW* rw) :
65  m_rw(rw)
66  {
67  SLM_ASSERT("m_rw not instanced", m_rw);
68  }
69 
71  void setFiles( ILocation::VectPathType paths )
72  {
73  getLocation<MultiFiles>(m_rw)->setPaths(paths);
74  }
75 
77  ILocation::VectPathType getFiles()
78  {
79  return getLocation<MultiFiles>(m_rw)->getPaths();
80  }
81 
82  private:
85  RW* m_rw;
86 };
87 
88 }
89 }
90 
91 #endif /* __FWDATA_LOCATION_MULTIFILES_HPP__ */
Key class used to restrict access to Object construction. See http://www.drdobbs.com/184402053.
void setFiles(ILocation::VectPathType paths)
Set file system paths.
Definition: MultiFiles.hpp:71
#define fwCoreClassDefinitionsWithFactoryMacro(_classinfo_, _parameters_, _factory_)
Generate common construction methods for classes with one factory.
#define SLM_ASSERT(message, cond)
work like &#39;assert&#39; from &#39;cassert&#39;, with in addition a message logged by spylog (with FATAL loglevel) ...
Definition: spyLog.hpp:308
Abstract class to define a location ( fileSystem, directory(IES) etc.... )
Definition: ILocation.hpp:28
This class defines a multi files location.
Definition: MultiFiles.hpp:24
ILocation::VectPathType getFiles()
Get file system paths.
Definition: MultiFiles.hpp:77
Contains the representation of the data objects used in the framework.
enableMultiFiles(RW *rw)
constructor
Definition: MultiFiles.hpp:64
This class is derived by reader/writer.
Definition: MultiFiles.hpp:58
VectPathType m_paths
file system paths
Definition: MultiFiles.hpp:47