Commit | Line | Data |
---|---|---|
8c8bf09f | 1 | /******************************************************************************* |
e31e01e8 | 2 | * Copyright (c) 2009, 2010 Ericsson |
8c8bf09f ASL |
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 | ||
8d2e2848 | 15 | import org.eclipse.linuxtools.tmf.signal.TmfSignal; |
8c8bf09f ASL |
16 | import org.eclipse.linuxtools.tmf.signal.TmfSignalManager; |
17 | ||
18 | /** | |
19 | * <b><u>TmfComponent</u></b> | |
20 | * <p> | |
e31e01e8 FC |
21 | * This is the base class of the TMF components. |
22 | * <p> | |
23 | * Currently, it only addresses the inter-component signaling. | |
8c8bf09f ASL |
24 | */ |
25 | public abstract class TmfComponent implements ITmfComponent { | |
26 | ||
ce785d7d | 27 | private String fName; |
fc6ccf6f | 28 | |
e31e01e8 FC |
29 | // ------------------------------------------------------------------------ |
30 | // Constructor | |
31 | // ------------------------------------------------------------------------ | |
32 | ||
fc6ccf6f FC |
33 | public TmfComponent(String name) { |
34 | fName = name; | |
9b635e61 | 35 | // if (Tracer.isComponentTraced()) Tracer.traceComponent(this, "created"); |
2fb2eb37 | 36 | TmfSignalManager.register(this); |
e31e01e8 | 37 | } |
377f1ad8 WB |
38 | |
39 | public TmfComponent(TmfComponent oldComponent) { | |
40 | this.fName = oldComponent.fName; | |
e31e01e8 | 41 | |
377f1ad8 WB |
42 | // Should we register? Probably not but I'm not quite sure what this does |
43 | //register(); | |
44 | } | |
45 | ||
ce785d7d FC |
46 | /* (non-Javadoc) |
47 | * @see org.eclipse.linuxtools.tmf.component.ITmfComponent#getName() | |
48 | */ | |
49 | protected void setName(String name) { | |
50 | fName = name; | |
51 | } | |
52 | ||
e31e01e8 FC |
53 | // ------------------------------------------------------------------------ |
54 | // ITmfComponent | |
55 | // ------------------------------------------------------------------------ | |
56 | ||
57 | /* (non-Javadoc) | |
2fb2eb37 | 58 | * @see org.eclipse.linuxtools.tmf.component.ITmfComponent#getName() |
e31e01e8 | 59 | */ |
2fb2eb37 FC |
60 | public String getName() { |
61 | return fName; | |
8c8bf09f ASL |
62 | } |
63 | ||
e31e01e8 | 64 | /* (non-Javadoc) |
2fb2eb37 | 65 | * @see org.eclipse.linuxtools.tmf.component.ITmfComponent#dispose() |
e31e01e8 | 66 | */ |
2fb2eb37 | 67 | public void dispose() { |
e31e01e8 | 68 | TmfSignalManager.deregister(this); |
9b635e61 | 69 | // if (Tracer.isComponentTraced()) Tracer.traceComponent(this, "terminated"); |
8c8bf09f ASL |
70 | } |
71 | ||
e31e01e8 FC |
72 | /* (non-Javadoc) |
73 | * @see org.eclipse.linuxtools.tmf.component.ITmfComponent#broadcast(org.eclipse.linuxtools.tmf.signal.TmfSignal) | |
74 | */ | |
75 | public void broadcast(TmfSignal signal) { | |
8d2e2848 FC |
76 | TmfSignalManager.dispatchSignal(signal); |
77 | } | |
e31e01e8 | 78 | |
8c8bf09f | 79 | } |