Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members  

DataIndex.H

Go to the documentation of this file.
00001 /* _______              __
00002   / ___/ /  ___  __ _  / /  ___
00003  / /__/ _ \/ _ \/  ' \/ _ \/ _ \
00004  \___/_//_/\___/_/_/_/_.__/\___/ 
00005 */
00006 //
00007 // This software is copyright (C) by the Lawrence Berkeley
00008 // National Laboratory.  Permission is granted to reproduce
00009 // this software for non-commercial purposes provided that
00010 // this notice is left intact.
00011 // 
00012 // It is acknowledged that the U.S. Government has rights to
00013 // this software under Contract DE-AC03-765F00098 between
00014 // the U.S.  Department of Energy and the University of
00015 // California.
00016 //
00017 // This software is provided as a professional and academic
00018 // contribution for joint exchange. Thus it is experimental,
00019 // is provided ``as is'', with no warranties of any kind
00020 // whatsoever, no support, no promise of updates, or printed
00021 // documentation. By using this software, you acknowledge
00022 // that the Lawrence Berkeley National Laboratory and
00023 // Regents of the University of California shall have no
00024 // liability with respect to the infringement of other
00025 // copyrights by any part of this software.
00026 //
00027 
00028 #ifndef DATAINDEX_H
00029 #define DATAINDEX_H
00030 
00031 #ifndef WRAPPER
00032 class BoxLayout;
00033 
00034 #include <cstdlib>
00035 
00036 class DataIterator;
00037 class LayoutIterator;
00038 
00039 #endif /* WRAPPER */
00040 
00042 class LayoutIndex
00043 {
00044 public:
00045 
00047   LayoutIndex();
00048 
00049   ~LayoutIndex() {;}
00050   // default copy and assign shoule be fine.
00051 
00053   bool operator == (const LayoutIndex& rhs) const;
00054   bool eq(const LayoutIndex& rhs) const { return *this == rhs;}
00055 
00057   bool operator != (const LayoutIndex& rhs) const
00058   { return !(*this == rhs);}
00059 
00061   bool isNull() const;
00062 
00063   // not user function. breaks design encapsulation. method not
00064   // intended for users. The alternative is to make this class a friend
00065   // of BoxLayoutData<T>, which implicitly makes this class templated, which
00066   // makes no bloody sense.  The behaviour of this method is undefined for
00067   // users.  bvs
00068   int intCode() const;
00069 
00070 private:
00071   friend class DataIterator;
00072   friend class LayoutIterator;
00073   friend class BoxLayout;
00074   friend class DataIndex;
00075 
00076   int m_index;
00077   const int* m_layoutIntPtr;
00078   LayoutIndex(int a_index, const int* layoutID)
00079     : m_index(a_index), m_layoutIntPtr(layoutID){}
00080 };
00081 
00082 
00083 class DataIndex : public LayoutIndex
00084 {
00085 public:
00086   explicit DataIndex(const LayoutIndex& promotion)
00087     :LayoutIndex(promotion){}
00088   DataIndex()
00089     : LayoutIndex(){;}
00090   ~DataIndex(){;}
00091 private:
00092   friend class LayoutIterator;
00093   friend class DataIterator;
00094   friend class BoxLayout;
00095   friend class Copier;
00096   DataIndex(int a_index, const int* layoutID)
00097     :LayoutIndex(a_index, layoutID) {}
00098 };
00099 
00100 #ifndef WRAPPER
00101 inline LayoutIndex::LayoutIndex()
00102   : m_index(0), m_layoutIntPtr(NULL){}
00103 
00104 inline bool LayoutIndex::operator==(const LayoutIndex& rhs) const
00105 {
00106   return (m_index == rhs.m_index);
00107 }
00108 
00109 inline int LayoutIndex::intCode() const
00110 {
00111   return m_index;
00112 }
00113 
00114 inline bool LayoutIndex::isNull() const
00115 {
00116   return m_layoutIntPtr == NULL;
00117 }
00118 #endif
00119 
00120 #endif // DATAITERATOR_H

Generated on Thu Aug 29 11:05:44 2002 for Chombo&INS by doxygen1.2.16