matio-cpp  v0.2.5
A C++ wrapper of the matio library, with memory ownership handling, to read and write .mat files.
File.tpp
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2022 Fondazione Istituto Italiano di Tecnologia
3  *
4  * This software may be modified and distributed under the terms of the
5  * BSD-2-Clause license (https://opensource.org/licenses/BSD-2-Clause).
6  */
7 
8 #ifndef MATIOCPP_FILE_TPP
9 #define MATIOCPP_FILE_TPP
10 
11 template<class input>
12 const input &matioCpp::File::getVariable(const input& it)
13 {
14  return it;
15 }
16 
17 template<class key, class input>
18 const input &matioCpp::File::getVariable(const std::pair<key, input>& it)
19 {
20  return it.second;
21 }
22 
23 template <class iterator>
24 bool matioCpp::File::write(iterator begin, iterator end, Compression compression)
25 {
26  for (iterator it = begin; it != end; ++it)
27  {
28  if (!write(getVariable(*it), compression))
29  {
30  return false;
31  }
32  }
33 
34  return true;
35 }
36 
37 #endif // MATIOCPP_FILE_TPP
bool write(const Variable &variable, matioCpp::Compression compression=matioCpp::Compression::None)
Write a Variable to a file.
Definition: File.cpp:334
Compression
Compression type when writing to a file.