diff --git a/include/dtlmod/DTL.hpp b/include/dtlmod/DTL.hpp index 6ff0e2c..4253d67 100644 --- a/include/dtlmod/DTL.hpp +++ b/include/dtlmod/DTL.hpp @@ -55,6 +55,15 @@ class DTL { /// @param name The name of the Stream to add to the DTL. /// @return A handler on the newly created Stream object. std::shared_ptr add_stream(const std::string& name); + + /// @brief Retrieve all streams declared in the Data Transport by its name. + /// @return a map of handlers on Stream objects with their names as keys. + std::unordered_map> get_all_streams() const { return streams_; } + + /// @brief Retrieve a data stream from the Data Transport Layer by its name. + /// @param name The name of the Stream to retrieve. + /// @return A handler on the Stream object or nullptr if it doesn't exist. + std::shared_ptr get_stream_by_name_or_null(const std::string& name) const; }; } // namespace dtlmod diff --git a/src/DTL.cpp b/src/DTL.cpp index 93a5079..f99fe3b 100644 --- a/src/DTL.cpp +++ b/src/DTL.cpp @@ -138,4 +138,12 @@ std::shared_ptr DTL::add_stream(const std::string& name) return streams_[name]; } +std::shared_ptr DTL::get_stream_by_name_or_null(const std::string& name) const +{ + auto it = streams_.find(name); + if (it == streams_.end()) + return nullptr; + return it->second; + +} } // namespace dtlmod