Qpid Proton C++  0.14.0
default_container.hpp
1 #ifndef PROTON_DEFAULT_CONTAINER_HPP
2 #define PROTON_DEFAULT_CONTAINER_HPP
3 
4 /*
5  *
6  * Licensed to the Apache Software Foundation (ASF) under one
7  * or more contributor license agreements. See the NOTICE file
8  * distributed with this work for additional information
9  * regarding copyright ownership. The ASF licenses this file
10  * to you under the Apache License, Version 2.0 (the
11  * "License"); you may not use this file except in compliance
12  * with the License. You may obtain a copy of the License at
13  *
14  * http://www.apache.org/licenses/LICENSE-2.0
15  *
16  * Unless required by applicable law or agreed to in writing,
17  * software distributed under the License is distributed on an
18  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
19  * KIND, either express or implied. See the License for the
20  * specific language governing permissions and limitations
21  * under the License.
22  *
23  */
24 
25 #include "./container.hpp"
26 
27 #include "./internal/config.hpp"
28 #include "./internal/export.hpp"
29 
30 #include <memory>
31 #include <string>
32 
33 namespace proton {
34 class messaging_handler;
35 
36 // Avoid deprecated diagnostics from auto_ptr
37 #if defined(__GNUC__) && __GNUC__*100 + __GNUC_MINOR__ >= 406 || defined(__clang__)
38 #pragma GCC diagnostic push
39 #pragma GCC diagnostic ignored "-Wdeprecated-declarations"
40 #endif
41 PN_CPP_EXTERN std::auto_ptr<container> make_auto_default_container(messaging_handler&, const std::string& id="");
43 PN_CPP_EXTERN std::auto_ptr<container> make_auto_default_container(const std::string& id="");
44 
45 #if PN_CPP_HAS_UNIQUE_PTR
46 PN_CPP_EXTERN std::unique_ptr<container> make_default_container(messaging_handler&, const std::string& id="");
48 PN_CPP_EXTERN std::unique_ptr<container> make_default_container(const std::string& id="");
49 #endif
50 
51 #if PN_CPP_HAS_UNIQUE_PTR
52 class default_container : public container_ref<std::unique_ptr<container> > {
53 public:
54  default_container(messaging_handler& h, const std::string& id="") : container_ref(make_default_container(h, id)) {}
55  default_container(const std::string& id="") : container_ref(make_default_container(id)) {}
56 };
57 #else
58 class default_container : public container_ref<std::auto_ptr<container> > {
59 public:
60  default_container(messaging_handler& h, const std::string& id="") : container_ref<std::auto_ptr<container> >(make_auto_default_container(h, id)) {}
61  default_container(const std::string& id="") : container_ref<std::auto_ptr<container> >(make_auto_default_container(id)) {}
62 };
63 #endif
64 
65 #if defined(__GNUC__) && __GNUC__*100 + __GNUC_MINOR__ >= 406 || defined(__clang__)
66 #pragma GCC diagnostic pop
67 #endif
68 
69 } // proton
70 
71 #endif // PROTON_DEFAULT_CONTAINER_HPP
STL namespace.
std::string id() const
Definition: container.hpp:316
Type traits for mapping between AMQP and C++ types.
Definition: annotation_key.hpp:28
std::auto_ptr< container > make_auto_default_container(messaging_handler &, const std::string &id="")
Default container factory for C++03, not recommended unless you only have C++03.