Revert "ctf: Remove the callsite support"
[deliverable/tracecompass.git] / ctf / org.eclipse.tracecompass.ctf.core / src / org / eclipse / tracecompass / ctf / core / event / CTFCallsite.java
1 /*******************************************************************************
2 * Copyright (c) 2012, 2014 Ericsson
3 *
4 * All rights reserved. This program and the accompanying materials are made
5 * available under the terms of the Eclipse Public License v1.0 which
6 * accompanies this distribution, and is available at
7 * http://www.eclipse.org/legal/epl-v10.html
8 *
9 * Contributors:
10 * Matthew Khouzam - Initial API and implementation
11 *
12 *******************************************************************************/
13
14 package org.eclipse.tracecompass.ctf.core.event;
15
16 import java.util.Objects;
17
18 import org.eclipse.jdt.annotation.NonNullByDefault;
19 import org.eclipse.jdt.annotation.Nullable;
20
21 /**
22 * Callsite information to help with cdt integration
23 *
24 * @author Matthew Khouzam
25 * @since 2.1
26 */
27 @NonNullByDefault
28 public class CTFCallsite {
29 /**
30 * The event name
31 */
32 private final String fEventName;
33
34 /**
35 * the file name of the callsite
36 */
37 private final String fFileName;
38
39 /**
40 * the instruction pointer
41 */
42 private final long fIp;
43
44 /**
45 * the function name
46 */
47 private final String fFunctionName;
48
49 /**
50 * the line number of the callsite
51 */
52 private final long fLineNumber;
53
54 /**
55 * The callsite constructor
56 *
57 * @param en
58 * The event name
59 * @param func
60 * the function name
61 * @param ip
62 * the instruction pointer of the callsite
63 * @param fn
64 * the file name of the callsite
65 * @param line
66 * the line number of the callsite
67 */
68 public CTFCallsite(String en, String func, long ip, String fn, long line) {
69 fEventName = en;
70 fFileName = fn;
71 fFunctionName = func;
72 fIp = ip;
73 fLineNumber = line;
74 }
75
76 /**
77 * @return the eventName
78 */
79 public String getEventName() {
80 return fEventName;
81 }
82
83 /**
84 * @return the fileName
85 */
86 public String getFileName() {
87 return fFileName;
88 }
89
90 /**
91 * @return the ip
92 */
93 public long getIp() {
94 return fIp;
95 }
96
97 /**
98 * @return the functionName
99 */
100 public String getFunctionName() {
101 return fFunctionName;
102 }
103
104 /**
105 * @return the lineNumber
106 */
107 public long getLineNumber() {
108 return fLineNumber;
109 }
110
111 @Override
112 public int hashCode() {
113 return Objects.hash(fEventName, fFileName, fIp, fFunctionName, fLineNumber);
114 }
115
116 @Override
117 public boolean equals(@Nullable Object obj) {
118 if (this == obj) {
119 return true;
120 }
121 if (obj == null) {
122 return false;
123 }
124 if (getClass() != obj.getClass()) {
125 return false;
126 }
127 CTFCallsite other = (CTFCallsite) obj;
128 if (!fEventName.equals(other.fEventName)) {
129 return false;
130 }
131 if (!fFileName.equals(other.fFileName)) {
132 return false;
133 }
134 if (!fFunctionName.equals(other.fFunctionName)) {
135 return false;
136 }
137 if (fIp != other.fIp) {
138 return false;
139 }
140 if (fLineNumber != other.fLineNumber) {
141 return false;
142 }
143 return true;
144 }
145
146 @Override
147 public String toString() {
148 return fFileName + "/" + fFunctionName + ":" + fLineNumber; //$NON-NLS-1$ //$NON-NLS-2$
149 }
150 }
This page took 0.049831 seconds and 5 git commands to generate.