Loading...
Searching...
No Matches
processor.h
Go to the documentation of this file.
// -*- Mode: C++; tab-width: 2; -*-
// vi: set ts=2:
//
#ifndef BALL_CONCEPT_PROCESSOR_H
#define BALL_CONCEPT_PROCESSOR_H
#ifndef BALL_COMMON_H
# include <BALL/common.h>
#endif
#ifndef BALL_CONCEPT_BASEFUNCTOR_H
# include <BALL/CONCEPT/baseFunctor.h>
#endif
#ifndef BALL_COMMON_GLOBAL_H
# include <BALL/COMMON/global.h>
#endif
namespace BALL
{
class BALL_EXPORT Processor
{
public:
typedef int Result;
enum
{
ABORT = 0,
BREAK = 1,
CONTINUE = 2
};
};
template <typename T>
class UnaryProcessor
: public UnaryFunctor<T, Processor::Result>
{
public:
BALL_CREATE(UnaryProcessor)
UnaryProcessor()
{
}
UnaryProcessor
(const UnaryProcessor& /* processor */)
{
}
virtual ~UnaryProcessor()
{
}
virtual bool start()
{
return true;
}
virtual bool finish()
{
return true;
}
virtual Processor::Result operator () (T &)
{
return Processor::CONTINUE;
}
};
template<typename T>
class ConstUnaryProcessor : public UnaryFunctor<T, Processor::Result>
{
public:
BALL_CREATE(ConstUnaryProcessor)
virtual ~ConstUnaryProcessor()
{
}
virtual bool start()
{
return true;
}
virtual bool finish()
{
return true;
}
virtual Processor::Result operator()(const T&)
{
return Processor::CONTINUE;
}
};
template <typename T1, typename T2>
class BinaryProcessor
: public BinaryFunctor<T1, T2, Processor::Result>
{
public:
BALL_CREATE(BinaryProcessor)
BinaryProcessor()
{
}
BinaryProcessor
(const BinaryProcessor& /* processor */)
{
}
virtual ~BinaryProcessor()
{
}
virtual bool start()
{
return true;
}
virtual bool finish()
{
return true;
}
virtual Processor::Result operator () (T1&, T2&)
{
return Processor::CONTINUE;
}
};
template <typename T1, typename T2>
class ConstBinaryProcessor
: public BinaryFunctor<T1, T2, Processor::Result>
{
public:
BALL_CREATE(ConstBinaryProcessor)
virtual ~ConstBinaryProcessor()
{
}
virtual bool start()
{
return true;
}
virtual bool finish()
{
return true;
}
virtual Processor::Result operator () (const T1&, const T2&)
{
return Processor::CONTINUE;
}
};
// required for MSVC 12/2013 (TODO remove)
#ifdef BALL_COMPILER_MSVC
class Atom;
template class BALL_EXPORT UnaryProcessor<Atom>;
template class BALL_EXPORT ConstUnaryProcessor<Atom>;
#endif
} // namespace BALL
#endif // BALL_CONCEPT_PROCESSOR_H
global.h
BALL_EXPORT
#define BALL_EXPORT
Definition COMMON/global.h:50
baseFunctor.h
BALL::BinaryFunctor
Definition baseFunctor.h:65
BALL::BinaryProcessor::~BinaryProcessor
virtual ~BinaryProcessor()
Definition processor.h:172
BALL::BinaryProcessor::finish
virtual bool finish()
Definition processor.h:190
BALL::BinaryProcessor::BinaryProcessor
BinaryProcessor()
Definition processor.h:159
BALL::BinaryProcessor::operator()
virtual Processor::Result operator()(T1 &, T2 &)
Definition processor.h:197
BALL::BinaryProcessor::BinaryProcessor
BinaryProcessor(const BinaryProcessor &)
Definition processor.h:166
BALL::BinaryProcessor::start
virtual bool start()
Definition processor.h:183
BALL::ConstBinaryProcessor
Definition processor.h:207
BALL::ConstBinaryProcessor::finish
virtual bool finish()
Definition processor.h:235
BALL::ConstBinaryProcessor::operator()
virtual Processor::Result operator()(const T1 &, const T2 &)
Definition processor.h:242
BALL::ConstBinaryProcessor::start
virtual bool start()
Definition processor.h:228
BALL::ConstUnaryProcessor
Definition processor.h:120
BALL::ConstUnaryProcessor::finish
virtual bool finish()
Definition processor.h:133
BALL::ConstUnaryProcessor::operator()
virtual Processor::Result operator()(const T &)
Definition processor.h:138
BALL::ConstUnaryProcessor::start
virtual bool start()
Definition processor.h:128
BALL::Processor
Definition processor.h:32
BALL::Processor::ABORT
@ ABORT
Definition processor.h:44
BALL::Processor::BREAK
@ BREAK
Definition processor.h:47
BALL::Processor::CONTINUE
@ CONTINUE
Definition processor.h:50
BALL::Processor::Result
int Result
Definition processor.h:36
BALL::UnaryFunctor
Definition baseFunctor.h:26
BALL::UnaryProcessor::UnaryProcessor
UnaryProcessor(const UnaryProcessor &)
Definition processor.h:76
BALL::UnaryProcessor::start
virtual bool start()
Definition processor.h:92
BALL::UnaryProcessor::~UnaryProcessor
virtual ~UnaryProcessor()
Definition processor.h:82
BALL::UnaryProcessor::finish
virtual bool finish()
Definition processor.h:99
BALL::UnaryProcessor::operator()
virtual Processor::Result operator()(T &)
Definition processor.h:106
BALL::UnaryProcessor::UnaryProcessor
UnaryProcessor()
Definition processor.h:69
common.h
BALL_CREATE
#define BALL_CREATE(name)
Definition create.h:62
BALL
Definition constants.h:13