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

Make_Frame.hxx

00001 
00002 // 
00003 // Copyright (C) 2006 James M. Lawrence.  All rights reserved.
00004 // 
00005 // software: esve-1.0.3
00006 // file: esve/engine/dim4/Make_Frame.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 #ifndef esve_engine_dim4_Make_Frame_hxx
00035 #define esve_engine_dim4_Make_Frame_hxx
00036 
00037 #include <esve/engine/dim4/impl/Frame.hxx>
00038 #include <esve/engine/dim4/impl/Transform.hxx>
00039 #include <esve/message/impl/Compute_Receiver.hxx>
00040 #include <esve/types/quat.hxx>
00041 
00042 namespace esve { namespace engine { namespace dim4 {
00043 
00104 
00105 template< typename T_Target, typename T_Frame = impl::Frame >
00106 class Make_Frame
00107     : virtual public message::impl::Compute_Receiver,
00108       public T_Frame,
00109       public T_Target
00110 {
00111 private:
00112 #if !defined(NDEBUG)
00113     template< class U > static void m_unused( const U & ) { }
00114 
00115     void m_requirements_1() const
00116     {
00117         bool r = T_Target::changed() ;
00118         m_unused(r) ;
00119     }
00120 
00121     void m_requirements_2()
00122     {
00123         T_Target::pretransform() ;
00124         T_Target::posttransform() ;
00125 
00126         m_requirements_2_1(T_Target::points_begin()) ;
00127         m_requirements_2_1(T_Target::points_end()) ;
00128         m_requirements_2_2(T_Target::transformed_points_begin()) ;
00129 
00130         engine::dim4::Frame* r = dynamic_cast<T_Frame*>(this) ;
00131         m_unused(r) ;
00132     }
00133 
00134     template< typename T_Points_iterator >
00135     void m_requirements_2_1( T_Points_iterator i )
00136     {
00137         types::quat q = *i ;
00138         ++i ;
00139     }
00140 
00141     template< typename T_Transformed_Points_iterator >
00142     void m_requirements_2_2( T_Transformed_Points_iterator i )
00143     {
00144         *i = types::quat() ;
00145         ++i ;
00146     }
00147 
00148     struct m_Requirements
00149     {
00150         m_Requirements()
00151         {
00152             typedef void (Make_Frame::*R1)() const ;
00153             typedef void (Make_Frame::*R2)() ;
00154             
00155             R1 r1 = &Make_Frame::m_requirements_1 ;
00156             R2 r2 = &Make_Frame::m_requirements_2 ;
00157             m_unused(r1) ;
00158             m_unused(r2) ;
00159         }
00160     } m_requirements ;
00161 #endif // !defined(NDEBUG)
00162 
00163     struct Private
00164     {
00165         bool initialized ;
00166         impl::Transform last_world_transform ;
00167 
00168         Private() ;
00169     } ;
00170 
00171     Make_Frame( const Make_Frame & ) ;
00172     Make_Frame & operator=( const Make_Frame & ) ;
00173 
00174     Private m ;
00175 
00176 public:
00178     Make_Frame() ;
00179 
00181     template< typename T_Arg >
00182     Make_Frame( T_Arg & ) ;
00183 
00185     template< typename T_Arg >
00186     Make_Frame( const T_Arg & ) ;
00187 
00188     ~Make_Frame() ;
00189 
00190 protected:
00191     typedef T_Target Make_Frame_Parameter_Target ;
00192     typedef T_Frame Make_Frame_Parameter_Frame ;
00193     
00194     void compute() ;
00195 
00197     virtual void pretransform() ;
00198 
00201     virtual void posttransform() ;
00202 
00205     virtual bool changed() const ;
00206 
00208     virtual void apply_transform() ;
00209 } ;
00210 
00211 }}} // namespace esve::engine::dim4
00212 
00213 #include <esve/engine/dim4/Make_Frame.template.cxx>
00214 
00215 #endif
00216 

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