Commit patch to not break on spaces.
[bowtie.git] / SeqAn-1.1 / seqan / basic / basic_transport.h
1  /*==========================================================================
2                 SeqAn - The Library for Sequence Analysis
3                           http://www.seqan.de 
4  ============================================================================
5   Copyright (C) 2007
6
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.
11
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.
16
17  ============================================================================
18   $Id: basic_transport.h,v 1.1 2008/08/25 16:20:01 langmead Exp $
19  ==========================================================================*/
20
21 #ifndef SEQAN_HEADER_BASIC_TRANSPORT_H
22 #define SEQAN_HEADER_BASIC_TRANSPORT_H
23
24 namespace SEQAN_NAMESPACE_MAIN
25 {
26
27 //////////////////////////////////////////////////////////////////////////////
28 //assign
29 //////////////////////////////////////////////////////////////////////////////
30
31 /**
32 .Function.assign:
33 ..summary:Assigns one object to another object.
34 ..cat:Content Manipulation
35 ..signature:assign(target, source)
36 ..signature:assign(target, source [, limit] [,resize_tag])
37 ..param.target: Gets the content of $source$.
38 ..param.source: Is copied to $target$.
39 ..param.limit: The maximal length of $target$ after the operation. (optional)
40 ...remarks:This arguments can be applied if $target$ is a container.
41 ..param.resize_tag: Specifies the strategy that is applied if $target$ has not enough capacity to store the complete content. (optional)
42 ...type:Tag.Overflow Strategy
43 ...default:Specified by @Metafunction.DefaultOverflowImplicit@ of the $target$ type.
44 ...remarks:This arguments can be applied if $target$ is a container.
45 ..remarks:$assign(target, source)$ is semantically equivalent to $target = source$. 
46 */
47
48 template <typename TTarget, typename TSource>
49 inline void
50 assign(TTarget & target,
51            TSource & source)
52 {
53 SEQAN_CHECKPOINT
54         target = source;
55 }
56 template <typename TTarget, typename TSource>
57 inline void
58 assign(TTarget & target,
59            TSource const & source)
60 {
61 SEQAN_CHECKPOINT
62         target = source;
63 }
64
65 //////////////////////////////////////////////////////////////////////////////
66
67 template <typename TSpec> struct Proxy;
68
69 template<typename TTargetSpec, typename TSource>
70 inline void 
71 assign(Proxy<TTargetSpec> & target,
72            TSource & source)
73 {
74 SEQAN_CHECKPOINT
75         assignValue(iter(target), source);
76 }
77
78 template<typename TTargetSpec, typename TSource>
79 inline void 
80 assign(Proxy<TTargetSpec> & target,
81            TSource const & source)
82 {
83 SEQAN_CHECKPOINT
84         assignValue(iter(target), source);
85 }
86
87 //////////////////////////////////////////////////////////////////////////////
88 // move
89 //////////////////////////////////////////////////////////////////////////////
90
91 /**
92 .Function.move:
93 ..summary:Hands over content from one container to another container.
94 ..cat:Content Manipulation
95 ..signature:move(target, source)
96 ..param.target:A container $source$ is moved to.
97 ..param.source:A container that is moved to $target$.
98 ..remarks:The function tries to hand over the contents of $source$ to $target$.
99 If this is possible, $source$ losts its content and will therefore be empty after this operation.
100 Otherwise, the function behaves like @Function.assign@ and $source$ is copied to $target$. 
101 ..see:Function.assign
102 */
103
104 template<typename TTarget, typename TSource>
105 inline void 
106 move(TTarget & target,
107          TSource & source)
108 {
109 SEQAN_CHECKPOINT
110         assign(target, source);
111 }
112 template<typename TTarget, typename TSource>
113 inline void 
114 move(TTarget const & target,
115          TSource & source)
116 {
117 SEQAN_CHECKPOINT
118         assign(target, source);
119 }
120 template<typename TTarget, typename TSource>
121 inline void 
122 move(TTarget & target,
123          TSource const & source)
124 {
125 SEQAN_CHECKPOINT
126         assign(target, source);
127 }
128 template<typename TTarget, typename TSource>
129 inline void 
130 move(TTarget const & target,
131          TSource const & source)
132 {
133 SEQAN_CHECKPOINT
134         assign(target, source);
135 }
136
137
138 //////////////////////////////////////////////////////////////////////////////
139 // set
140 //////////////////////////////////////////////////////////////////////////////
141
142 /**
143 .Function.set:
144 ..summary:Assigns one object to another object avoiding to copy contents.
145 ..cat:Content Manipulation
146 ..signature:assign(target, source)
147 ..signature:assign(target, source)
148 ..param.target: Gets the content of $source$.
149 ..param.source: Content source.
150 ..remarks:$set(target, source)$ is semantically equivalent to $target = source$.
151 If possible, $set$ copies content references instead of the content itself.
152 */
153
154 //TODO: rename set to ...
155
156 template<typename TTarget, typename TSource>
157 inline void 
158 set(TTarget & target,
159         TSource & source)
160 {
161 SEQAN_CHECKPOINT
162         assign(target, source);
163 }
164 template<typename TTarget, typename TSource>
165 inline void 
166 set(TTarget const & target,
167         TSource & source)
168 {
169 SEQAN_CHECKPOINT
170         assign(target, source);
171 }
172 template<typename TTarget, typename TSource>
173 inline void 
174 set(TTarget & target,
175         TSource const & source)
176 {
177 SEQAN_CHECKPOINT
178         assign(target, source);
179 }
180 template<typename TTarget, typename TSource>
181 inline void 
182 set(TTarget const & target,
183         TSource const & source)
184 {
185 SEQAN_CHECKPOINT
186         assign(target, source);
187 }
188
189
190 //////////////////////////////////////////////////////////////////////////////
191
192 } //namespace SEQAN_NAMESPACE_MAIN
193
194 #endif //#ifndef SEQAN_HEADER_...
195
196