ATLAS Offline Software
Loading...
Searching...
No Matches
TPCnvList.h
Go to the documentation of this file.
1// This file's extension implies that it's C, but it's really -*- C++ -*-.
2
3/*
4 Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
5*/
6
7// $Id$
14
15
16#ifndef ATHENAPOOLCNVSVC_TPCNVLIST_H
17#define ATHENAPOOLCNVSVC_TPCNVLIST_H
18
19
21#include "boost/mpl/vector.hpp"
22#include "boost/mpl/transform.hpp"
23#include <boost/fusion/mpl.hpp>
24#include "boost/fusion/container/vector.hpp"
25#include "boost/fusion/container/vector/convert.hpp"
26#include "boost/fusion/algorithm/iteration/accumulate.hpp"
27
28
29namespace AthenaPoolCnvSvc {
30
31
35template <class CNV, class TRANS, class ... TPCNVS>
37{
39 template <class TPCNV>
41 {
43 };
44
45
49 {
50 do_create_transient (CNV& parent, const std::string& key, MsgStream& msg);
51
52 // FIXME: It would be better to pass a unique_ptr through here.
53 // But that requires the resolution of DR2055, which g++ only implements
54 // with c++20.
55 template <class ELT>
56 typename ELT::Trans_t* operator() (typename ELT::Trans_t* p, ELT& elt);
57
59 const std::string& m_key;
60 MsgStream& m_msg;
61 };
62
63
67 {
68 do_pers_to_trans (CNV& parent, TRANS* trans, const std::string& key, MsgStream& msg);
69
70 template <class ELT>
71 bool operator() (bool found, ELT& elt);
72
74 TRANS* m_trans;
75 const std::string& m_key;
76 MsgStream& m_msg;
77 };
78
79
80public:
81 // Coverity fails to compile this correctly.
82#ifndef __COVERITY__
83 // Convert the list of TP converters <T1, T2, ...> to a boost fusion vector
84 // of converters wrapped by TPCnvElt:
85 // boost::fusion::vector<TPCnvElt<T1>, TPCnvElt<T2>, ...>
86 // We can create in instance of this vector to get an object that holds
87 // all the TP converter instances.
88 typedef boost::mpl::vector<TPCNVS...> vec_t;
89 typedef typename boost::mpl::transform<vec_t, wrap_tpcnv<boost::mpl::_1> >::type list_mpl_t;
90 typedef typename boost::fusion::result_of::as_vector<list_mpl_t>::type list_t;
91#endif
92
93
105 std::unique_ptr<TRANS>
106 createTransient (CNV& parent, const std::string& key, MsgStream& msg);
107
108
121 bool persToTrans (CNV& parent, TRANS* trans, const std::string& key, MsgStream& msg);
122
123
124private:
125#ifndef __COVERITY__
128#endif
129};
130
131
132} // namespace AthenaPoolCnvSvc
133
134
136
137
138#endif // not ATHENAPOOLCNVSVC_TPCNVLIST_H
139
140
Helper for calling a TP converter from an Athena converter.
Helper for calling a TP converter from an Athena converter.
Definition TPCnvElt.h:61
Helper for calling TP converters from an Athena converter.
Definition TPCnvList.h:37
boost::mpl::vector< TPCNVS... > vec_t
Definition TPCnvList.h:88
boost::mpl::transform< vec_t, wrap_tpcnv< boost::mpl::_1 > >::type list_mpl_t
Definition TPCnvList.h:89
std::unique_ptr< TRANS > createTransient(CNV &parent, const std::string &key, MsgStream &msg)
Read the persistent object and convert it to transient.
list_t m_list
List of TP converter instances, wrapped by TPCnvElt.
Definition TPCnvList.h:127
bool persToTrans(CNV &parent, TRANS *trans, const std::string &key, MsgStream &msg)
Read the persistent object and convert it to transient.
boost::fusion::result_of::as_vector< list_mpl_t >::type list_t
Definition TPCnvList.h:90
do_create_transient(CNV &parent, const std::string &key, MsgStream &msg)
ELT::Trans_t * operator()(typename ELT::Trans_t *p, ELT &elt)
do_pers_to_trans(CNV &parent, TRANS *trans, const std::string &key, MsgStream &msg)
Metafunction to wrap a TP converter in TPCnvElt.
Definition TPCnvList.h:41
MsgStream & msg
Definition testRead.cxx:32