Contribute CNF based TMF project handling
[deliverable/tracecompass.git] / org.eclipse.linuxtools.tmf / src / org / eclipse / linuxtools / tmf / component / TmfComponent.java
1 /*******************************************************************************
2 * Copyright (c) 2009, 2010 Ericsson
3 *
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
8 *
9 * Contributors:
10 * Francois Chouinard - Initial API and implementation
11 *******************************************************************************/
12
13 package org.eclipse.linuxtools.tmf.component;
14
15 import org.eclipse.linuxtools.tmf.signal.TmfSignal;
16 import org.eclipse.linuxtools.tmf.signal.TmfSignalManager;
17
18 /**
19 * <b><u>TmfComponent</u></b>
20 * <p>
21 * This is the base class of the TMF components.
22 * <p>
23 * Currently, it only addresses the inter-component signaling.
24 */
25 public abstract class TmfComponent implements ITmfComponent {
26
27 private String fName;
28
29 // ------------------------------------------------------------------------
30 // Constructor
31 // ------------------------------------------------------------------------
32
33 public TmfComponent() {
34 this(""); //$NON-NLS-1$
35 }
36
37 public void init(String name) {
38 fName = name;
39 TmfSignalManager.register(this);
40 }
41
42 public TmfComponent(String name) {
43 fName = name;
44 TmfSignalManager.register(this);
45 }
46
47 public TmfComponent(TmfComponent oldComponent) {
48 fName = oldComponent.fName;
49 TmfSignalManager.register(this);
50 }
51
52 /* (non-Javadoc)
53 * @see org.eclipse.linuxtools.tmf.component.ITmfComponent#getName()
54 */
55 protected void setName(String name) {
56 fName = name;
57 }
58
59 // ------------------------------------------------------------------------
60 // ITmfComponent
61 // ------------------------------------------------------------------------
62
63 /* (non-Javadoc)
64 * @see org.eclipse.linuxtools.tmf.component.ITmfComponent#getName()
65 */
66 @Override
67 public String getName() {
68 return fName;
69 }
70
71 /* (non-Javadoc)
72 * @see org.eclipse.linuxtools.tmf.component.ITmfComponent#dispose()
73 */
74 @Override
75 public void dispose() {
76 TmfSignalManager.deregister(this);
77 // if (Tracer.isComponentTraced()) Tracer.traceComponent(this, "terminated");
78 }
79
80 /* (non-Javadoc)
81 * @see org.eclipse.linuxtools.tmf.component.ITmfComponent#broadcast(org.eclipse.linuxtools.tmf.signal.TmfSignal)
82 */
83 @Override
84 public void broadcast(TmfSignal signal) {
85 TmfSignalManager.dispatchSignal(signal);
86 }
87
88 }
This page took 0.03176 seconds and 5 git commands to generate.