-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #204 from SylvainCorlay/xregistry_split
Split xregistry
- Loading branch information
Showing
3 changed files
with
30 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
#include "xwidgets/xholder.hpp" | ||
// TODO: separate xregistry declaration in own header | ||
|
||
namespace xw | ||
{ | ||
void xregistry::unregister(xeus::xguid id) | ||
{ | ||
m_storage.erase(id); | ||
} | ||
|
||
auto xregistry::find(xeus::xguid id) -> typename storage_type::mapped_type& | ||
{ | ||
auto it = m_storage.find(id); | ||
if (it == m_storage.end()) | ||
{ | ||
throw std::runtime_error("Could not find specified id in transport registry"); | ||
} | ||
return it->second; | ||
} | ||
|
||
xregistry& get_transport_registry() | ||
{ | ||
static xregistry instance; | ||
return instance; | ||
} | ||
} |