Teuchos_arrayArg.hpp

Go to the documentation of this file.
00001 // @HEADER
00002 // ***********************************************************************
00003 // 
00004 //                    Teuchos: Common Tools Package
00005 //                 Copyright (2004) Sandia Corporation
00006 // 
00007 // Under terms of Contract DE-AC04-94AL85000, there is a non-exclusive
00008 // license for use of this work by or on behalf of the U.S. Government.
00009 // 
00010 // This library is free software; you can redistribute it and/or modify
00011 // it under the terms of the GNU Lesser General Public License as
00012 // published by the Free Software Foundation; either version 2.1 of the
00013 // License, or (at your option) any later version.
00014 //  
00015 // This library is distributed in the hope that it will be useful, but
00016 // WITHOUT ANY WARRANTY; without even the implied warranty of
00017 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00018 // Lesser General Public License for more details.
00019 //  
00020 // You should have received a copy of the GNU Lesser General Public
00021 // License along with this library; if not, write to the Free Software
00022 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
00023 // USA
00024 // Questions? Contact Michael A. Heroux (maherou@sandia.gov) 
00025 // 
00026 // ***********************************************************************
00027 // @HEADER
00028 
00029 #ifndef TEUCHOS_ARRAY_ARG_HPP
00030 #define TEUCHOS_ARRAY_ARG_HPP
00031 
00036 #include "Teuchos_TestForException.hpp"
00037 
00038 namespace Teuchos {
00039 
00165 template<int N, class T>
00166 class ArrayArg {
00167 public:
00169   ArrayArg( T array[] ) { std::copy( array, array+N, array_ ); }
00170 
00172   T* operator()() { return array_; }
00173 
00175   operator T* () { return array_; }
00176 
00177 private:
00178   T array_[N]; //  Can't be a const array!
00179 }; // class Array1DArg
00180 
00185 template<class T>
00186 inline TEUCHOS_DEPRECATED ArrayArg<1,T> arrayArg( T t1 )
00187 {
00188   T array[] = { t1 };
00189   return ArrayArg<1,T>(array);
00190 }
00191 
00196 template<class T>
00197 inline TEUCHOS_DEPRECATED ArrayArg<2,T> arrayArg( T t1, T t2 )
00198 {
00199   T array[] = { t1, t2 };
00200   return ArrayArg<2,T>(array);
00201 }
00202 
00207 template<class T>
00208 inline TEUCHOS_DEPRECATED ArrayArg<3,T> arrayArg( T t1, T t2, T t3 )
00209 {
00210   T array[] = { t1, t2, t3 };
00211   return ArrayArg<3,T>(array);
00212 }
00213 
00218 template<class T>
00219 inline TEUCHOS_DEPRECATED ArrayArg<4,T> arrayArg( T t1, T t2, T t3, T t4 )
00220 {
00221   T array[] = { t1, t2, t3, t4 };
00222   return ArrayArg<4,T>(array);
00223 }
00224 
00229 template<class T>
00230 inline TEUCHOS_DEPRECATED ArrayArg<5,T> arrayArg( T t1, T t2, T t3, T t4, T t5 )
00231 {
00232   T array[] = { t1, t2, t3, t4, t5 };
00233   return ArrayArg<5,T>(array);
00234 }
00235 
00240 template<class T>
00241 inline TEUCHOS_DEPRECATED ArrayArg<6,T> arrayArg( T t1, T t2, T t3, T t4, T t5, T t6 )
00242 {
00243   T array[] = { t1, t2, t3, t4, t5, t6 };
00244   return ArrayArg<6,T>(array);
00245 }
00246 
00247 } // namespace Teuchos
00248 
00249 #endif // TEUCHOS_ARRAY_ARG_HPP

Generated on Tue Jul 13 09:22:58 2010 for Teuchos - Trilinos Tools Package by  doxygen 1.4.7