Main Page | Namespace List | Class Hierarchy | Class List | File List | Namespace Members | Class Members

Surface_Tie.hxx

00001 
00002 // 
00003 // Copyright (C) 2006 James M. Lawrence.  All rights reserved.
00004 // 
00005 // software: esve-1.0.3
00006 // file: esve/viewers/dimn/Surface_Tie.hxx
00007 // 
00008 // Redistribution and use in source and binary forms, with or without
00009 // modification, are permitted provided that the following conditions
00010 // are met:
00011 // 
00012 // 1. Redistributions of source code must retain the above copyright
00013 //    notice, this list of conditions and the following disclaimer.
00014 // 
00015 // 2. The origin of this software must not be misrepresented; you must
00016 //    not claim that you wrote the original software.  If you use this
00017 //    software in a product, an acknowledgment in the product 
00018 //    documentation would be appreciated but is not required.
00019 // 
00020 // 3. Altered source versions must be plainly marked as such, and must
00021 //    not be misrepresented as being the original software.
00022 // 
00023 // 4. The name of the author may not be used to endorse or promote
00024 //    products derived from this software without specific prior written
00025 //    permission.
00026 // 
00027 // THIS SOFTWARE IS PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY,
00028 // AND WITH NO CLAIM AS TO ITS SUITABILITY FOR ANY PURPOSE.  IN NO EVENT
00029 // SHALL THE AUTHOR BE LIABLE FOR ANY CLAIM WHATSOEVER MADE IN CONNECTION
00030 // TO THIS SOFTWARE.
00031 // 
00033 
00034 
00035 #ifndef esve_viewers_dimn_Surface_Tie_hxx
00036 #define esve_viewers_dimn_Surface_Tie_hxx
00037 
00038 #include <esve/viewers/dimn/Valuator_Effect.hxx>
00039 #include <esve/components/dimn/Simple_UI_Tie.hxx>
00040 #include <esve/types/quat.hxx>
00041 #include <esve/types/pure.hxx>
00042 #include <esve/types/complex.hxx>
00043 #include <map>
00044 #include <string>
00045 
00046 namespace esve { namespace viewers { namespace dimn {
00047 
00058 
00059 template< typename T_Surface >
00060 class Surface_Tie
00061     : public components::dimn::Valuator_Handler<types::real>,
00062       public components::dimn::Valuator_Handler<types::complex>,
00063       public components::dimn::Valuator_Handler<types::pure>,
00064       public components::dimn::Valuator_Handler<types::quat>
00065 {
00066 private:
00067     typedef components::dimn::Valuator_Handler<types::real> super ;
00068 
00069 #if !defined(NDEBUG)
00070     template< class U > static void m_unused( const U & ) { }
00071 
00072     struct m_Requirements
00073     {
00074         m_Requirements()
00075         {
00076             typedef void (T_Surface::*R)() ;
00077             R r1 = &T_Surface::update_domain ;
00078             R r2 = &T_Surface::update_domain_clip ;
00079             R r3 = &T_Surface::update_surface ;
00080             R r4 = &T_Surface::update_surface_clip ;
00081             R r5 = &T_Surface::update_color ;
00082             m_unused(r1) ;
00083             m_unused(r2) ;
00084             m_unused(r3) ;
00085             m_unused(r4) ;
00086             m_unused(r5) ;
00087         }
00088     } m_requirements ;
00089 #endif // !defined(NDEBUG)
00090 
00091     typedef T_Surface m_Surface ;
00092     typedef typename m_Surface::Spec m_Spec ;
00093 
00094     typedef std::map<const components::dimn::Valuator<types::real>*,
00095                      Valuator_Effect> m_Real_Map ;
00096     typedef std::pair<const components::dimn::Valuator<types::real>*,
00097                       Valuator_Effect> m_Real_Pair ;
00098 
00099     typedef std::map<const components::dimn::Valuator<types::complex>*,
00100                      Valuator_Effect> m_Complex_Map ;
00101     typedef std::pair<const components::dimn::Valuator<types::complex>*,
00102                       Valuator_Effect> m_Complex_Pair ;
00103 
00104     typedef std::map<const components::dimn::Valuator<types::pure>*,
00105                      Valuator_Effect> m_Pure_Map ;
00106     typedef std::pair<const components::dimn::Valuator<types::pure>*,
00107                       Valuator_Effect> m_Pure_Pair ;
00108 
00109     typedef std::map<const components::dimn::Valuator<types::quat>*,
00110                      Valuator_Effect> m_Quat_Map ;
00111     typedef std::pair<const components::dimn::Valuator<types::quat>*,
00112                       Valuator_Effect> m_Quat_Pair ;
00113 
00114     struct m_Tie : public components::dimn::Simple_UI_Tie<m_Spec>
00115     {
00116         m_Tie( components::dimn::Simple_UI & ui, m_Spec & target )
00117             : components::dimn::Simple_UI_Tie<m_Spec>(ui, target) { }
00118 
00119         using components::dimn::Simple_UI_Tie<m_Spec>::handle_valuator ;
00120     } ;
00121 
00122     Surface_Tie( const Surface_Tie & ) ;
00123     Surface_Tie & operator=( const Surface_Tie & ) ;
00124 
00125     void m_update_surface( Valuator_Effect ) ;
00126 
00127     m_Tie m_tie ;
00128 
00129     m_Real_Map m_real_map ;
00130     m_Complex_Map m_complex_map ;
00131     m_Pure_Map m_pure_map ;
00132     m_Quat_Map m_quat_map ;
00133 
00134     m_Surface & m_surface ;
00135 
00136 public:
00137     typedef m_Surface Surface ;
00138     typedef m_Spec Spec ;
00139 
00140     typedef typename m_Tie::Real_Member Real_Member ;
00141     typedef typename m_Tie::Real_Reader Real_Reader ;
00142     typedef typename m_Tie::Real_Writer Real_Writer ;
00143 
00144     typedef typename m_Tie::Complex_Member Complex_Member ;
00145     typedef typename m_Tie::Complex_Reader Complex_Reader ;
00146     typedef typename m_Tie::Complex_Writer Complex_Writer ;
00147 
00148     typedef typename m_Tie::Pure_Member Pure_Member ;
00149     typedef typename m_Tie::Pure_Reader Pure_Reader ;
00150     typedef typename m_Tie::Pure_Writer Pure_Writer ;
00151 
00152     typedef typename m_Tie::Quat_Member Quat_Member ;
00153     typedef typename m_Tie::Quat_Reader Quat_Reader ;
00154     typedef typename m_Tie::Quat_Writer Quat_Writer ;
00155 
00156     Surface_Tie( components::dimn::Simple_UI & ui,
00157                  Spec & spec,
00158                  Surface & surface ) ;
00159 
00160     components::dimn::Valuator<types::real> &
00161     create_valuator( Real_Member,
00162                      Valuator_Effect,
00163                      const std::string & name = "" ) ;
00164 
00165     components::dimn::Valuator<types::real> &
00166     create_valuator( Real_Reader,
00167                      Real_Writer,
00168                      Valuator_Effect,
00169                      const std::string & name = "" ) ;
00170 
00171     components::dimn::Valuator<types::complex> &
00172     create_valuator( Complex_Member,
00173                      Valuator_Effect,
00174                      const std::string & name = "" ) ;
00175 
00176     components::dimn::Valuator<types::complex> &
00177     create_valuator( Complex_Reader,
00178                      Complex_Writer,
00179                      Valuator_Effect,
00180                      const std::string & name = "" ) ;
00181 
00182     components::dimn::Valuator<types::pure> &
00183     create_valuator( Pure_Member,
00184                      Valuator_Effect,
00185                      const std::string & name = "" ) ;
00186 
00187     components::dimn::Valuator<types::pure> &
00188     create_valuator( Pure_Reader,
00189                      Pure_Writer,
00190                      Valuator_Effect,
00191                      const std::string & name = "" ) ;
00192 
00193     components::dimn::Valuator<types::quat> &
00194     create_valuator( Quat_Member,
00195                      Valuator_Effect,
00196                      const std::string & name = "" ) ;
00197 
00198     components::dimn::Valuator<types::quat> &
00199     create_valuator( Quat_Reader,
00200                      Quat_Writer,
00201                      Valuator_Effect,
00202                      const std::string & name = "" ) ;
00203 
00204     ~Surface_Tie() ;
00205 
00206 protected:
00207     bool handle_valuator(
00208         const components::dimn::Valuator<types::real> & ) ;
00209     bool handle_valuator(
00210         const components::dimn::Valuator<types::complex> & ) ;
00211     bool handle_valuator(
00212         const components::dimn::Valuator<types::pure> & ) ;
00213     bool handle_valuator(
00214         const components::dimn::Valuator<types::quat> & ) ;
00215 } ;
00216 
00217 }}} // namespace esve::viewers::dimn
00218 
00219 #include <esve/viewers/dimn/Surface_Tie.template.cxx>
00220 
00221 #endif
00222 

Generated on Tue May 30 11:40:53 2006 for esve by doxygen 1.3.4