1 /*
2  * Copyright (c) 2001, Oracle and/or its affiliates. All rights reserved.
3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4  *
5  * This code is free software; you can redistribute it and/or modify it
6  * under the terms of the GNU General Public License version 2 only, as
7  * published by the Free Software Foundation.
8  *
9  * This code is distributed in the hope that it will be useful, but WITHOUT
10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
12  * version 2 for more details (a copy is included in the LICENSE file that
13  * accompanied this code).
14  *
15  * You should have received a copy of the GNU General Public License version
16  * 2 along with this work; if not, write to the Free Software Foundation,
17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18  *
19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20  * or visit www.oracle.com if you need additional information or have any
21  * questions.
22  *
23  */
24 
25 package sun.jvm.hotspot.debugger.cdbg;
26 
27 import sun.jvm.hotspot.debugger.*;
28 
29 /** Provides uniform visitation to primitive and compound objects.
30     Typically one will have an Address of an "object" (in the
31     idealistic C++ definition, including "primitive objects" like
32     ints) and a Type for that object. This visitor interface allows
33     one to either get the value of the object (if of primitive type)
34     or iterate through its fields, getting the value of each, in a
35     consistent fashion. Also supports iteration through arrays of
36     known length. */
37 
38 public interface ObjectVisitor {
39   /** This is called before beginning iterating through either the
40       fields declared in this compound type (not its superclasses) or
41       the elements of this array */
enterType(Type type, Address objectAddress)42   public void enterType(Type type, Address objectAddress);
43 
44   /** This is called after finishing iterating through this compound
45       type */
exitType()46   public void exitType();
47 
48   /** Primitive field or object of integer bitfield
49       type. FieldIdentifier is null if not a field of an enclosing
50       object. */
doBit(FieldIdentifier f, long val)51   public void doBit(FieldIdentifier f, long val);
52 
53   /** Primitive field or object of integer type. FieldIdentifier is
54       null if not a field of an enclosing object. */
doInt(FieldIdentifier f, long val)55   public void doInt(FieldIdentifier f, long val);
56 
57   /** Primitive field or object of enumerated type type.
58       FieldIdentifier is null if not a field of an enclosing
59       object. */
doEnum(FieldIdentifier f, long val, String enumName)60   public void doEnum(FieldIdentifier f, long val, String enumName);
61 
62   /** Primitive field or object of single-precision floating-point
63       type. FieldIdentifier is null if not a field of an enclosing
64       object. */
doFloat(FieldIdentifier f, float val)65   public void doFloat(FieldIdentifier f, float val);
66 
67   /** Primitive field or object of double-precision floating-point
68       type. FieldIdentifier is null if not a field of an enclosing
69       object. */
doDouble(FieldIdentifier f, double val)70   public void doDouble(FieldIdentifier f, double val);
71 
72   /** Primitive field or object of pointer type. FieldIdentifier is
73       null if not a field of an enclosing object. */
doPointer(FieldIdentifier f, Address val)74   public void doPointer(FieldIdentifier f, Address val);
75 
76   /** Primitive field or object of array type. FieldIdentifier is null
77       if not a field of an enclosing object. */
doArray(FieldIdentifier f, Address val)78   public void doArray(FieldIdentifier f, Address val);
79 
80   /** Primitive field or object of (C++) reference
81       type. FieldIdentifier is null if not a field of an enclosing
82       object. */
doRef(FieldIdentifier f, Address val)83   public void doRef(FieldIdentifier f, Address val);
84 
85   /** Identifies embedded objects in compound objects. FieldIdentifier
86       is null if not a field of an enclosing object. */
doCompound(FieldIdentifier f, Address addressOfEmbeddedCompoundObject)87   public void doCompound(FieldIdentifier f, Address addressOfEmbeddedCompoundObject);
88 }
89