1 /*******************************************************************************
2 * Copyright (c) 2011-2012 Ericsson, Ecole Polytechnique de Montreal and others
4 * All rights reserved. This program and the accompanying materials are made
5 * 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
9 * Contributors: Matthew Khouzam - Initial API and implementation
10 * Contributors: Simon Marchi - Initial API and implementation
11 *******************************************************************************/
13 package org
.eclipse
.linuxtools
.ctf
.core
.event
.types
;
15 import org
.eclipse
.linuxtools
.internal
.ctf
.core
.event
.io
.BitBuffer
;
18 * <b><u>Definition</u></b>
20 public abstract class Definition
{
22 // ------------------------------------------------------------------------
24 // ------------------------------------------------------------------------
26 /* The name of the field in its container */
27 protected final String fieldName
;
29 /* The complete path of this field */
30 protected final String path
;
33 * The definition scope in which this definition is found.
35 * The complete path of a definition is thus the path of the definition
36 * scope DOT the name of the definition (name of the field in its container)
38 protected final IDefinitionScope definitionScope
;
40 // ------------------------------------------------------------------------
42 // ------------------------------------------------------------------------
44 public Definition(IDefinitionScope definitionScope
, String fieldName
) {
45 this.definitionScope
= definitionScope
;
46 this.fieldName
= fieldName
;
47 if (definitionScope
!= null) {
48 String parentPath
= definitionScope
.getPath();
49 if (parentPath
.length() > 0) {
50 path
= parentPath
+ "." + fieldName
; //$NON-NLS-1$
59 * System.out.println("[definition] " + this.getClass().getSimpleName()
60 * + " " + path + " created");
64 // ------------------------------------------------------------------------
66 // ------------------------------------------------------------------------
68 public abstract void read(BitBuffer input
);
71 public String
toString() {
72 return path
+ '[' + Integer
.toHexString(hashCode()) + ']';