PODIO v00-16-03
An Event-Data-Model Toolkit for High Energy Physics Experiments
Loading...
Searching...
No Matches
ostream_operator.cpp File Reference
#include "datamodel/MutableExampleForCyclicDependency1.h"
#include "datamodel/MutableExampleForCyclicDependency2.h"
#include "datamodel/MutableExampleMC.h"
#include "datamodel/MutableExampleReferencingType.h"
#include <iostream>

Go to the source code of this file.

Functions

int main (int, char **)
 

Function Documentation

◆ main()

int main ( int  ,
char **   
)

Definition at line 10 of file ostream_operator.cpp.

10 {
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}