1 // SPDX-License-Identifier: Apache-2.0
2 //
3 // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au)
4 // Copyright 2008-2016 National ICT Australia (NICTA)
5 //
6 // Licensed under the Apache License, Version 2.0 (the "License");
7 // you may not use this file except in compliance with the License.
8 // You may obtain a copy of the License at
9 // http://www.apache.org/licenses/LICENSE-2.0
10 //
11 // Unless required by applicable law or agreed to in writing, software
12 // distributed under the License is distributed on an "AS IS" BASIS,
13 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 // See the License for the specific language governing permissions and
15 // limitations under the License.
16 // ------------------------------------------------------------------------
17 
18 
19 //! \addtogroup arma_ostream
20 //! @{
21 
22 
23 
24 class arma_ostream_state
25   {
26   private:
27 
28   const ios::fmtflags   orig_flags;
29   const std::streamsize orig_precision;
30   const std::streamsize orig_width;
31   const char            orig_fill;
32 
33 
34   public:
35 
36   inline arma_ostream_state(const std::ostream& o);
37 
38   inline void restore(std::ostream& o) const;
39   };
40 
41 
42 
43 class arma_ostream
44   {
45   public:
46 
47   template<typename eT> inline static std::streamsize modify_stream(std::ostream& o, const eT*              data, const uword n_elem);
48   template<typename  T> inline static std::streamsize modify_stream(std::ostream& o, const std::complex<T>* data, const uword n_elem);
49   template<typename eT> inline static std::streamsize modify_stream(std::ostream& o, typename SpMat<eT>::const_iterator begin, const uword n_elem, const typename  arma_not_cx<eT>::result* junk = nullptr);
50   template<typename eT> inline static std::streamsize modify_stream(std::ostream& o, typename SpMat<eT>::const_iterator begin, const uword n_elem, const typename arma_cx_only<eT>::result* junk = nullptr);
51 
52   template<typename eT> inline static void     print_elem_zero(std::ostream& o, const bool modify);
53   template<typename eT> inline static void raw_print_elem_zero(std::ostream& o);
54 
55   template<typename eT> inline static void     print_elem(std::ostream& o, const eT& x, const bool modify);
56   template<typename eT> inline static void raw_print_elem(std::ostream& o, const eT& x);
57 
58   template<typename  T> inline static void     print_elem(std::ostream& o, const std::complex<T>& x, const bool modify);
59   template<typename  T> inline static void raw_print_elem(std::ostream& o, const std::complex<T>& x);
60 
61   template<typename eT> arma_cold inline static void print(std::ostream& o, const  Mat<eT>& m, const bool modify);
62   template<typename eT> arma_cold inline static void print(std::ostream& o, const Cube<eT>& m, const bool modify);
63 
64   template<typename oT> arma_cold inline static void print(std::ostream& o, const field<oT>&         m);
65   template<typename oT> arma_cold inline static void print(std::ostream& o, const subview_field<oT>& m);
66 
67   template<typename eT> arma_cold inline static void print_dense(std::ostream& o, const SpMat<eT>& m, const bool modify);
68   template<typename eT> arma_cold inline static void       print(std::ostream& o, const SpMat<eT>& m, const bool modify);
69 
70   arma_cold inline static void print(std::ostream& o, const SizeMat&  S);
71   arma_cold inline static void print(std::ostream& o, const SizeCube& S);
72 
73   template<typename eT> arma_cold inline static void brief_print(std::ostream& o, const   Mat<eT>& m, const bool print_size = true);
74   template<typename eT> arma_cold inline static void brief_print(std::ostream& o, const  Cube<eT>& m);
75   template<typename eT> arma_cold inline static void brief_print(std::ostream& o, const SpMat<eT>& m);
76   };
77 
78 
79 
80 //! @}
81