Imported Upstream version 0.12.7
[bowtie.git] / SeqAn-1.1 / seqan / basic / basic_host.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_host.h,v 1.1 2008/08/25 16:20:01 langmead Exp $
19  ==========================================================================*/
20
21 #ifndef SEQAN_HEADER_BASIC_HOST_H
22 #define SEQAN_HEADER_BASIC_HOST_H
23
24 namespace SEQAN_NAMESPACE_MAIN
25 {
26 //////////////////////////////////////////////////////////////////////////////
27
28 //////////////////////////////////////////////////////////////////////////////
29 // Host Functions
30 //////////////////////////////////////////////////////////////////////////////
31 //these functions assume that the hosted object exports a function "_dataHost"
32 //that returns a reference to a holder type of Host<T>::Type & 
33
34 //////////////////////////////////////////////////////////////////////////////
35
36 template <typename T>
37 inline bool
38 emptyHost(T const & me)
39 {
40 SEQAN_CHECKPOINT
41         return empty(_dataHost(me));
42 }
43
44 //////////////////////////////////////////////////////////////////////////////
45
46 template <typename T>
47 inline bool
48 dependentHost(T const & me)
49 {
50 SEQAN_CHECKPOINT
51         return dependent(_dataHost(me));
52 }
53
54 //////////////////////////////////////////////////////////////////////////////
55
56 template <typename T>
57 inline void
58 clearHost(T & me)
59 {
60 SEQAN_CHECKPOINT
61         clear(_dataHost(me));
62 }
63
64 //////////////////////////////////////////////////////////////////////////////
65
66 template <typename T>
67 inline void
68 createHost(T & me)
69 {
70 SEQAN_CHECKPOINT
71         create(_dataHost(me));
72 }
73
74 //____________________________________________________________________________
75
76 template <typename T, typename THost>
77 inline void
78 createHost(T & me,
79                    THost & host_)
80 {
81 SEQAN_CHECKPOINT
82         create(_dataHost(me), host_);
83 }
84 template <typename T, typename THost>
85 inline void
86 createHost(T & me,
87                    THost const & host_)
88 {
89 SEQAN_CHECKPOINT
90         create(_dataHost(me), host_);
91 }
92
93 //////////////////////////////////////////////////////////////////////////////
94
95 template <typename T, typename THost>
96 inline void
97 setHost(T & me,
98                 THost & host_)
99 {
100 SEQAN_CHECKPOINT
101         setValue(_dataHost(me), host_);
102 }
103 template <typename T, typename THost>
104 inline void
105 setHost(T & me,
106                 THost const & host_)
107 {
108 SEQAN_CHECKPOINT
109         setValue(_dataHost(me), host_);
110 }
111
112 //////////////////////////////////////////////////////////////////////////////
113
114 template <typename T>
115 inline typename Host<T>::Type &
116 host(T & me)
117 {
118 SEQAN_CHECKPOINT
119         return value(_dataHost(me));
120 }
121 template <typename T>
122 inline typename Host<T const>::Type &
123 host(T const & me)
124 {
125 SEQAN_CHECKPOINT
126         return value(_dataHost(me));
127 }
128
129 //////////////////////////////////////////////////////////////////////////////
130
131 template <typename T, typename THost>
132 inline void
133 assignHost(T & me,
134                    THost & host_)
135 {
136 SEQAN_CHECKPOINT
137         assignValue(_dataHost(me), host_);
138 }
139 template <typename T, typename THost>
140 inline void
141 assignHost(T & me,
142                    THost const & host_)
143 {
144 SEQAN_CHECKPOINT
145         assignValue(_dataHost(me), host_);
146 }
147 //////////////////////////////////////////////////////////////////////////////
148
149 template <typename T, typename THost>
150 inline void
151 moveHost(T & me,
152                  THost & host_)
153 {
154 SEQAN_CHECKPOINT
155         moveValue(_dataHost(me), host_);
156 }
157 template <typename T, typename THost>
158 inline void
159 moveHost(T & me,
160                  THost const & host_)
161 {
162 SEQAN_CHECKPOINT
163         moveValue(_dataHost(me), host_);
164 }
165
166 //////////////////////////////////////////////////////////////////////////////
167 } //namespace SEQAN_NAMESPACE_MAIN
168
169 #endif //#ifndef SEQAN_HEADER_...
170
171