STIR 6.4.0
write_to_file.h
Go to the documentation of this file.
1//
2//
3#ifndef __stir_IO_write_to_file_H__
4#define __stir_IO_write_to_file_H__
5/*
6 Copyright (C) 2015, University College London
7 This file is part of STIR.
8
9 SPDX-License-Identifier: Apache-2.0
10
11 See STIR/LICENSE.txt for details
12*/
23#include "stir/Succeeded.h"
24#include "stir/error.h"
25
26START_NAMESPACE_STIR
27
29
44template <class DataT>
45inline std::string
46write_to_file(const std::string& filename, const DataT& data)
47{
48 std::string filename_used(filename);
49
51 {
52 error("Error writing data to file '" + filename + "'");
53 }
54 return filename_used;
55}
56
57END_NAMESPACE_STIR
58
59#endif
Declaration of class stir::OutputFileFormat.
Declaration of class stir::Succeeded.
static shared_ptr< OutputFileFormat< DataT > > default_sptr()
A function to return a default output file format.
Declaration of stir::error()
std::string write_to_file(const std::string &filename, const DataT &data)
Function that writes data to file using the default OutputFileFormat.
Definition write_to_file.h:46
void error(const char *const s,...)
Print error with format string a la printf and throw exception.
Definition error.cxx:42