container_ref< Ptr >abstract

This is an header only class that can be used to help using containers more natural by allowing them to be treated as value types. More...

`#include <container.hpp>`

Inheritance diagram for container_ref< Ptr >:
[legend]
Collaboration diagram for container_ref< Ptr >:
[legend]

## Public Member Functions

| container_ref (Ptr p)
returned< connection > | connect (const std::string &url, const connection_options &opts)
| Connect to `url` and send an open request to the remote peer. More...
returned< connection > | connect (const std::string &url)
| Connect to `url` and send an open request to the remote peer.
listener | listen (const std::string &url, listen_handler &l)
| Start listening on url. More...
listener | listen (const std::string &url, const connection_options &opts)
| Listen with a fixed set of options for all accepted connections. More...
listener | listen (const std::string &url)
| Start listening on URL. More...
void | stop_listening (const std::string &url)
void | run ()
| Run the container in this thread. More...
void | auto_stop (bool set)
| If true, stop the container when all active connections and listeners are closed. More...
void | stop (const error_condition &err)
| Experimental - Stop the container with an error_condition err. More...
void | stop ()
| Experimental - Stop the container with an empty error condition. More...
returned< sender > | open_sender (const std::string &url, const class sender_options &o, const connection_options &c)
returned< sender > | open_sender (const std::string &url, const class connection_options &o)
returned< sender > | open_sender (const std::string &url, const class sender_options &o)
returned< sender > | open_sender (const std::string &url)
| Open a connection and sender for `url`.
returned< receiver > | open_receiver (const std::string &url, const class receiver_options &o, const connection_options &c)
returned< receiver > | open_receiver (const std::string &url, const class receiver_options &o)
returned< receiver > | open_receiver (const std::string &url, const class connection_options &o)
returned< receiver > | open_receiver (const std::string &url)
| Open a connection and receiver for `url`.
std::string | id () const
| A unique identifier for the container.
void | schedule (duration d, void_function0 &f)
| Schedule a function to be called after the duration. More...
void | client_connection_options (const connection_options &c)
| Connection options that will be to outgoing connections. More...
connection_options | client_connection_options () const
| Connection options that will be to outgoing connections. More...
void | server_connection_options (const connection_options &o)
| Connection options that will be applied to incoming connections. More...
connection_options | server_connection_options () const
| Connection options that will be applied to incoming connections. More...
void | sender_options (const class sender_options &o)
| Sender options applied to senders created by this container. More...
class sender_options | sender_options () const
| Sender options applied to senders created by this container. More...
void | receiver_options (const class receiver_options &o)
| Receiver options applied to receivers created by this container. More...
class receiver_options | receiver_options () const
| Receiver options applied to receivers created by this container. More...
virtual returned< sender > | open_sender (const std::string &url, const proton::sender_options &o)=0
| Open a connection and sender for `url`. More...
virtual returned< sender > | open_sender (const std::string &url, const connection_options &c)=0
| Open a connection and sender for `url`. More...
virtual returned< sender > | open_sender (const std::string &url, const proton::sender_options &o, const connection_options &c)=0
| Open a connection and sender for `url`. More...
virtual returned< receiver > | open_receiver (const std::string &url, const proton::receiver_options &o)=0
| Open a connection and receiver for `url`. More...
virtual returned< receiver > | open_receiver (const std::string &url, const connection_options &c)=0
| Open a connection and receiver for `url`. More...
virtual returned< receiver > | open_receiver (const std::string &url, const proton::receiver_options &o, const connection_options &c)=0
| Open a connection and receiver for `url`. More...

## Detailed Description

### template<class Ptr>
class proton::container_ref< Ptr >

This is an header only class that can be used to help using containers more natural by allowing them to be treated as value types.

## Member Function Documentation

## auto_stop()

void auto_stop | ( | bool |  | ) |

inline virtual

If true, stop the container when all active connections and listeners are closed.

If false the container will keep running till stop() is called.

auto_stop is set by default when a new container is created.

Implements container.

## client_connection_options() [1/2]

void client_connection_options | ( | const connection_options & |  | ) |

inline virtual

Connection options that will be to outgoing connections.

These are applied first and overriden by options provided in connect() and messaging_handler::on_connection_open().

Implements container.

## client_connection_options() [2/2]

connection_options client_connection_options | ( |  | ) | const

inline virtual

Connection options that will be to outgoing connections.

These are applied first and overriden by options provided in connect() and messaging_handler::on_connection_open().

Implements container.

## connect()

returned<connection> connect | ( | const std::string & | url,
|  | const connection_options & |
| ) |  |

inline virtual

Connect to `url` and send an open request to the remote peer.

Options are applied to the connection as follows, values in later options override earlier ones:

1. client_connection_options()
2. options passed to connect()

The handler in the composed options is used to call proton::messaging_handler::on_connection_open() when the remote peer's open response is received.

Implements container.

