BOSS 7.1.0
BESIII Offline Software System
Loading...
Searching...
No Matches
SelectiveInserter.h
Go to the documentation of this file.
1#ifndef DCHAIN_SELECTIVEINSERTER_H
2#define DCHAIN_SELECTIVEINSERTER_H
3// -*- C++ -*-
4//
5// Package: <DChain>
6// Module: SelectiveInserter
7//
8/**\class SelectiveInserter SelectiveInserter.h DChain/SelectiveInserter.h
9
10 Description: Inserts objects into a list only if those object pass the selection
11
12 Usage:
13 <usage>
14
15*/
16//
17// Author: Chris D Jones
18// Created: Thu Jan 5 15:40:59 EST 2006
19// $Id: SelectiveInserter.h,v 1.1.1.1 2009/03/03 06:06:56 maqm Exp $
20//
21// Revision history
22//
23// $Log: SelectiveInserter.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:18 cdj
28// massive class renaming, addition of [] for selection and unit tests
29//
30
31// system include files
32#include <iterator>
33
34// user include files
35
36// forward declarations
37namespace dchain {
38 template<class TList, class TSelect>
40 typedef std::output_iterator_tag iterator_category;
41 typedef void value_type;
42 typedef void difference_type;
43
44 SelectiveInserter(TList& iList,
45 const TSelect& iSelect):
46 m_list(&iList),
47 m_select(iSelect) {}
49 return *this; }
50
52 return *this;
53 }
54
56 return *this;
57 }
58
59 ///returns false if object not added to list
60 template<class THolder>
61 bool operator=(THolder iHolder){
62 return m_list->attempt_insert(iHolder, m_select);
63 }
64 private:
65 TList* m_list;
66 TSelect m_select;
67 };
68}
69#endif /* DCHAIN_SELECTIVEINSERTER_H */
SelectiveInserter< TList, TSelect > & operator*()
bool operator=(THolder iHolder)
returns false if object not added to list
SelectiveInserter< TList, TSelect > & operator+(int)
std::output_iterator_tag iterator_category
SelectiveInserter< TList, TSelect > & operator++()
SelectiveInserter(TList &iList, const TSelect &iSelect)