Back to home page

EIC code displayed by LXR

 
 

    


Warning, /include/Geant4/tools/sg/states 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_states
0005 #define tools_sg_states
0006 
0007 #include "state"
0008 
0009 namespace tools {
0010 namespace sg {
0011 
0012 class states {
0013 public:
0014   states(unsigned int a_ww,unsigned int a_wh):m_states() {
0015     m_state.m_ww = a_ww;
0016     m_state.m_wh = a_wh;
0017   }
0018   virtual ~states(){}
0019 protected:
0020   states(const states& a_from)
0021   :m_states(a_from.m_states)
0022   ,m_state(a_from.m_state)
0023   ,m_saved_state(a_from.m_saved_state)
0024   {}
0025   states& operator=(const states& a_from){
0026     m_states = a_from.m_states;
0027     m_state = a_from.m_state;
0028     m_saved_state = a_from.m_saved_state;
0029     return *this;
0030   }
0031 public:
0032   const sg::state& state() const {return m_state;}
0033   sg::state& state() {return m_state;}
0034   void pop_state() {
0035     //if(!m_states.size()) return; //throw.
0036     m_state = m_states.back();
0037     m_states.pop_back();
0038   }
0039   void push_state() {m_states.push_back(m_state);}
0040 
0041   void save_state(const sg::state& a_state) {m_saved_state = a_state;}
0042   const sg::state& saved_state() const {return m_saved_state;}
0043   sg::state& saved_state() {return m_saved_state;}
0044 protected:
0045   std::vector<sg::state> m_states;
0046   sg::state m_state;
0047   sg::state m_saved_state;
0048 };
0049 
0050 }}
0051 
0052 #endif