IntaRNA 3.4.1
RNA-RNA interaction prediction | C++ API
Loading...
Searching...
No Matches
OutputHandler.h
Go to the documentation of this file.
1
2#ifndef INTARNA_OUTPUTHANDLER_H_
3#define INTARNA_OUTPUTHANDLER_H_
4
5#include "IntaRNA/general.h"
9#include <string>
10
11namespace IntaRNA {
12
21
22public:
23
29
33 virtual ~OutputHandler();
34
35
47 virtual
48 void
49 add( const Interaction & interaction ) = 0;
50
55 virtual
56 size_t
57 reported() const;
58
59
65 static
66 std::string
67 reverse( const std::string & str );
68
78 virtual
79 void
80 incrementZ( const Z_type subZ );
81
88 virtual
89 Z_type
90 getZ() const;
91
96 const OutputConstraint &
97 getOutputConstraint() const;
98
99
100protected:
101
104
107
110
111};
112
113
117
118inline
120 : outConstraint(outConstraint)
121 , reportedInteractions(0)
122 , Z(0)
123{
124}
125
127
128inline
131
133
134inline
135std::string
137reverse( const std::string & str )
138{
139 return std::string(str.rbegin(), str.rend());
140}
141
143
144inline
145size_t
147reported() const
148{
150}
151
153
154inline
155Z_type
157getZ() const
158{
159 return Z;
160}
161
163
164inline
165const OutputConstraint &
168{
169 return outConstraint;
170}
171
173
174inline
175void
177incrementZ( const Z_type subZ )
178{
179#if INTARNA_IN_DEBUG_MODE
180 if (std::numeric_limits<Z_type>::max() - subZ <= Z) {
181 LOG(WARNING) <<"OutputHandler::incrementZ() : partition function overflow! Recompile with larger partition function data type!";
182 }
183#endif
184 // increment partition function
185#if INTARNA_MULITHREADING
186 #pragma omp critical(intarna_omp_outputHandlerIncrementZ)
187#endif
188 {Z += subZ;}
189}
190
192
193} // namespace
194
195#endif /* OUTPUTHANDLER_H_ */
Definition Interaction.h:28
Definition OutputConstraint.h:19
Definition OutputHandler.h:20
static std::string reverse(const std::string &str)
Definition OutputHandler.h:137
OutputHandler(const OutputConstraint &outConstraint)
Definition OutputHandler.h:119
const OutputConstraint outConstraint
the output constraints to be applied
Definition OutputHandler.h:103
const OutputConstraint & getOutputConstraint() const
Definition OutputHandler.h:167
virtual void incrementZ(const Z_type subZ)
Definition OutputHandler.h:177
virtual Z_type getZ() const
Definition OutputHandler.h:157
virtual ~OutputHandler()
Definition OutputHandler.h:129
Z_type Z
overall partition function for the sequences provided in Z_energy
Definition OutputHandler.h:109
virtual void add(const Interaction &interaction)=0
size_t reportedInteractions
number of reported interactions
Definition OutputHandler.h:106
virtual size_t reported() const
Definition OutputHandler.h:147
Definition Accessibility.h:13
double Z_type
type for probabilities, RT and Boltzmann values
Definition general.h:88