1 /*******************************************************************************
2 * Copyright (c) 2009, 2014 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 * Francois Chouinard - Initial API and implementation
11 * Bernd Hufmann - Add interface for broadcasting signals asynchronously
12 *******************************************************************************/
14 package org
.eclipse
.tracecompass
.tmf
.core
.component
;
16 import org
.eclipse
.jdt
.annotation
.NonNull
;
17 import org
.eclipse
.tracecompass
.internal
.tmf
.core
.TmfCoreTracer
;
18 import org
.eclipse
.tracecompass
.tmf
.core
.signal
.TmfSignal
;
19 import org
.eclipse
.tracecompass
.tmf
.core
.signal
.TmfSignalManager
;
22 * This is the base class of the TMF components.
24 * Currently, it only addresses the inter-component signaling.
26 * @author Francois Chouinard
28 public abstract class TmfComponent
implements ITmfComponent
{
30 // ------------------------------------------------------------------------
32 // ------------------------------------------------------------------------
34 private @NonNull String fName
= ""; //$NON-NLS-1$
36 // ------------------------------------------------------------------------
38 // ------------------------------------------------------------------------
41 * Default constructor. To be used in conjunction with init()
43 public TmfComponent() {
44 this(""); //$NON-NLS-1$
48 * Perform component initialization and register it as a signal listener.
49 * Need to be called when the default constructor was used.
54 public void init(String name
) {
55 String cmpName
= name
;
56 if (cmpName
== null) {
57 cmpName
= ""; //$NON-NLS-1$
59 TmfCoreTracer
.traceComponent(cmpName
, "created"); //$NON-NLS-1$
61 TmfSignalManager
.register(this);
65 * The standard constructor
70 public TmfComponent(String name
) {
75 * The copy constructor
80 public TmfComponent(TmfComponent other
) {
84 // ------------------------------------------------------------------------
86 // ------------------------------------------------------------------------
89 public @NonNull String
getName() {
95 * the new component name
97 protected void setName(@NonNull String name
) {
101 // ------------------------------------------------------------------------
103 // ------------------------------------------------------------------------
106 public void dispose() {
107 TmfSignalManager
.deregister(this);
108 TmfCoreTracer
.traceComponent(fName
, "disposed"); //$NON-NLS-1$
112 public void broadcast(TmfSignal signal
) {
113 TmfSignalManager
.dispatchSignal(signal
);
117 public void broadcastAsync(TmfSignal signal
) {
118 TmfSignalManager
.dispatchSignalAsync(signal
);
This page took 0.032238 seconds and 5 git commands to generate.