## listen() [1/3]

listener listen | ( | const std::string & | url,
|  | listen_handler & | lh
| ) |  |

inline virtual

Start listening on url.

Calls to the listen_handler are serialized for this listener, but handlers attached to separate listeners may be called concurrently.

Parameters

  url | identifies a listening url.
  lh | handles listening events

Returns
  listener lets you stop listening

Implements container.

## listen() [2/3]

listener listen | ( | const std::string & | url,
|  | const connection_options & |
| ) |  |

inline virtual

Listen with a fixed set of options for all accepted connections.

See listen(const std::string&, listen_handler&)

Implements container.

## listen() [3/3]

listener listen | ( | const std::string & | url | ) |

inline virtual

Start listening on URL.

New connections will use the handler from server_connection_options()

Implements container.

## open_receiver() [1/3]

virtual returned<receiver> open_receiver | ( | const std::string & | url,
|  | const proton::receiver_options & | o
| ) |  |

pure virtual inherited

Open a connection and receiver for `url`.

Supplied receiver options will override the container's template options.

## open_receiver() [2/3]

virtual returned<receiver> open_receiver | ( | const std::string & | url,
|  | const connection_options & | c
| ) |  |

pure virtual inherited

Open a connection and receiver for `url`.

Supplied receiver or connection options will override the container's template options.

## open_receiver() [3/3]

virtual returned<receiver> open_receiver | ( | const std::string & | url,
|  | const proton::receiver_options & | o,
|  | const connection_options & | c
| ) |  |

pure virtual inherited

Open a connection and receiver for `url`.

Supplied receiver or connection options will override the container's template options.

## open_sender() [1/3]

virtual returned<sender> open_sender | ( | const std::string & | url,
|  | const proton::sender_options & | o
| ) |  |

pure virtual inherited

Open a connection and sender for `url`.

Supplied sender options will override the container's template options.

## open_sender() [2/3]

virtual returned<sender> open_sender | ( | const std::string & | url,
|  | const connection_options & | c
| ) |  |

pure virtual inherited

Open a connection and sender for `url`.

Supplied connection options will override the container's template options.

## open_sender() [3/3]

virtual returned<sender> open_sender | ( | const std::string & | url,
|  | const proton::sender_options & | o,
|  | const connection_options & | c
| ) |  |

pure virtual inherited

Open a connection and sender for `url`.

Supplied sender or connection options will override the container's template options.

## receiver_options() [1/2]

void receiver_options | ( | const class receiver_options & |  | ) |

inline virtual

Receiver options applied to receivers created by this container.

They are applied before messaging_handler::on_receiver_open() and can be overridden.

Implements container.

## receiver_options() [2/2]

class receiver_options receiver_options | ( |  | ) | const

inline virtual

Receiver options applied to receivers created by this container.

They are applied before messaging_handler::on_receiver_open() and can be overridden.

Implements container.

## run()

void run | ( |  | ) |

inline virtual

Run the container in this thread.

Returns when the container stops.

See also
  auto_stop() and stop().

With a multithreaded container, call run() in multiple threads to create a thread pool.

Implements container.

## schedule()

void schedule | ( | duration | ,
|  | void_function0 & |
| ) |  |

inline virtual

Schedule a function to be called after the duration.

C++03 compatible, for C++11 use the schedule(duration, std::function<void()>)

Implements container.

## sender_options() [1/2]

class sender_options sender_options | ( |  | ) | const

inline virtual

Sender options applied to senders created by this container.

They are applied before messaging_handler::on_sender_open() and can be overridden.

Implements container.

## sender_options() [2/2]

void sender_options | ( | const class sender_options & |  | ) |

inline virtual

Sender options applied to senders created by this container.

They are applied before messaging_handler::on_sender_open() and can be overridden.

Implements container.

## server_connection_options() [1/2]

void server_connection_options | ( | const connection_options & |  | ) |

inline virtual

Connection options that will be applied to incoming connections.

These are applied first and overridden by options provided in listen(), listen_handler::on_accept() and messaging_handler::on_connection_open().

Implements container.

## server_connection_options() [2/2]

connection_options server_connection_options | ( |  | ) | const

inline virtual

Connection options that will be applied to incoming connections.

These are applied first and overridden by options provided in listen(), listen_handler::on_accept() and messaging_handler::on_connection_open().

Implements container.

## stop() [1/2]

void stop | ( | const error_condition & | err | ) |

inline virtual

Experimental - Stop the container with an error_condition err.

- Abort all open connections and listeners.
- Process final handler events and injected functions
- If `!err.empty()`, handlers will receive on_transport_error
- run() will return in all threads.

Implements container.

## stop() [2/2]

void stop | ( |  | ) |

inline virtual

Experimental - Stop the container with an empty error condition.

See also
  stop(const error_condition&)

Implements container.

The documentation for this class was generated from the following file:

- proton/container.hpp