fw4spl
IReader.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 "fwIO/config.hpp"
10 #include "fwIO/ioTypes.hpp"
11 
12 #include <fwServices/IService.hpp>
13 
14 #include <boost/filesystem/path.hpp>
15 
16 namespace fwIO
17 {
18 
34 class FWIO_CLASS_API IReader : public ::fwServices::IService
35 {
36 
37 public:
39 
40 
44  FWIO_API static const ::fwCom::Slots::SlotKeyType s_SET_FILE_FOLDER;
46 
51 
58  FWIO_API virtual void configureWithIHM() = 0;
59 
63  FWIO_API virtual std::vector< std::string > getSupportedExtensions();
64 
68  FWIO_API virtual std::string getSelectorDialogTitle();
69 
78  FWIO_API virtual ::fwIO::IOPathType getIOPathType() const;
79 
85  FWIO_API const ::boost::filesystem::path& getFile() const;
86 
91  FWIO_API void setFile(const ::boost::filesystem::path& file);
92 
98  FWIO_API const ::fwIO::LocationsType& getFiles() const;
99 
104  FWIO_API void setFiles(const ::fwIO::LocationsType& files);
105 
111  FWIO_API const ::boost::filesystem::path& getFolder() const;
112 
116  FWIO_API void clearLocations();
117 
122  FWIO_API const ::fwIO::LocationsType& getLocations() const;
123 
128  FWIO_API void setFolder(const ::boost::filesystem::path& folder);
129 
136  FWIO_API void setFileFolder(::boost::filesystem::path folder);
137 
139  FWIO_API bool hasLocationDefined() const;
140 
142 
143 protected:
144 
145  FWIO_API IReader() noexcept;
146 
147  FWIO_API virtual ~IReader() noexcept;
148 
202  FWIO_API virtual void configuring() override;
203 
207  std::string m_windowTitle;
208 
209 private:
210 
212  void readFolder(::boost::filesystem::path path);
214  void readFile(::boost::filesystem::path path);
216  void readFiles(::fwIO::LocationsType files);
217 
219  ::fwIO::LocationsType m_locations;
220 };
221 
222 } //namespace fwIO
Base class for all services.
Definition: IService.hpp:61
Namespace containing fw4spl communication tools.
Definition: DumpEditor.hpp:30
STL namespace.
Reader service API. It manages extension points definition and extension configuration.
Definition: IReader.hpp:34
IOPathType
IOPathType defines different type of paths used by service readers/writers.
Definition: ioTypes.hpp:19
#define fwCoreServiceClassDefinitionsMacro(_classinfo_)
Generate common code for services classes.
The namespace fwIO contains the base interface for reader and writer services.
Definition: ioTypes.hpp:16
std::vector< ::boost::filesystem::path > LocationsType
List of paths managed by io services.
Definition: ioTypes.hpp:28