File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -124,6 +124,9 @@ namespace mgis {
124124 * free function.
125125 */
126126 void setLogStream (std::shared_ptr<std::ostream>) noexcept ;
127+ // ! \return a pointer to a log stream. This pointer may be null.
128+ [[nodiscard]] std::shared_ptr<std::ostream> getLogStreamPointer ()
129+ const noexcept ;
127130 // ! \brief reset the default log stream
128131 void resetLogStream () noexcept ;
129132 /* !
Original file line number Diff line number Diff line change 1+
12/* !
23 * \file src/Context.cxx
34 * \brief This file implements the `Context` class
@@ -37,6 +38,14 @@ namespace mgis {
3738 this ->log_stream = s;
3839 } // end of setLogStream
3940
41+ std::shared_ptr<std::ostream> Context::getLogStreamPointer () const noexcept {
42+ if (std::holds_alternative<std::shared_ptr<std::ostream>>(
43+ this ->log_stream )) {
44+ return std::get<std::shared_ptr<std::ostream>>(this ->log_stream );
45+ }
46+ return {};
47+ } // end of getLogStreamPointer
48+
4049 void Context::resetLogStream () noexcept {
4150 this ->log_stream = std::monostate{};
4251 }
You can’t perform that action at this time.
0 commit comments