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

xst_deposit_adaptor.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 
00034 // xst_deposit_adaptor.h
00035 
00036 #ifndef _XST_DEPOSIT_ADAPTOR_H_INCLUDED_
00037 #define _XST_DEPOSIT_ADAPTOR_H_INCLUDED_
00038 
00039 #if ( !defined( CTTL_TRACE_DEPOSITS ) )
00040 #   if ( !defined( CTTL_TRACE_DEPOSITS_OFF ) )
00041 #       if ( defined( CTTL_TRACE_RULES ) || defined( CTTL_TRACE_EVERYTHING ) )
00042 #           define CTTL_TRACE_DEPOSITS
00043 #       endif
00044 #   endif
00045 #endif
00046 
00047 #if ( defined( CTTL_TRACE_DEPOSITS ) )
00048 
00049 #   if ( defined( CTTL_TRACE_DEPOSIT_LINE_ON ) )
00050 #       define CTTL_TRACE_DEPOSIT_LINE( xtext ) CTTL_TRACE_DEPOSIT_TEXT( xtext CTTL_QUOTED_EXPRESSION( __LINE__ ) " " )
00051 #   else
00052 #       define CTTL_TRACE_DEPOSIT_LINE( xtext )
00053 #   endif // CTTL_TRACE_DEPOSIT_LINE_ON
00054 
00055 #       define CTTL_TRACE_DEPOSIT_TEXT( xtext )             std::cout << ( xtext )
00056 #       define CTTL_TRACE_DEPOSIT_JUSTIFY()                 xtl_trace_grammar::trace_justify()
00057 #       define CTTL_TRACE_DEPOSIT_MONOSPACE_TEXT( xtext )   xtl_trace_grammar::output_monospace_text( xtext )
00058 #       define CTTL_TRACE_DEPOSIT_DELAYED_CHAR( xchar )     xst_trace_delayed_char< xchar > CTTL_TRACE_VARIABLE( xst_delayed_char_ ); if ( sizeof( CTTL_TRACE_VARIABLE( xst_delayed_char_ ) ) ){}
00059 
00060 #   else
00061 
00062 #       define CTTL_TRACE_DEPOSIT_TEXT( xtext )
00063 
00064 #       define CTTL_TRACE_DEPOSIT_JUSTIFY()
00065 
00066 #       define CTTL_TRACE_DEPOSIT_MONOSPACE_TEXT( xtext )
00067 
00068 #       define CTTL_TRACE_DEPOSIT_DELAYED_CHAR( xchar )
00069 
00070 #       define CTTL_TRACE_DEPOSIT_LINE( xtext )
00071 
00072 #endif // CTTL_TRACE_DEPOSITS
00073 
00079 namespace cttl_impl {
00080 
00089 template< char CharT >
00090 struct xst_trace_delayed_char {
00091     ~xst_trace_delayed_char()
00092     {
00093         CTTL_TRACE_DEPOSIT_TEXT( CharT );
00094     }
00095 }; // struct xst_trace_delayed_char
00096 
00111 template< typename TargetLambdaT, typename ProgramLambdaT >
00112 class xst_deposit_adaptor {
00113 
00114 private:
00116     ProgramLambdaT m_program;
00117 
00119     TargetLambdaT& m_lambda;
00120 
00121 public:
00122 
00124     xst_deposit_adaptor( TargetLambdaT& lambda_, ProgramLambdaT program_ )
00125     :
00126     m_program( program_ ),
00127     m_lambda( lambda_ )
00128     {
00129     }
00130 
00132     void operator=( xst_deposit_adaptor< TargetLambdaT, ProgramLambdaT > const& ) const
00133     {
00134     }
00135 
00155     template< typename UniverseT >
00156     size_t match( UniverseT& edge_ )
00157     {
00158         CTTL_TRACE_LEVEL_MATCH( 'd' );
00159         m_lambda.update( m_program );
00160         return edge_.first.offset();
00161     }
00162         
00163 };  // xst_deposit_adaptor
00164 
00165 
00166 }   // namespace cttl_impl
00167 
00168 
00169 #endif //_XST_DEPOSIT_ADAPTOR_H_INCLUDED_

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