BOSS 8.0.0
BESIII Offline Software System
Loading...
Searching...
No Matches
Event/DecayChain/include/DecayChain/Function/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 {
38 template <class TFunc>
39 class DCUnaryAdapter : public std::unary_function<typename TFunc::argument_type,
40 typename TFunc::result_type> {
41 // ---------- friend classes and functions ---------------
42
43 public:
44 // ---------- constants, enums and typedefs --------------
45 typedef typename TFunc::argument_type argument_type;
46 typedef typename TFunc::result_type result_type;
47
48 // ---------- Constructors and destructor ----------------
49 DCUnaryAdapter() : m_func( 0 ) {}
50 DCUnaryAdapter( TFunc& iFunc ) : m_func( &iFunc ) {}
51 DCUnaryAdapter( TFunc* iFunc ) : m_func( iFunc ) {}
52
53 // virtual ~DCUnaryAdapter();
54
55 // ---------- member functions ---------------------------
56
57 // ---------- const member functions ---------------------
58 result_type operator()( argument_type iArg ) const { return ( *m_func )( iArg ); }
59
60 operator bool() { return 0 != m_func; }
61
62 private:
63 // ---------- Constructors and destructor ----------------
64 // DCUnaryAdapter( const DCUnaryAdapter& ); // stop default
65
66 // ---------- assignment operator(s) ---------------------
67 // const DCUnaryAdapter& operator=( const DCUnaryAdapter& ); // stop default
68
69 // ---------- private member functions -------------------
70
71 // ---------- private const member functions -------------
72
73 // ---------- data members -------------------------------
74 TFunc* m_func;
75
76 // ---------- static data members ------------------------
77 };
78} // namespace dchain
79// inline function definitions
80
81#endif /* DCHAIN_DCUNARYADAPTER_H */