Back to home page

EIC code displayed by LXR

 
 

    


Warning, /include/Geant4/tools/sg/sf_rotf is written in an unsupported language. File is not indexed.

0001 // Copyright (C) 2010, Guy Barrand. All rights reserved.
0002 // See the file tools.license for terms.
0003 
0004 #ifndef tools_sg_sf_rotf
0005 #define tools_sg_sf_rotf
0006 
0007 #include "sf"
0008 
0009 #include "../lina/rotf"
0010 
0011 #include "../HEADER"
0012 
0013 namespace tools {
0014 namespace sg {
0015 
0016 class sf_rotf : public bsf<rotf> {
0017   TOOLS_HEADER(sf_rotf,tools::sg::sf_rotf,bsf<rotf>)
0018 public:
0019   virtual bool write(io::iwbuf& a_buffer) {
0020     const vec4<float>& vec = m_value.quat();
0021     const float* d = get_data(vec);
0022     return a_buffer.write_vec(vec.size(),d);
0023   }
0024   virtual bool read(io::irbuf& a_buffer) {
0025     vec4<float>& vec = m_value.quat();
0026     uint32 n;
0027     float* v;
0028     if(!a_buffer.read_vec(n,v)) return false;
0029     if(n!=vec.size()) {
0030       delete [] v;
0031 #ifdef TOOLS_MEM
0032       mem::decrement(s_new().c_str());
0033 #endif
0034       return false;
0035     }
0036     for(uint32 index=0;index<n;index++) vec[index] = v[index];
0037     delete [] v;
0038 #ifdef TOOLS_MEM
0039     mem::decrement(s_new().c_str());
0040 #endif
0041     return true;
0042   }
0043   virtual bool dump(std::ostream&) {
0044     //a_out << parent::m_value << std::endl;
0045     return true;
0046   }
0047   virtual bool s_value(std::string& a_s) const {a_s.clear();return false;}
0048   virtual bool s2value(const std::string&) {return false;}
0049 public:
0050   sf_rotf():parent(){}
0051   sf_rotf(const rotf& a_value):parent(a_value){}
0052   virtual ~sf_rotf(){}
0053 public:
0054   sf_rotf(const sf_rotf& a_from):parent(a_from){}
0055   sf_rotf& operator=(const sf_rotf& a_from){
0056     parent::operator=(a_from);
0057     return *this;
0058   }
0059 public:
0060   sf_rotf& operator=(const rotf& a_value){
0061     parent::operator=(a_value);
0062     return *this;
0063   }
0064 public: //iv2ps
0065   void setValue(const vec3f& a_axis,float a_angle) {
0066     value(rotf(a_axis,a_angle));
0067   }
0068   void setValue(const rotf& a_value) {
0069     value(a_value);
0070   }
0071 };
0072 
0073 }}
0074 
0075 #endif