LArSoft  v09_90_00
Liquid Argon Software toolkit - https://larsoft.org/
DatabaseConnection.h
Go to the documentation of this file.
1 #ifndef art_Framework_Services_System_DatabaseConnection_h
2 #define art_Framework_Services_System_DatabaseConnection_h
3 // vim: set sw=2 expandtab :
4 
6 #include "cetlib/sqlite/Connection.h"
7 #include "cetlib/sqlite/ConnectionFactory.h"
8 #include "cetlib/sqlite/detail/DefaultDatabaseOpenPolicy.h"
9 #include "fhiclcpp/fwd.h"
10 
11 #include <memory>
12 #include <string>
13 #include <utility>
14 
15 namespace art {
16 
18  public:
20  template <typename DatabaseOpenPolicy =
21  cet::sqlite::detail::DefaultDatabaseOpenPolicy,
22  typename... PolicyArgs>
23  std::unique_ptr<cet::sqlite::Connection>
24  get(std::string const& filename, PolicyArgs&&... policyArgs)
25  {
26  return factory_.make_connection<DatabaseOpenPolicy>(
27  filename, std::forward<PolicyArgs>(policyArgs)...);
28  }
29 
30  private:
31  cet::sqlite::ConnectionFactory factory_;
32  };
33 
34 } // namespace art
35 
37 #endif /* art_Framework_Services_System_DatabaseConnection_h */
38 
39 // Local Variables:
40 // mode: c++
41 // End:
DatabaseConnection(fhicl::ParameterSet const &)
cet::sqlite::ConnectionFactory factory_
#define DECLARE_ART_SERVICE(svc, scope)
Definition: MVAAlg.h:12