-
Notifications
You must be signed in to change notification settings - Fork 494
Polymorphic allocators in DPL #1514
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
Closed
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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,74 @@ | ||
| // Copyright CERN and copyright holders of ALICE O2. This software is | ||
| // distributed under the terms of the GNU General Public License v3 (GPL | ||
| // Version 3), copied verbatim in the file "COPYING". | ||
| // | ||
| // See http://alice-o2.web.cern.ch/license for full licensing information. | ||
| // | ||
| // In applying this license CERN does not waive the privileges and immunities | ||
| // granted to it by virtue of its status as an Intergovernmental Organization | ||
| // or submit itself to any jurisdiction. | ||
|
|
||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Could you split this is a separate PR, adding a test exercising it? I think this can go in without further discussion. |
||
| #ifndef FRAMEWORK_OBSERVER_PTR_H | ||
| #define FRAMEWORK_OBSERVER_PTR_H | ||
|
|
||
| #include <cstddef> | ||
| #include <type_traits> | ||
|
|
||
| namespace o2 | ||
| { | ||
|
|
||
| template <typename W> | ||
| class observer_ptr | ||
| { | ||
| public: | ||
| using element_type = W; | ||
|
|
||
| constexpr observer_ptr() noexcept = default; | ||
| constexpr observer_ptr(std::nullptr_t) noexcept {} | ||
| explicit observer_ptr(element_type* ptr) noexcept : mptr{ ptr } {} | ||
| template <typename W2, typename std::enable_if<std::is_convertible<element_type*, W2*>::value, int>::type = 1> | ||
| observer_ptr(observer_ptr<W2> other) noexcept : mptr{ other.get() } | ||
| { | ||
| } | ||
| observer_ptr(const observer_ptr& other) = default; | ||
| observer_ptr(observer_ptr&& other) = default; | ||
|
|
||
| constexpr element_type* release() noexcept | ||
| { | ||
| auto tmp = *this; | ||
| this->reset(); | ||
| return tmp.get(); | ||
| } | ||
| constexpr void reset(element_type* p = nullptr) noexcept { *this = p; } | ||
| constexpr void swap(observer_ptr& other) noexcept | ||
| { | ||
| observer_ptr<element_type> tmp(*this); | ||
| *this = other; | ||
| other = tmp; | ||
| }; | ||
| constexpr void swap(std::nullptr_t) noexcept | ||
| { | ||
| *this = nullptr; | ||
| }; | ||
| constexpr element_type* get() const noexcept { return mptr; } | ||
| constexpr std::add_lvalue_reference_t<element_type> operator*() const { return *get(); } | ||
| constexpr element_type* operator->() const noexcept { return get(); } | ||
| constexpr std::add_lvalue_reference_t<observer_ptr<element_type>> operator=(const std::add_lvalue_reference_t<observer_ptr<element_type>> other) { mptr = other.mptr; } | ||
| constexpr std::add_lvalue_reference_t<observer_ptr<element_type>> operator=(element_type* const other) { mptr = other; } | ||
|
|
||
| constexpr explicit operator element_type*() const noexcept { return get(); } | ||
| constexpr explicit operator bool() const noexcept { return get() != nullptr; } | ||
|
|
||
| private: | ||
| element_type* mptr{ nullptr }; | ||
| }; | ||
|
|
||
| template <typename W> | ||
| observer_ptr<W> make_observer(W* p) noexcept | ||
| { | ||
| return observer_ptr(p); | ||
| } | ||
|
|
||
| } //namespace o2 | ||
|
|
||
| #endif | ||
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this really necessary? There was a big cost in including the
FairMQDevice.hdue to the boost state machine.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FairMQ headers do not contain MSM anymore, all MSM is in source files.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it true? I see
which itself includes MSM. When was this changed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In May 2018 MSM includes were moved to FairMQStateMachine.cxx.