Roc Toolkit internal modules
Roc Toolkit: real-time audio streaming
port_to_str.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2019 Roc authors
3  *
4  * This Source Code Form is subject to the terms of the Mozilla Public
5  * License, v. 2.0. If a copy of the MPL was not distributed with this
6  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
7  */
8 
9 //! @file roc_pipeline/target_stdio/roc_pipeline/port_to_str.h
10 //! @brief Port to string.
11 
12 #ifndef ROC_PIPELINE_PORT_TO_STR_H_
13 #define ROC_PIPELINE_PORT_TO_STR_H_
14 
15 #include "roc_pipeline/config.h"
16 
17 namespace roc {
18 namespace pipeline {
19 
20 //! Convert port type to string.
21 const char* port_type_to_str(PortType type);
22 
23 //! Convert port protocol to string.
24 const char* port_proto_to_str(PortProtocol proto);
25 
26 //! Convert pipeline port to string.
27 class port_to_str : public core::NonCopyable<> {
28 public:
29  //! Construct.
30  explicit port_to_str(const PortConfig&);
31 
32  //! Get formatted address.
33  const char* c_str() const {
34  return buffer_;
35  }
36 
37 private:
38  char buffer_[256];
39 };
40 
41 } // namespace pipeline
42 } // namespace roc
43 
44 #endif // ROC_PIPELINE_PORT_TO_STR_H_
Port parameters.
Definition: config.h:56
PortProtocol
Port protocol.
Definition: port.h:28
Pipeline config.
Root namespace.
const char * port_type_to_str(PortType type)
Convert port type to string.
Convert pipeline port to string.
Definition: port_to_str.h:27
const char * port_proto_to_str(PortProtocol proto)
Convert port protocol to string.
Base class for non-copyable objects.
Definition: noncopyable.h:23
const char * c_str() const
Get formatted address.
Definition: port_to_str.h:33
port_to_str(const PortConfig &)
Construct.
PortType
Port type.
Definition: port.h:19