Skip to content

Commit eebf700

Browse files
committed
add more accessors to the declared streams
1 parent e923a7d commit eebf700

File tree

2 files changed

+17
-0
lines changed

2 files changed

+17
-0
lines changed

include/dtlmod/DTL.hpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,15 @@ class DTL {
5555
/// @param name The name of the Stream to add to the DTL.
5656
/// @return A handler on the newly created Stream object.
5757
std::shared_ptr<Stream> add_stream(const std::string& name);
58+
59+
/// @brief Retrieve all streams declared in the Data Transport by its name.
60+
/// @return a map of handlers on Stream objects with their names as keys.
61+
std::unordered_map<std::string, std::shared_ptr<Stream>> get_all_streams() const { return streams_; }
62+
63+
/// @brief Retrieve a data stream from the Data Transport Layer by its name.
64+
/// @param name The name of the Stream to retrieve.
65+
/// @return A handler on the Stream object or nullptr if it doesn't exist.
66+
std::shared_ptr<Stream> get_stream_by_name_or_null(const std::string& name) const;
5867
};
5968

6069
} // namespace dtlmod

src/DTL.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,4 +138,12 @@ std::shared_ptr<Stream> DTL::add_stream(const std::string& name)
138138
return streams_[name];
139139
}
140140

141+
std::shared_ptr<Stream> DTL::get_stream_by_name_or_null(const std::string& name) const
142+
{
143+
auto it = streams_.find(name);
144+
if (it == streams_.end())
145+
return nullptr;
146+
return it->second;
147+
148+
}
141149
} // namespace dtlmod

0 commit comments

Comments
 (0)