00001 #ifndef ARRAY_TYPE_INFO_HH 00002 #define ARRAY_TYPE_INFO_HH 00003 00004 //--------------------------------------------------------------------------- 00005 // Copyright (c) 1995-2005 Ohio Board of Regents and the University of 00006 // Cincinnati. All Rights Reserved. 00007 00008 // You may modify, distribute, and use the software contained in this package 00009 // under the terms of the "GNU LIBRARY GENERAL PUBLIC LICENSE" version 2, 00010 // June 1991. A copy of this license agreement can be found in the file 00011 // "LGPL", distributed with this archive. 00012 //--------------------------------------------------------------------------- 00013 00014 #include "tyvis/CompositeTypeInfo.hh" 00015 #include "tyvis/RangeIterator.hh" 00016 #include <vector> 00017 using std::vector; 00018 class ScalarTypeInfo; 00019 00023 class ArrayTypeInfo : public CompositeTypeInfo { 00024 public: 00025 ArrayTypeInfo(); 00026 00030 ArrayTypeInfo( const TypeInfo &initElementTypeInfo, 00031 const ScalarTypeInfo &initBound ); 00032 00033 00034 ArrayTypeInfo( const ArrayTypeInfo &that ); 00035 00036 ~ArrayTypeInfo(); 00037 00038 bool operator==( const TypeInfo &that ) const; 00039 TypeInfo *clone() const; 00040 00041 bool isCompositeType() const { return true; } 00042 bool isConstrained() const; 00043 bool isUnconstrained() const; 00044 bool isCharacterType() const; 00045 00046 int numDimensions() const; 00047 00048 ArrayTypeInfo &operator=(const ArrayTypeInfo&); 00049 00050 const TypeInfo &getElementTypeInfo( const RValue &index = defaultIndex() ) const; 00051 const ScalarTypeInfo &getIndexTypeInfo( const RValue &index = defaultIndex() ) const; 00052 00053 virtual RValue *create( const SubElementFactory * ) const; 00054 00055 string getSubFieldName( const string &prefix, int d ) const; 00056 const TypeInfo &getFieldInfo( int fieldIndex ) const; 00057 00058 void constructFields( vector<RValue *> &elements, 00059 const SubElementFactory *subElementFactory, 00060 int numElements = -1 ) const; 00061 00062 virtual int storageIndex( int elementIndex ) const; 00063 00065 00068 const RValue &left( const RValue &dimension = defaultIndex() ) const; 00069 const RValue &right( const RValue &dimension = defaultIndex() ) const; 00070 00071 virtual const ScalarTypeInfo &range( const RValue &index = defaultIndex() ) const; 00072 virtual const ScalarTypeInfo &reverse_range( const RValue &index = defaultIndex() ) const; 00073 00074 UniversalInteger length( const RValue &index = defaultIndex() ) const; 00076 00077 using TypeInfo::value; 00078 Value value( const string &initValue ) const; 00079 00080 protected: 00081 00082 private: 00085 Value valueFromAggregate( const string &initValue ) const; 00088 Value valueFromString( const string &initValue ) const; 00089 00090 friend class CompositeLiteral; 00091 00092 const ScalarTypeInfo *myIndexTypeInfo; 00093 const TypeInfo *myElementTypeInfo; 00094 }; 00095 00096 #endif
1.4.6