1 /*==========================================================================
2 SeqAn - The Library for Sequence Analysis
4 ============================================================================
7 This library is free software; you can redistribute it and/or
8 modify it under the terms of the GNU Lesser General Public
9 License as published by the Free Software Foundation; either
10 version 3 of the License, or (at your option) any later version.
12 This library is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 Lesser General Public License for more details.
17 ============================================================================
18 $Id: basic_converter.h,v 1.1 2008/08/25 16:20:01 langmead Exp $
19 ==========================================================================*/
21 #ifndef SEQAN_HEADER_BASIC_CONVERTER_H
22 #define SEQAN_HEADER_BASIC_CONVERTER_H
24 namespace SEQAN_NAMESPACE_MAIN
27 //////////////////////////////////////////////////////////////////////////////
29 //////////////////////////////////////////////////////////////////////////////
31 //gibt den Typ an, in den TSource konvertiert werden kann (TTarget oder TTarget &)
34 .Metafunction.Convert:
35 ..summary:Return type of a conversion.
36 ..signature:Convert<Target, Source>::Type
37 ..param.Target:Type the object should be converted to.
38 ..param.Source:Type of the object that should be converted to $Target$.
39 ..returns.param.Type:Type that is returned by @Function.convert@.
40 ...remarks:This is either $Target$ or $Target &$:
41 If instances of $Source: /fs/szdevel/src/cvsroot/bowtie/SeqAn-1.1/seqan/basic/basic_converter.h,v $ can be re-interpreted as instances of $Target$,
42 than this metafunction returns a reference, otherwise it returns $Target$,
43 that is @Function.convert@ returns a temporary.
44 ..remarks:A constant instance of $Convert$ is (ab)used as tag argument of @Function.convertImpl@.
46 template <typename TTarget, typename TSource = void>
53 //////////////////////////////////////////////////////////////////////////////
55 //////////////////////////////////////////////////////////////////////////////
57 .Function.convertImpl:
60 ..summary:Implements @Function.convert@.
61 ..signature:Convert convertImpl(convert, source)
62 ..param.convert:Object that specifies the conversion.
63 ...type:Metafunction.Convert
64 ...remarks:A constant instance of @Metafunction.Convert@ is used to specify the conversion target.
65 ..param.source:An object that should be converted.
66 ..returns:$source$ converted to the type specified by convert.
67 ...metafunction:Metafunction.Convert
68 ..remarks:This function implements @Function.convert@.
69 It is recommended to use @Function.convert@ rather than $convertImpl$.
71 //??? Spezialisiere convertImpl, verwende convert
72 //??? Konversion eines einzelnen Zeichens in ein einzelnes Zeichen. Konversion von Sequenzen in Sequenzen finden wo anders statt.
73 //??? Kann entweder kopieren oder re-interpretieren, je nach Convert::Type
74 template <typename TTarget, typename T, typename TSource>
75 inline typename Convert<TTarget, TSource>::Type
76 convertImpl(Convert<TTarget, T> const,
81 template <typename TTarget, typename T, typename TSource>
82 inline typename Convert<TTarget, TSource const>::Type
83 convertImpl(Convert<TTarget, T> const,
84 TSource const & source)
89 //////////////////////////////////////////////////////////////////////////////
91 //////////////////////////////////////////////////////////////////////////////
95 ..summary:Converts a value into another value.
96 ..signature:Convert convert<Target>(source)
97 ..param.Target:The type $source$ is converted to.
98 ..param.source:An object that is converted to $Target$.
99 ..returns:$source$ converted to $Target$.
100 ...remarks:If $source$ can be re-interpreted as instance of $Target$, then a reference is returned.
101 Otherwise the function returns a temporary object.
102 ...metafunction:Metafunction.Convert
103 ..remarks:This function is implemented in @Function.convertImpl@.
104 Do not specialize $convert$, specialize @Function.convertImpl@ instead.
105 ..see:Function.convertImpl
107 template <typename TTarget, typename TSource>
108 inline typename Convert<TTarget, TSource>::Type
109 convert(TSource const & source)
111 return convertImpl(Convert<TTarget, TSource>(), source);
114 //////////////////////////////////////////////////////////////////////////////
115 }// namespace SEQAN_NAMESPACE_MAIN
117 #endif //#ifndef SEQAN_HEADER_...