| 1 |
#ifndef PROTON_SOURCE_HPP |
| 2 |
#define PROTON_SOURCE_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 "./fwd.hpp" |
| 26 |
#include "./internal/export.hpp" |
| 27 |
#include "./map.hpp" |
| 28 |
#include "./symbol.hpp" |
| 29 |
#include "./terminus.hpp" |
| 30 |
#include "./value.hpp" |
| 31 |
|
| 32 |
#include <string> |
| 33 |
|
| 34 |
/// @file |
| 35 |
/// @copybrief proton::source |
| 36 |
|
| 37 |
struct pn_terminus_t; |
| 38 |
|
| 39 |
namespace proton { |
| 40 |
|
| 41 |
/// A point of origin for messages. |
| 42 |
/// |
| 43 |
/// @see proton::sender, proton::receiver, proton::target |
| 44 |
class source : public terminus { |
| 45 |
public: |
| 46 |
/// **Unsettled API** - A map of AMQP symbol keys and filter |
| 47 |
/// specifiers. |
| 48 |
typedef map<symbol, value> filter_map; |
| 49 |
|
| 50 |
/// Create an empty source. |
| 51 |
source() = default; |
| 52 |
|
| 53 |
/// The policy for distributing messages. |
| 54 |
enum distribution_mode { |
| 55 |
// XXX Why is unspecified needed? The protocol doesn't have |
| 56 |
// it. |
| 57 |
/// Unspecified |
| 58 |
UNSPECIFIED = PN_DIST_MODE_UNSPECIFIED, |
| 59 |
/// Once transferred, the message remains available to other links |
| 60 |
COPY = PN_DIST_MODE_COPY, |
| 61 |
/// Once transferred, the message is unavailable to other links |
| 62 |
MOVE = PN_DIST_MODE_MOVE |
| 63 |
}; |
| 64 |
|
| 65 |
using terminus::durability_mode; |
| 66 |
using terminus::expiry_policy; |
| 67 |
|
| 68 |
/// The address of the source. |
| 69 |
PN_CPP_EXTERN std::string address() const; |
| 70 |
|
| 71 |
/// Get the distribution mode. |
| 72 |
PN_CPP_EXTERN enum distribution_mode distribution_mode() const; |
| 73 |
|
| 74 |
/// **Unsettled API** - Obtain the set of message filters. |
| 75 |
PN_CPP_EXTERN const filter_map& filters() const; |
| 76 |
|
| 77 |
private: |
| 78 |
source(pn_terminus_t* t); |
| 79 |
source(const sender&); |
| 80 |
source(const receiver&); |
| 81 |
|
| 82 |
filter_map filters_; |
| 83 |
|
| 84 |
/// @cond INTERNAL |
| 85 |
friend class proton::internal::factory<source>; |
| 86 |
friend class sender; |
| 87 |
friend class receiver; |
| 88 |
/// @endcond |
| 89 |
}; |
| 90 |
|
| 91 |
} // proton |
| 92 |
|
| 93 |
#endif // PROTON_SOURCE_HPP |