MeshReaderService.hpp 2.89 KB
Newer Older
1
/* ***** BEGIN LICENSE BLOCK *****
2
 * FW4SPL - Copyright (C) IRCAD, 2009-2017.
3
4
5
6
 * Distributed under the terms of the GNU Lesser General Public License (LGPL) as
 * published by the Free Software Foundation.
 * ****** END LICENSE BLOCK ****** */

julien.waechter's avatar
julien.waechter committed
7
8
#ifndef __IODATA_MESHREADERSERVICE_HPP__
#define __IODATA_MESHREADERSERVICE_HPP__
9

10
11
#include "ioData/config.hpp"

12
13
#include <io/IReader.hpp>

14
#include <boost/filesystem/path.hpp>
15
16
17
18
19
20
21
22
23
24
25
26

namespace ioData
{
/**
 * @brief   Mesh reader service.
 *
 * Service reading a trian file into a fwData::Mesh object.
 * @li This service has no specified start and stop method.
 * @li Use setConfiguration(cfg) and configure() methods to configure the mesh filename.
 * @li Use update() to read the mesh and notify observers.
 *
 * Service registered details : \n
27
 * fwServicesRegisterMacro( ::io::IReader , ::ioData::MeshReaderService , ::fwData::Mesh )
28
29
30
31
32
33
 */
class IODATA_CLASS_API MeshReaderService : public ::io::IReader
{

public:

34
    fwCoreServiceClassDefinitionsMacro( (MeshReaderService)(::io::IReader) );
35

julien.waechter's avatar
julien.waechter committed
36
37
    /// Super class of reader services
    typedef ::io::IReader SuperClass;
38
39
40
41
42
43
44
45

    /** @name Specified reader service methods ( override from ::io::IReader )
     * @{
     */

    /**
     * @brief   returns  (filename) extension
     */
julien.waechter's avatar
julien.waechter committed
46
    IODATA_API virtual std::vector< std::string > getSupportedExtensions();
47
48
49
50
51
52
53
54
55
56

    /**
     * @brief Configure the mesh path.
     *
     * This method is used to find
     * the file path  using a file selector.
     */
    IODATA_API void configureWithIHM();
    /// @}

57
58
59
    /// Return path type managed by the service, here FILE
    IODATA_API virtual ::io::IOPathType getIOPathType() const;

60
61
62
63
64
65
66
67
68
69
70
protected:

    /** @name Service methods ( override from ::fwServices::IService )
     * @{
     */

    /**
     * @brief Starting method : default does nothing.
     *
     * This method is used to initialize the service.
     */
julien.waechter's avatar
julien.waechter committed
71
72
73
    virtual void starting() throw(::fwTools::Failed)
    {
    }
74
75
76
77
78
79

    /**
     * @brief Stopping method : default does nothing.
     *
     * The stopping method is empty for this service.
     */
julien.waechter's avatar
julien.waechter committed
80
81
82
    virtual void stopping() throw(::fwTools::Failed)
    {
    }
83

84
85
86
87
    /**
     * @brief Configuring method : calls implementation from `io::IReader`
     */
    IODATA_API virtual void configuring() throw(::fwTools::Failed);
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105

    /**
     * @brief Updating method. This method is called by update() from base service ( ::fwServices::IService )
     *
     * This method is used to update the service.
     * The mesh is read with the reader ::fwDataIO::reader::MeshReader.
     * Notify reading.
     */
    IODATA_API void updating() throw(::fwTools::Failed);

    /**
     * @brief Info method.
     *
     * This method is used to give
     * informations about the service.
     *
     * @param[out] _sstream output stream
     */
106
    IODATA_API virtual void info(std::ostream& _sstream );
107
108
109
110
111
112
    /// @}

};

}

julien.waechter's avatar
julien.waechter committed
113
#endif /*__IODATA_MESHREADERSERVICE_HPP__*/