PODIO v00-16-03
An Event-Data-Model Toolkit for High Energy Physics Experiments
Loading...
Searching...
No Matches
ostream_operator.cpp
Go to the documentation of this file.
1#include "datamodel/MutableExampleForCyclicDependency1.h"
2#include "datamodel/MutableExampleForCyclicDependency2.h"
3#include "datamodel/MutableExampleMC.h"
4#include "datamodel/MutableExampleReferencingType.h"
5
6#include <iostream>
7
8// When using CTest for unit testing it is enough for this test to eventually
9// segfault
10int main(int, char**) {
11 MutableExampleMC mcp1;
12 MutableExampleMC mcp2;
13
14 mcp1.adddaughters(mcp2);
15 mcp2.addparents(mcp1);
16
17 // This will lead to an infinite loop and a core dump eventually
18 std::cout << mcp1 << std::endl;
19
20 // Make sure everything still works if the relation is not of the same type
21 MutableExampleForCyclicDependency1 cyc1;
22 MutableExampleForCyclicDependency2 cyc2;
23
24 cyc1.ref(cyc2);
25 cyc2.ref(cyc1);
26
27 std::cout << cyc1 << cyc2 << std::endl;
28
29 // Non-cyclical references
30 MutableExampleReferencingType ref1;
31 MutableExampleReferencingType ref2;
32 ExampleReferencingType ref3;
33
34 ref1.addRefs(ref2);
35 ref2.addRefs(ref3);
36
37 std::cout << ref1 << std::endl;
38
39 return 0;
40}
int main()