cheshirekow  v0.1.0
stream_assignment.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2012 Josh Bialkowski (jbialk@mit.edu)
3  *
4  * This file is part of fiber.
5  *
6  * fiber is free software: you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation, either version 3 of the License, or
9  * (at your option) any later version.
10  *
11  * fiber is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with fiber. If not, see <http://www.gnu.org/licenses/>.
18  */
25 #ifndef FIBER_STREAMASSIGNMENT_H_
26 #define FIBER_STREAMASSIGNMENT_H_
27 
28 
29 namespace fiber {
30 
32 template <class Mat>
34  public:
36 
37  private:
38  Mat& m_mat;
39  unsigned int m_i;
40 
41  public:
42  StreamAssignment(Mat& M) : m_mat(M), m_i(0) {}
43 
44  template <typename Format_t>
45 
46  Stream_t& operator<<(Format_t x) {
47  m_mat[m_i++] = x;
48  return *this;
49  }
50 
51  template <typename Format_t>
52 
53  Stream_t& operator, (Format_t x) {
54  m_mat[m_i++] = x;
55  return *this;
56  }
57 };
58 
59 } // namespace fiber
60 
61 
62 #endif // FIBER_STREAMASSIGNMENT_H_
Stream_t & operator,(Format_t x)
StreamAssignment< Mat > Stream_t
Stream_t & operator<<(Format_t x)