Commit | Line | Data |
---|---|---|
8c8bf09f ASL |
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(String name) { | |
34 | fName = name; | |
35 | TmfSignalManager.register(this); | |
36 | } | |
37 | ||
38 | public TmfComponent(TmfComponent oldComponent) { | |
39 | this.fName = oldComponent.fName; | |
40 | ||
41 | // Should we register? Probably not but I'm not quite sure what this does | |
42 | //register(); | |
43 | } | |
44 | ||
45 | /* (non-Javadoc) | |
46 | * @see org.eclipse.linuxtools.tmf.component.ITmfComponent#getName() | |
47 | */ | |
48 | protected void setName(String name) { | |
49 | fName = name; | |
50 | } | |
51 | ||
52 | // ------------------------------------------------------------------------ | |
53 | // ITmfComponent | |
54 | // ------------------------------------------------------------------------ | |
55 | ||
56 | /* (non-Javadoc) | |
57 | * @see org.eclipse.linuxtools.tmf.component.ITmfComponent#getName() | |
58 | */ | |
59 | public String getName() { | |
60 | return fName; | |
61 | } | |
62 | ||
63 | /* (non-Javadoc) | |
64 | * @see org.eclipse.linuxtools.tmf.component.ITmfComponent#dispose() | |
65 | */ | |
66 | public void dispose() { | |
67 | TmfSignalManager.deregister(this); | |
68 | } | |
69 | ||
70 | /* (non-Javadoc) | |
71 | * @see org.eclipse.linuxtools.tmf.component.ITmfComponent#broadcast(org.eclipse.linuxtools.tmf.signal.TmfSignal) | |
72 | */ | |
73 | public void broadcast(TmfSignal signal) { | |
74 | TmfSignalManager.dispatchSignal(signal); | |
75 | } | |
76 | ||
77 | } |