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       return false;
0032     }
0033     for(uint32 index=0;index<n;index++) vec[index] = v[index];
0034     delete [] v;
0035     return true;
0036   }
0037   virtual bool dump(std::ostream&) {
0038     return true;
0039   }
0040   virtual bool s_value(std::string& a_s) const {a_s.clear();return false;}
0041   virtual bool s2value(const std::string&) {return false;}
0042 public:
0043   sf_rotf():parent(){}
0044   sf_rotf(const rotf& a_value):parent(a_value){}
0045   virtual ~sf_rotf(){}
0046 public:
0047   sf_rotf(const sf_rotf& a_from):parent(a_from){}
0048   sf_rotf& operator=(const sf_rotf& a_from){
0049     parent::operator=(a_from);
0050     return *this;
0051   }
0052 public:
0053   sf_rotf& operator=(const rotf& a_value){
0054     parent::operator=(a_value);
0055     return *this;
0056   }
0057 public: //iv2ps
0058   void setValue(const vec3f& a_axis,float a_angle) {
0059     value(rotf(a_axis,a_angle));
0060   }
0061   void setValue(const rotf& a_value) {
0062     value(a_value);
0063   }
0064 };
0065 
0066 }}
0067 
0068 #endif