/home/bes3soft/bes3soft/Boss/7.0.2/dist/7.0.2/Event/DecayChain/DecayChain-00-00-03-slc6tag/DecayChain/Function/DCUnaryAdapter.h

Go to the documentation of this file.
00001 #ifndef DCHAIN_DCUNARYADAPTER_H
00002 #define DCHAIN_DCUNARYADAPTER_H
00003 // -*- C++ -*-
00004 //
00005 // Package:     <DChain>
00006 // Module:      DCUnaryAdapter
00007 // 
00016 //
00017 // Author:      Chris D Jones
00018 // Created:     Thu Jan  5 13:30:20 EST 2006
00019 // $Id: DCUnaryAdapter.h,v 1.1.1.1 2009/03/03 06:06:56 maqm Exp $
00020 //
00021 // Revision history
00022 //
00023 // $Log: DCUnaryAdapter.h,v $
00024 // Revision 1.1.1.1  2009/03/03 06:06:56  maqm
00025 // first import of DecayChain
00026 //
00027 // Revision 1.1  2006/01/11 20:28:13  cdj
00028 // massive class renaming, addition of [] for selection and unit tests
00029 //
00030 
00031 // system include files
00032 #include <functional>
00033 
00034 // user include files
00035 
00036 // forward declarations
00037 namespace dchain {
00038 template<class TFunc>
00039 class DCUnaryAdapter : public std::unary_function<typename TFunc::argument_type,
00040                                                   typename TFunc::result_type >
00041 {
00042       // ---------- friend classes and functions ---------------
00043 
00044    public:
00045       // ---------- constants, enums and typedefs --------------
00046       typedef typename TFunc::argument_type argument_type;
00047       typedef typename TFunc::result_type result_type;
00048 
00049       // ---------- Constructors and destructor ----------------
00050       DCUnaryAdapter() : m_func(0) {}
00051       DCUnaryAdapter(TFunc& iFunc) : m_func(&iFunc) {}
00052       DCUnaryAdapter(TFunc* iFunc) : m_func(iFunc) {}
00053 
00054       //virtual ~DCUnaryAdapter();
00055 
00056       // ---------- member functions ---------------------------
00057 
00058       // ---------- const member functions ---------------------
00059       result_type operator()(argument_type iArg) const {
00060          return (*m_func)(iArg);
00061       }
00062 
00063       operator bool() {
00064          return 0 != m_func;
00065       }
00066 
00067    private:
00068       // ---------- Constructors and destructor ----------------
00069       //DCUnaryAdapter( const DCUnaryAdapter& ); // stop default
00070 
00071       // ---------- assignment operator(s) ---------------------
00072       //const DCUnaryAdapter& operator=( const DCUnaryAdapter& ); // stop default
00073 
00074       // ---------- private member functions -------------------
00075 
00076       // ---------- private const member functions -------------
00077 
00078       // ---------- data members -------------------------------
00079       TFunc* m_func;
00080 
00081       // ---------- static data members ------------------------
00082 
00083 };
00084 }
00085 // inline function definitions
00086 
00087 #endif /* DCHAIN_DCUNARYADAPTER_H */

Generated on Tue Nov 29 22:58:22 2016 for BOSS_7.0.2 by  doxygen 1.4.7