1 /*
   2  * Copyright 2001 Sun Microsystems, Inc.  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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
  20  * CA 95054 USA or visit www.sun.com if you need additional information or
  21  * have any questions.
  22  *
  23  */
  24 
  25 package sun.jvm.hotspot.debugger.cdbg;
  26 
  27 import sun.jvm.hotspot.debugger.*;
  28 
  29 /** Models a C or C++ type. Symbols have an associated Type. */
  30 
  31 public interface Type {
  32   public String       getName();
  33   /** Size of the type in bytes */
  34   public int          getSize();
  35 
  36   public BitType      asBit();
  37   public IntType      asInt();
  38   public EnumType     asEnum();
  39   public FloatType    asFloat();
  40   public DoubleType   asDouble();
  41   public PointerType  asPointer();
  42   public ArrayType    asArray();
  43   public RefType      asRef();
  44   public CompoundType asCompound();
  45   public FunctionType asFunction();
  46   public MemberFunctionType asMemberFunction();
  47   public VoidType     asVoid();
  48 
  49   public boolean      isBit();
  50   public boolean      isInt();
  51   public boolean      isEnum();
  52   public boolean      isFloat();
  53   public boolean      isDouble();
  54   public boolean      isPointer();
  55   public boolean      isArray();
  56   public boolean      isRef();
  57   public boolean      isCompound();
  58   public boolean      isFunction();
  59   public boolean      isMemberFunction();
  60   public boolean      isVoid();
  61 
  62   public boolean      isConst();
  63   public boolean      isVolatile();
  64 
  65   /** Visit an object of this type at the given address with the
  66       specified visitor */
  67   public void iterateObject(Address a, ObjectVisitor v);
  68 
  69   /** Alternate visitor which allows end user to specify the
  70       FieldIdentifier associated with this type (typically for
  71       visiting locals in a frame) */
  72   public void iterateObject(Address a, ObjectVisitor v, FieldIdentifier f);
  73 
  74   /** Returns getName() unless a subclass can return something more
  75       appropriate */
  76   public String toString();
  77 
  78   /*
  79   // Kinds of types
  80 
  81   // Primitive types
  82   private static final int BIT;    // Specialized integer type with bit offset and size
  83   private static final int INT;    // Integer type of any size and signedness
  84   private static final int FLOAT;  // Single-precision floating-point
  85   private static final int DOUBLE; // Double-precision floating-point
  86 
  87   // Pointer and related types
  88   private static final int PTR;    // Any pointer type
  89   private static final int ARRAY;  // Array type with known size
  90   private static final int REF;    // C++ references
  91 
  92   // Compound types
  93   private static final int COMPOUND;
  94 
  95   // Function type
  96   private static final int FUNC;
  97 
  98   // Template types
  99   private static final int TEMPLATE_CLASS;
 100   private static final int TEMPLATE_STRUCT;
 101   private static final int TEMPLATE_UNION;
 102   private static final int TEMPLATE_FUNCTION;
 103   */
 104 }