H5AbstractDs.h

00001 // C++ informative line for the emacs editor: -*- C++ -*-
00002 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
00003  * Copyright by The HDF Group.                                               *
00004  * Copyright by the Board of Trustees of the University of Illinois.         *
00005  * All rights reserved.                                                      *
00006  *                                                                           *
00007  * This file is part of HDF5.  The full HDF5 copyright notice, including     *
00008  * terms governing use, modification, and redistribution, is contained in    *
00009  * the files COPYING and Copyright.html.  COPYING can be found at the root   *
00010  * of the source code distribution tree; Copyright.html can be found at the  *
00011  * root level of an installed copy of the electronic HDF5 document set and   *
00012  * is linked from the top-level documents page.  It can also be found at     *
00013  * http://hdfgroup.org/HDF5/doc/Copyright.html.  If you do not have          *
00014  * access to either file, you may request a copy from help@hdfgroup.org.     *
00015  * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
00016 
00017 // Class AbstractDs is an abstract base class, from which Attribute and
00018 // DataSet inherit.  It provides the services that are common to both
00019 // Attribute and DataSet.  It also inherits from H5Object and passes down
00020 // the services that H5Object provides.
00021 
00022 #ifndef _AbstractDs_H
00023 #define _AbstractDs_H
00024 
00025 #ifndef H5_NO_NAMESPACE
00026 namespace H5 {
00027 #endif
00028 
00029 class ArrayType;
00030 class CompType;
00031 class EnumType;
00032 class FloatType;
00033 class IntType;
00034 class StrType;
00035 class VarLenType;
00036 class H5_DLLCPP AbstractDs {
00037    public:
00038         // Gets a copy the datatype of that this abstract dataset uses.
00039         // Note that this datatype is a generic one and can only be accessed
00040         // via generic member functions, i.e., member functions belong
00041         // to DataType.  To get specific datatype, i.e. EnumType, FloatType,
00042         // etc..., use the specific functions, that follow, instead.
00043         DataType getDataType() const;
00044 
00045         // Gets a copy of the specific datatype of this abstract dataset.
00046         ArrayType getArrayType() const;
00047         CompType getCompType() const;
00048         EnumType getEnumType() const;
00049         IntType getIntType() const;
00050         FloatType getFloatType() const;
00051         StrType getStrType() const;
00052         VarLenType getVarLenType() const;
00053 
00054         // Gets the size in memory of this abstract dataset.
00055         virtual size_t getInMemDataSize() const = 0;
00056 
00057         // Gets the dataspace of this abstract dataset - pure virtual.
00058         virtual DataSpace getSpace() const = 0;
00059 
00060         // Gets the class of the datatype that is used by this abstract
00061         // dataset.
00062         H5T_class_t getTypeClass() const;
00063 
00064         // Returns the amount of storage size required for this abstract
00065         // dataset - pure virtual.
00066         virtual hsize_t getStorageSize() const = 0;
00067 
00068         // Returns this class name
00069         virtual H5std_string fromClass() const = 0;
00070 
00071         // Copy constructor
00072         AbstractDs( const AbstractDs& original );
00073 
00074         // Destructor
00075         virtual ~AbstractDs();
00076 
00077    protected:
00078         // Default constructor
00079         AbstractDs();
00080 
00081         // Constructor that takes an attribute id or a dataset id.
00082         AbstractDs( const hid_t ds_id );
00083 
00084    private:
00085         // This member function is implemented by DataSet and Attribute.
00086         virtual hid_t p_get_type() const = 0;
00087 };
00088 #ifndef H5_NO_NAMESPACE
00089 }
00090 #endif
00091 #endif // _AbstractDs_H