vec-io.hpp

Go to the documentation of this file.
00001 //=============================================================================
00002 /*! operator() for non-const object */
00003 inline double& vec::operator()(const int& i)
00004 {
00005   switch( i ){
00006   case 0: return x;
00007   case 1: return y;
00008   case 2: return z;
00009   default:
00010     std::cerr << "[ERROR] vec::operator()(const int&)" << std::endl
00011               << "The required component was not 0, 1, or 2." << std::endl
00012               << "Your input was (" << i << ")." << std::endl;
00013     std::exit(1);
00014   }
00015 }
00016 
00017 //=============================================================================
00018 /*! operator() for const object */
00019 inline double vec::operator()(const int& i) const
00020 {
00021   switch( i ){
00022   case 0: return x;
00023   case 1: return y;
00024   case 2: return z;
00025   default:
00026     std::cerr << "[ERROR] vec::operator()(const int&) const" << std::endl
00027               << "The required component was not 0, 1, or 2." << std::endl
00028               << "Your input was (" << i << ")." << std::endl;
00029     std::exit(1);
00030   }
00031 }
00032 
00033 ///////////////////////////////////////////////////////////////////////////////
00034 ///////////////////////////////////////////////////////////////////////////////
00035 ///////////////////////////////////////////////////////////////////////////////
00036 
00037 //============================================================================ 
00038 inline std::ostream& operator<<(std::ostream& s, const vec& v)
00039 {
00040   s << "{ "<< v.x << "; " << v.y << "; " << v.z << " }";
00041   return s;
00042 }

Generated on Tue Mar 15 16:02:38 2005 for QVM by  doxygen 1.4.1