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