-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[RF] Implement
RooLinkedList::begin()
, end()
, rbegin()
, rend()
Implements `RooLinkedList::begin()`, `end()`, `rbegin()`, `rend()` and extends the `RooLinkedListIterImpl` interface to support range-based loops for the `RooLinkedList`. Range-based loops on `RooLinkedList` are also used in some places in RooFit to test this new feature. In particular the function `RooCmdConfig::process` is used in basically every RooFit script. This commit also adds `RooLinkedList::size()` and `empty()` for better compatibility with STL containers and automatic pythonizations.
- Loading branch information
1 parent
502a63f
commit 2f7936a
Showing
8 changed files
with
86 additions
and
56 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
33 changes: 33 additions & 0 deletions
33
bindings/pyroot/pythonizations/test/roofit/roolinkedlist.py
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,33 @@ | ||
import unittest | ||
|
||
import ROOT | ||
|
||
|
||
class TestRooLinkedList(unittest.TestCase): | ||
""" | ||
Tests for the RooLinkedList. | ||
""" | ||
|
||
def test_roolinkedlist_iteration(self): | ||
# test if we can correctly iterate over a RooLinkedList, also in | ||
# reverse. | ||
|
||
roolist = ROOT.RooLinkedList() | ||
pylist = [] | ||
|
||
n_elements = 3 | ||
|
||
for i in range(n_elements): | ||
obj = ROOT.TNamed(str(i), str(i)) | ||
ROOT.SetOwnership(obj, False) | ||
roolist.Add(obj) | ||
pylist.append(obj) | ||
|
||
self.assertEqual(len(roolist), n_elements) | ||
|
||
for i, obj in enumerate(roolist): | ||
self.assertEqual(str(i), obj.GetName()) | ||
|
||
|
||
if __name__ == "__main__": | ||
unittest.main() |
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
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