unwrap_cube.hpp
Go to the documentation of this file.
00001 // Copyright (C) 2008-2010 NICTA (www.nicta.com.au)
00002 // Copyright (C) 2008-2010 Conrad Sanderson
00003 // 
00004 // This file is part of the Armadillo C++ library.
00005 // It is provided without any warranty of fitness
00006 // for any purpose. You can redistribute this file
00007 // and/or modify it under the terms of the GNU
00008 // Lesser General Public License (LGPL) as published
00009 // by the Free Software Foundation, either version 3
00010 // of the License or (at your option) any later version.
00011 // (see http://www.opensource.org/licenses for more info)
00012 
00013 
00016 
00017 
00018 
00019 template<typename T1>
00020 class unwrap_cube
00021   {
00022   public:
00023   
00024   typedef typename T1::elem_type eT;
00025   
00026   inline
00027   unwrap_cube(const T1& A)
00028     : M(A)
00029     {
00030     arma_extra_debug_sigprint();
00031     }
00032   
00033   const Cube<eT> M;
00034   };
00035 
00036 
00037 
00038 template<typename eT>
00039 class unwrap_cube< Cube<eT> >
00040   {
00041   public:
00042 
00043   inline
00044   unwrap_cube(const Cube<eT>& A)
00045     : M(A)
00046     {
00047     arma_extra_debug_sigprint();
00048     }
00049 
00050   const Cube<eT>& M;
00051   };
00052 
00053 
00054 
00055 //
00056 //
00057 //
00058 
00059 
00060 
00061 template<typename T1>
00062 class unwrap_cube_check
00063   {
00064   typedef typename T1::elem_type eT;
00065   
00066   inline
00067   unwrap_cube_check(const T1& A, const Cube<eT>& B)
00068     : M(A)
00069     {
00070     arma_extra_debug_sigprint();
00071     
00072     arma_type_check(( is_arma_cube_type<T1>::value == false ));
00073     }
00074   
00075   const Cube<eT> M;
00076   };
00077 
00078 
00079 
00080 template<typename eT>
00081 class unwrap_cube_check< Cube<eT> >
00082   {
00083   public:
00084 
00085   inline
00086   unwrap_cube_check(const Cube<eT>& A, const Cube<eT>& B)
00087     : M_local( (&A == &B) ? new Cube<eT>(A) : 0 )
00088     , M      ( (&A == &B) ? (*M_local)      : A )
00089     {
00090     arma_extra_debug_sigprint();
00091     }
00092   
00093   
00094   inline
00095   ~unwrap_cube_check()
00096     {
00097     arma_extra_debug_sigprint();
00098     
00099     if(M_local)
00100       {
00101       delete M_local;
00102       }
00103     }
00104   
00105   
00106   // the order below is important
00107   const Cube<eT>* M_local;
00108   const Cube<eT>& M;
00109   
00110   };
00111 
00112 
00113 


armadillo_matrix
Author(s): Conrad Sanderson - NICTA (www.nicta.com.au), (Wrapper by Sjoerd van den Dries)
autogenerated on Tue Jan 7 2014 11:42:06