Skip to main content
aboutsummaryrefslogtreecommitdiffstats
blob: d860a33450d81fd19f8877eb1f7c2c44d5c3dd7a (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
/*******************************************************************************
 * Copyright (c) 2004, 2006 QNX Software Systems and others.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors:
 * QNX Software Systems - Initial API and implementation
 *******************************************************************************/
package org.eclipse.cdt.debug.internal.core.model; 

import org.eclipse.cdt.debug.core.model.ICStackFrame;
import org.eclipse.cdt.debug.core.model.ICVariable;
import org.eclipse.cdt.debug.core.model.IEnableDisableTarget;

/**
 * The super class for all variable types.
 */
public abstract class AbstractCVariable extends CDebugElement implements ICVariable {

	/**
	 * The parent object this variable is contained in.
	 */
	private CDebugElement fParent;

	/** 
	 * Constructor for AbstractCVariable. 
	 */
	public AbstractCVariable( CDebugElement parent ) {
		super( (CDebugTarget)parent.getDebugTarget() );
		setParent( parent );
	}

	protected CDebugElement getParent() {
		return fParent;
	}

	private void setParent( CDebugElement parent ) {
		fParent = parent;
	}

	protected ICStackFrame getStackFrame() {
		CDebugElement parent = getParent();
		if ( parent instanceof AbstractCValue ) {
			AbstractCVariable pv = ((AbstractCValue)parent).getParentVariable();
			if ( pv != null )
				return pv.getStackFrame();
		}
		if ( parent instanceof CStackFrame )
			return (CStackFrame)parent;
		return null;
	}

	/* (non-Javadoc)
	 * @see org.eclipse.core.runtime.IAdaptable#getAdapter(java.lang.Class)
	 */
	public Object getAdapter( Class adapter ) {
		if ( IEnableDisableTarget.class.equals( adapter ) )
			return this;
		return super.getAdapter( adapter );
	}

	public abstract void dispose();

	protected abstract void resetValue();

	protected abstract void setChanged( boolean changed );

	protected abstract void preserve();
}

Back to the top