Back to home page

EIC code displayed by LXR

 
 

    


Warning, /include/Geant4/tools/offscreen/session 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_offscreen_session
0005 #define tools_offscreen_session
0006 
0007 namespace tools {
0008 namespace offscreen {
0009 
0010 class viewer {
0011 public:
0012   virtual ~viewer() {}
0013 public:
0014   virtual void render() = 0;
0015 };
0016 
0017 }}
0018 
0019 #include "../forit"
0020 #include "../vmanip"
0021 
0022 #include <ostream>
0023 
0024 namespace tools {
0025 namespace offscreen {
0026 
0027 class session {
0028 public:
0029   session(std::ostream& a_out):m_out(a_out) {}
0030   virtual ~session() {}
0031 protected:
0032   session(const session& a_from):m_out(a_from.m_out) {}
0033   session& operator=(const session& a_from) {if(&a_from==this) return *this;return *this;}
0034 public:
0035   std::ostream& out() const {return m_out;}
0036   bool is_valid() const {return true;}
0037   bool steer() {
0038     tools_vforcit(viewer*,m_to_render,it) {(*it)->render();}
0039     m_to_render.clear();
0040     return true;
0041   }
0042   bool sync() {
0043     tools_vforcit(viewer*,m_to_render,it) {(*it)->render();}
0044     m_to_render.clear();
0045     return true;
0046   }
0047 public:
0048   void to_render(viewer* a_viewer) {
0049     if(is_inp(m_to_render,a_viewer)) return;
0050     m_to_render.push_back(a_viewer);
0051   }
0052 protected:
0053   std::ostream& m_out;
0054   std::vector<viewer*> m_to_render;  
0055 };
0056 
0057 }}
0058 
0059 #endif
0060