BALL  1.5.0
processor.h
Go to the documentation of this file.
1 // -*- Mode: C++; tab-width: 2; -*-
2 // vi: set ts=2:
3 //
4 
5 #ifndef BALL_CONCEPT_PROCESSOR_H
6 #define BALL_CONCEPT_PROCESSOR_H
7 
8 #ifndef BALL_COMMON_H
9 # include <BALL/common.h>
10 #endif
11 
12 #ifndef BALL_CONCEPT_BASEFUNCTOR_H
14 #endif
15 
16 #ifndef BALL_COMMON_GLOBAL_H
17 # include <BALL/COMMON/global.h>
18 #endif
19 
20 namespace BALL
21 {
22 
28 
32  {
33  public:
36  typedef int Result;
37 
40  enum
41  {
44  ABORT = 0,
47  BREAK = 1,
50  CONTINUE = 2
51  };
52  };
53 
54 
57  template <typename T>
59  : public UnaryFunctor<T, Processor::Result>
60  {
61  public:
62 
70  {
71  }
72 
76  (const UnaryProcessor& /* processor */)
77  {
78  }
79 
82  virtual ~UnaryProcessor()
83  {
84  }
86 
92  virtual bool start()
93  {
94  return true;
95  }
96 
99  virtual bool finish()
100  {
101  return true;
102  }
103 
107  {
108  return Processor::CONTINUE;
109  }
111  };
112 
118  template<typename T>
119  class ConstUnaryProcessor : public UnaryFunctor<T, Processor::Result>
120  {
121  public:
123 
125  {
126  }
127 
128  virtual bool start()
129  {
130  return true;
131  }
132 
133  virtual bool finish()
134  {
135  return true;
136  }
137 
138  virtual Processor::Result operator()(const T&)
139  {
140  return Processor::CONTINUE;
141  }
142  };
143 
146  template <typename T1, typename T2>
148  : public BinaryFunctor<T1, T2, Processor::Result>
149  {
150  public:
151 
156 
157 
160  {
161  }
162 
166  (const BinaryProcessor& /* processor */)
167  {
168  }
169 
173  {
174  }
176 
180 
183  virtual bool start()
184  {
185  return true;
186  }
187 
190  virtual bool finish()
191  {
192  return true;
193  }
194 
197  virtual Processor::Result operator () (T1&, T2&)
198  {
199  return Processor::CONTINUE;
200  }
202  };
203 
204  template <typename T1, typename T2>
206  : public BinaryFunctor<T1, T2, Processor::Result>
207  {
208  public:
209 
214 
215 
218  {
219  }
221 
225 
228  virtual bool start()
229  {
230  return true;
231  }
232 
235  virtual bool finish()
236  {
237  return true;
238  }
239 
242  virtual Processor::Result operator () (const T1&, const T2&)
243  {
244  return Processor::CONTINUE;
245  }
247  };
248 
250 // required for MSVC 12/2013 (TODO remove)
251 #ifdef BALL_COMPILER_MSVC
252 class Atom;
253 template class BALL_EXPORT UnaryProcessor<Atom>;
254 template class BALL_EXPORT ConstUnaryProcessor<Atom>;
255 #endif
256 
257 } // namespace BALL
258 
259 #endif // BALL_CONCEPT_PROCESSOR_H
BALL_EXPORT
#define BALL_EXPORT
Definition: COMMON/global.h:50
BALL::ConstUnaryProcessor
Definition: processor.h:119
BALL::BinaryProcessor::~BinaryProcessor
virtual ~BinaryProcessor()
Definition: processor.h:172
BALL::Processor
Definition: processor.h:31
BALL::BinaryProcessor::start
virtual bool start()
Definition: processor.h:183
BALL::ConstUnaryProcessor::operator()
virtual Processor::Result operator()(const T &)
Definition: processor.h:138
BALL
Definition: constants.h:12
BALL::BinaryProcessor::finish
virtual bool finish()
Definition: processor.h:190
BALL::ConstUnaryProcessor::start
virtual bool start()
Definition: processor.h:128
BALL::UnaryProcessor::finish
virtual bool finish()
Definition: processor.h:99
BALL::PDB::Atom
char Atom[5]
Definition: PDBdefs.h:257
BALL::ConstBinaryProcessor::operator()
virtual Processor::Result operator()(const T1 &, const T2 &)
Definition: processor.h:242
BALL::ConstBinaryProcessor::finish
virtual bool finish()
Definition: processor.h:235
baseFunctor.h
BALL::BinaryProcessor::operator()
virtual Processor::Result operator()(T1 &, T2 &)
Definition: processor.h:197
BALL::UnaryProcessor::operator()
virtual Processor::Result operator()(T &)
Definition: processor.h:106
BALL::UnaryFunctor
Definition: baseFunctor.h:25
BALL::Processor::CONTINUE
Definition: processor.h:50
BALL::UnaryProcessor::~UnaryProcessor
virtual ~UnaryProcessor()
Definition: processor.h:82
BALL::ConstBinaryProcessor
Definition: processor.h:205
BALL::UnaryProcessor
Definition: processor.h:58
common.h
BALL::UnaryProcessor::UnaryProcessor
UnaryProcessor()
Definition: processor.h:69
BALL::UnaryProcessor::start
virtual bool start()
Definition: processor.h:92
global.h
BALL::Processor::Result
int Result
Definition: processor.h:36
BALL_CREATE
#define BALL_CREATE(name)
Definition: create.h:62
BALL::ConstBinaryProcessor::start
virtual bool start()
Definition: processor.h:228
BALL::BinaryFunctor
Definition: baseFunctor.h:64
BALL::ConstUnaryProcessor::finish
virtual bool finish()
Definition: processor.h:133
BALL::BinaryProcessor::BinaryProcessor
BinaryProcessor()
Definition: processor.h:159
BALL::BinaryProcessor
Definition: processor.h:147