Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

xst_static_action.h

Go to the documentation of this file.
00001 
00002 // Common Text Transformation Library
00003 // Copyright (C) 1997-2006 by Igor Kholodov. 
00004 //
00005 // This library is free software; you can redistribute it and/or
00006 // modify it under the terms of the GNU Lesser General Public
00007 // License as published by the Free Software Foundation; either
00008 // version 2.1 of the License, or (at your option) any later version.
00009 //
00010 // This library is distributed in the hope that it will be useful,
00011 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00012 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00013 // Lesser General Public License for more details.
00014 //
00015 // You should have received a copy of the GNU Lesser General Public
00016 // License along with this library; if not, write to the
00017 // Free Software Foundation, Inc.,
00018 // 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
00019 //
00020 // mailto:cttl@users.sourceforge.net
00021 // http://sourceforge.net/projects/cttl/
00023 
00033 // xst_static_action.h
00034 
00035 #ifndef _XST_STATIC_ACTION_H_INCLUDED_
00036 #define _XST_STATIC_ACTION_H_INCLUDED_
00037 
00038 namespace cttl_impl {
00039 
00057 template< typename StaticActionT, typename ArgumentT, typename ResultT >
00058 class xst_static_action
00059 
00060 #ifdef CTTL_TRACE_DEPOSITS
00061     : public xst_traced_action_base
00062 #endif // CTTL_TRACE_DEPOSITS
00063 
00064 {
00066     StaticActionT m_static_action;
00067 
00069     xst_storage_adaptor< ArgumentT > m_argument;
00070 
00071 public:
00073     typedef xst_static_action< StaticActionT, ArgumentT, ResultT > action_T;
00074 
00076     typedef typename StaticActionT::result_type result_T;
00077 
00079     typedef typename xst_dereference_traits< action_T, result_T >::value_type value_type;
00080 
00082     xst_static_action(
00083 #ifdef CTTL_TRACE_DEPOSITS
00084         int line_,
00085         char const* action_name_,
00086 #endif // CTTL_TRACE_DEPOSITS
00087         StaticActionT static_action_,
00088         ArgumentT argument_
00089         )
00090         :
00091 #ifdef CTTL_TRACE_DEPOSITS
00092         xst_traced_action_base( line_, action_name_ ),
00093 #endif // CTTL_TRACE_DEPOSITS
00094         m_static_action( static_action_ ),
00095         m_argument( argument_ )
00096     {
00097     }
00098 
00100     result_T operator() ( bool ) const
00101     {
00102         return operator*();
00103     }
00104 
00106     result_T operator* () const
00107     {
00108 #ifdef CTTL_TRACE_DEPOSITS
00109         trace_prolog( m_argument.value() );
00110         result_T result = m_static_action( m_argument.value() );
00111         trace_epilog( result );
00112         return result;
00113 #else
00114         return m_static_action( m_argument.value() );
00115 #endif // CTTL_TRACE_DEPOSITS
00116     }
00117 
00118 };  // xst_static_action
00119 
00120 }   // namespace cttl_impl
00121 
00122 
00123 #endif //_XST_STATIC_ACTION_H_INCLUDED_

Generated on Thu Nov 2 17:48:24 2006 for CTTL Lambda Expression by  doxygen 1.3.9.1