1 /*******************************************************************************
2 * Copyright (c) 2009, 2010 Ericsson
4 * All rights reserved. This program and the accompanying materials are
5 * made 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
10 * Alvaro Sanchez-Leon (alvsan09@gmail.com) - Initial API and implementation
11 *******************************************************************************/
12 package org
.eclipse
.linuxtools
.lttng
.core
.event
;
14 import org
.eclipse
.linuxtools
.lttng
.core
.state
.model
.LttngTraceState
;
15 import org
.eclipse
.linuxtools
.lttng
.jni
.JniEvent
;
16 import org
.eclipse
.linuxtools
.tmf
.core
.event
.TmfEventSource
;
17 import org
.eclipse
.linuxtools
.tmf
.core
.trace
.TmfTrace
;
23 public class LttngSyntheticEvent
extends LttngEvent
{
25 public static final LttngSyntheticEvent NullEvent
= new LttngSyntheticEvent();
27 // ======================================================================+
29 // =======================================================================
32 * BEFORE: Before the update to the state system
35 * UPDATE: Proceed to update the state system
38 * AFTER: After the update of the state system
41 * ACK: Acknowledge indicator for any of the previous sequences
44 public enum SequenceInd
{
45 STARTREQ
, BEFORE
, UPDATE
, AFTER
, ENDREQ
48 private SequenceInd sequence
= SequenceInd
.BEFORE
;
49 private LttngEvent baseEvent
= null;
50 private LttngTraceState fTraceModel
= null;
51 // ======================================================================+
53 // =======================================================================
57 public LttngSyntheticEvent(LttngEvent baseEvent
) {
59 this.baseEvent
= baseEvent
;
71 public LttngSyntheticEvent(TmfTrace
<LttngEvent
> parent
,
72 LttngTimestamp timestamp
, TmfEventSource source
,
73 LttngEventType type
, LttngEventContent content
,
74 LttngEventReference reference
, JniEvent lttEvent
) {
75 super(parent
, timestamp
, source
, type
, content
, reference
, lttEvent
);
78 private LttngSyntheticEvent() {
79 this(null, null, null, null, null, null, null);
82 // ======================================================================+
84 // =======================================================================
87 * @return the sequence indicator
89 public SequenceInd
getSynType() {
95 * the sequence indicator to set
97 public void setSequenceInd(SequenceInd sequence
) {
98 this.sequence
= sequence
;
102 * @return the baseEvent
104 public LttngEvent
getBaseEvent() {
110 * the trace state-data-model associated to this event
112 public void setTraceModel(LttngTraceState traceModel
) {
113 this.fTraceModel
= traceModel
;
117 * @return the traceModel
119 public LttngTraceState
getTraceModel() {
126 * @see org.eclipse.linuxtools.lttng.core.event.LttngEvent#getParentTrace()
128 @SuppressWarnings("unchecked")
130 public TmfTrace
<LttngEvent
> getParentTrace() {
131 if (baseEvent
!= null) {
132 return (TmfTrace
<LttngEvent
>) baseEvent
.getParentTrace();
134 return (TmfTrace
<LttngEvent
>) super.getParentTrace();
142 * org.eclipse.linuxtools.lttng.event.LttngEvent#setParentTrace(org.eclipse
143 * .linuxtools.tmf.trace.TmfTrace)
146 public void setParentTrace(TmfTrace
<LttngEvent
> parentTrace
) {
147 if (baseEvent
!= null) {
148 baseEvent
.setParentTrace(parentTrace
);
150 super.setParentTrace(parentTrace
);
157 * @see org.eclipse.linuxtools.lttng.event.LttngEvent#getChannelName()
160 public String
getChannelName() {
161 if (baseEvent
!= null) {
162 return baseEvent
.getChannelName();
164 return super.getChannelName();
171 * @see org.eclipse.linuxtools.lttng.event.LttngEvent#getCpuId()
174 public long getCpuId() {
175 if (baseEvent
!= null) {
176 return baseEvent
.getCpuId();
178 return super.getCpuId();
185 * @see org.eclipse.linuxtools.lttng.event.LttngEvent#getMarkerName()
188 public String
getMarkerName() {
189 if (baseEvent
!= null) {
190 return baseEvent
.getMarkerName();
192 return super.getMarkerName();
199 * @see org.eclipse.linuxtools.lttng.event.LttngEvent#getContent()
202 public LttngEventContent
getContent() {
203 if (baseEvent
!= null) {
204 return baseEvent
.getContent();
206 return super.getContent();
214 * org.eclipse.linuxtools.lttng.event.LttngEvent#setContent(org.eclipse.
215 * linuxtools.lttng.event.LttngEventContent)
218 public void setContent(LttngEventContent newContent
) {
219 if (baseEvent
!= null) {
220 baseEvent
.setContent(newContent
);
222 super.setContent(newContent
);
229 * @see org.eclipse.linuxtools.lttng.event.LttngEvent#getType()
232 public LttngEventType
getType() {
233 if (baseEvent
!= null) {
234 return baseEvent
.getType();
236 return super.getType();
244 * org.eclipse.linuxtools.lttng.event.LttngEvent#setType(org.eclipse.linuxtools
245 * .lttng.event.LttngEventType)
248 public void setType(LttngEventType newType
) {
249 if (baseEvent
!= null) {
250 baseEvent
.setType(newType
);
252 super.setType(newType
);
260 * org.eclipse.linuxtools.lttng.event.LttngEvent#updateJniEventReference
261 * (org.eclipse.linuxtools.lttng.jni.JniEvent)
264 public void updateJniEventReference(JniEvent newJniEventReference
) {
265 if (baseEvent
!= null) {
266 baseEvent
.updateJniEventReference(newJniEventReference
);
268 super.updateJniEventReference(newJniEventReference
);
275 * @see org.eclipse.linuxtools.lttng.event.LttngEvent#convertEventTmfToJni()
278 public JniEvent
convertEventTmfToJni() {
279 if (baseEvent
!= null) {
280 return baseEvent
.convertEventTmfToJni();
282 return super.convertEventTmfToJni();
289 * @see org.eclipse.linuxtools.lttng.event.LttngEvent#isNullRef()
292 public boolean isNullRef() {
293 return this == NullEvent
;
299 * @see org.eclipse.linuxtools.lttng.event.LttngEvent#toString()
302 public String
toString() {
303 if (baseEvent
!= null) {
304 return baseEvent
.toString();
306 return super.toString();