BOSS 8.0.0
BESIII Offline Software System
Loading...
Searching...
No Matches
Event/DecayChain/include/DecayChain/Iterator/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> struct SelectiveInserter {
39 typedef std::output_iterator_tag iterator_category;
40 typedef void value_type;
41 typedef void difference_type;
42
43 SelectiveInserter( TList& iList, const TSelect& iSelect )
44 : m_list( &iList ), m_select( iSelect ) {}
46
48
50
51 /// returns false if object not added to list
52 template <class THolder> bool operator=( THolder iHolder ) {
53 return m_list->attempt_insert( iHolder, m_select );
54 }
55
56 private:
57 TList* m_list;
58 TSelect m_select;
59 };
60} // namespace dchain
61#endif /* DCHAIN_SELECTIVEINSERTER_H */
bool operator=(THolder iHolder)
returns false if object not added to list