Gobelijn API documentation  - generated for commit a0cbea7
 All Classes Namespaces Files Functions Variables Typedefs Friends Macros Pages
app_copy.cpp
Go to the documentation of this file.
1 
7 #include "demobj.h"
8 #include "demos.h"
9 #include "tracer/tracer.h"
10 
11 using namespace std;
12 using namespace ODemo;
13 
19 int app_copy()
20 {
22 
23  COMP_MISC_LOG_TRACER(" statement: shared_ptr<Engine> e1Ptr(new Engine(100));");
24  shared_ptr<Engine> e1Ptr(new Engine(100));
25 
26  COMP_MISC_LOG_TRACER(" statement: Person* p1Ptr = new Person(\"Owner 1\");");
27  auto p1Ptr = new Person("Owner 1");
28 
29  COMP_MISC_LOG_TRACER(" statement: Motorcycle* m1Ptr = new Motorcycle(e1Ptr, p1Ptr);");
30  auto m1Ptr = new Motorcycle(e1Ptr, p1Ptr);
31 
32  COMP_MISC_LOG_TRACER(" statement: m1Ptr->startEngine();");
33  m1Ptr->startEngine();
34 
35  COMP_MISC_LOG_TRACER(" statement: Motorcycle* m2Ptr = new Motorcycle(*m1Ptr);");
36  auto m2Ptr = new Motorcycle(*m1Ptr);
37 
38  COMP_MISC_LOG_TRACER(" statement: Motorcycle m3(shared_ptr<Engine>(new Engine(77)));");
39  Motorcycle m3(make_shared<Engine>(77));
40 
41  COMP_MISC_LOG_TRACER(" statement: m3 = *m2Ptr;");
42  m3 = *m2Ptr;
43 
44  COMP_MISC_LOG_TRACER(" statement: m3.stopEngine();");
45  m3.stopEngine();
46 
47  COMP_MISC_LOG_TRACER(" statement: delete p1Ptr;");
48  delete p1Ptr;
49 
50  COMP_MISC_LOG_TRACER(" statement: delete m1Ptr;");
51  delete m1Ptr;
52 
53  COMP_MISC_LOG_TRACER(" statement: delete m2Ptr;");
54  delete m2Ptr;
55 
56  COMP_MISC_LOG_TRACER(" statement: return 0;");
57  return 0;
58 }
Comprehensive include file for all tracer classes.
Header for object tracer demo routines.
Engine that provides motion.
Definition: Engine.h:12
Motorcycle with Engine and Owner.
Definition: Motorcycle.h:20
int app_copy()
Demo prog to demonstrate deep & shallow copy operations.
Definition: app_copy.cpp:19
void stopEngine()
Stop the motorcycle engine.
Definition: Motorcycle.cpp:117
#define COMP_MISC_FUNCTION_TRACER
Macro for tracking function scope.
A fairly simple class for Person.
Definition: Person.h:17
#define COMP_MISC_LOG_TRACER(MSG)
Macro for inserting log message into tracker output at current severity level.
Definition: TracerOutput.h:17
Comprehensive include file for all of objtracer.