fw4spl
Raw.cpp
1 /* ***** BEGIN LICENSE BLOCK *****
2  * FW4SPL - Copyright (C) IRCAD, 2009-2015.
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 #include <boost/filesystem/path.hpp>
8 #include <boost/filesystem/fstream.hpp>
9 #include <boost/filesystem/operations.hpp>
10 
11 
12 #include <fwCore/macros.hpp>
13 #include <fwCore/exceptionmacros.hpp>
14 
15 #include "fwMemory/stream/in/Raw.hpp"
16 
17 namespace fwMemory
18 {
19 namespace stream
20 {
21 namespace in
22 {
23 
24 SPTR(std::istream) Raw::get()
25 {
26  FW_RAISE_IF("file "<< m_path.string() << " does not exist anymore or has been moved.",
27  !boost::filesystem::exists(m_path));
28 
29  SPTR(::boost::filesystem::ifstream) fs
30  = std::make_shared< ::boost::filesystem::ifstream>(m_path, std::ios::in|std::ios::binary);
31  return fs;
32 }
33 
34 } // namespace in
35 } // namespace stream
36 } // namespace fwMemory
37 
#define SPTR(_cls_)
The namespace fwMemory contains tools to manage memory. Use for dump.
Definition: SReader.hpp:20
STL namespace.
This file defines fwCore base macros.