BOSS 6.6.4.p03
BESIII Offline Software System
Loading...
Searching...
No Matches
DCUnaryAdapter.h
Go to the documentation of this file.
1#ifndef DCHAIN_DCUNARYADAPTER_H
2#define DCHAIN_DCUNARYADAPTER_H
3// -*- C++ -*-
4//
5// Package: <DChain>
6// Module: DCUnaryAdapter
7//
8/**\class DCUnaryAdapter DCUnaryAdapter.h DChain/DCUnaryAdapter.h
9
10 Description: <one line class summary>
11
12 Usage:
13 <usage>
14
15*/
16//
17// Author: Chris D Jones
18// Created: Thu Jan 5 13:30:20 EST 2006
19// $Id: DCUnaryAdapter.h,v 1.1.1.1 2009/03/03 06:06:56 maqm Exp $
20//
21// Revision history
22//
23// $Log: DCUnaryAdapter.h,v $
24// Revision 1.1.1.1 2009/03/03 06:06:56 maqm
25// first import of DecayChain
26//
27// Revision 1.1 2006/01/11 20:28:13 cdj
28// massive class renaming, addition of [] for selection and unit tests
29//
30
31// system include files
32#include <functional>
33
34// user include files
35
36// forward declarations
37namespace dchain {
38template<class TFunc>
39class DCUnaryAdapter : public std::unary_function<typename TFunc::argument_type,
40 typename TFunc::result_type >
41{
42 // ---------- friend classes and functions ---------------
43
44 public:
45 // ---------- constants, enums and typedefs --------------
46 typedef typename TFunc::argument_type argument_type;
47 typedef typename TFunc::result_type result_type;
48
49 // ---------- Constructors and destructor ----------------
50 DCUnaryAdapter() : m_func(0) {}
51 DCUnaryAdapter(TFunc& iFunc) : m_func(&iFunc) {}
52 DCUnaryAdapter(TFunc* iFunc) : m_func(iFunc) {}
53
54 //virtual ~DCUnaryAdapter();
55
56 // ---------- member functions ---------------------------
57
58 // ---------- const member functions ---------------------
60 return (*m_func)(iArg);
61 }
62
63 operator bool() {
64 return 0 != m_func;
65 }
66
67 private:
68 // ---------- Constructors and destructor ----------------
69 //DCUnaryAdapter( const DCUnaryAdapter& ); // stop default
70
71 // ---------- assignment operator(s) ---------------------
72 //const DCUnaryAdapter& operator=( const DCUnaryAdapter& ); // stop default
73
74 // ---------- private member functions -------------------
75
76 // ---------- private const member functions -------------
77
78 // ---------- data members -------------------------------
79 TFunc* m_func;
80
81 // ---------- static data members ------------------------
82
83};
84}
85// inline function definitions
86
87#endif /* DCHAIN_DCUNARYADAPTER_H */
DCUnaryAdapter(TFunc &iFunc)
DCUnaryAdapter(TFunc *iFunc)
TFunc::argument_type argument_type
result_type operator()(argument_type iArg) const
TFunc::result_type result_type