vtf-logo

GridBox.h

Go to the documentation of this file.
00001 // -*- C++ -*-
00002 
00003 #ifndef _included_GridBox_h
00004 #define _included_GridBox_h
00005 
00011 #include "DAGHParams.h"
00012 #include "BBox.h"
00013 
00014 #include <iosfwd>
00015 #include <cstdlib>
00016 
00017 #define GridBoxNULL ((GridBox *) 0)
00018 
00025 class GridBox 
00026 {
00027   friend std::ostream& operator<<(std::ostream&, const GridBox&);
00028   friend std::ofstream& operator<<(std::ofstream&, const GridBox&);
00029   friend std::ifstream& operator>>(std::ifstream&, GridBox&);
00030   friend std::stringstream& operator<<(std::stringstream&, const GridBox&);
00031   friend std::stringstream& operator>>(std::stringstream&, GridBox&);
00032   friend class GridBoxList;
00033   
00035   short int owner;    
00037   short int index;
00038   
00039   // Added by Johan on July 28 2004
00040   BBox pbbox;                   /* Parent BBox */
00041   unsigned long sfcidx;         /* sfc index */
00042 
00044   BBox bbox; 
00045 
00046  public:
00047   /* Constructors, Destructor */
00048   inline GridBox(void) : owner(DAGHNoBody), index(DAGHNull) {}
00049   
00050   inline GridBox(const int own, const int idx, const BBox& bb)
00051     : owner(own), index(idx), bbox(bb) { }
00052 
00053    inline GridBox(GridBox const &other)
00054      : owner(other.owner), index(other.index), bbox(other.bbox) { }
00055 
00056    inline ~GridBox(void) {}
00057 
00058    inline GridBox const &operator= (GridBox const &other)
00059      { owner=other.owner; index=other.index;
00060        bbox=other.bbox; return (*this); }
00061 
00062    /* Define the comparison operators == and != */ 
00063    inline int operator == (GridBox const &other) const
00064      { return((index == other.index) && (owner == other.owner) && bbox == other.bbox); }
00065    inline int operator != (GridBox const &other) const 
00066      { return(!(*this == other)); } 
00067 
00068    inline void SetGridBox(const int own, const int idx, const BBox& bb)
00069      { owner=own; index=idx; bbox=bb; }
00070 
00071    /* Simple Query funtions */
00072    inline int gbOwner(void) const { return (owner); }
00073    inline int gbIndex(void) const { return (index); }
00074    inline int gbRank(void) const { return (bbox.rank); }
00075    inline void gbSetIndex(const int idx) { index = idx; }
00076    inline void gbSetOwner(const int p) { owner = p; }
00077    inline void gbSetBBox(const BBox& bb) { bbox = bb; }
00078 
00079    inline const BBox& gbBBox(void) const { return bbox; }
00080    BBox gbBBox(const int olap, const int extgh=0) const;
00081    BBox gbBBox(const short* olap, const int extgh=0) const;
00082 
00083 
00084 
00085   //Added by Johan on July 28 2004
00086   inline unsigned long gbSfcindex(void) const { return (sfcidx); }
00087   inline void gbSetSfcindex(unsigned long sfc) { sfcidx=sfc; }
00088 
00089   inline const BBox& gbPBBox() const { return pbbox; }
00090   inline void gbSetPBBox(const BBox& pbb) { pbbox=pbb; }
00091 
00092   };
00093 
00094 std::ostream&  operator << (std::ostream& os, const GridBox& gb);
00095 std::ofstream& operator << (std::ofstream& ofs, const GridBox& gb);
00096 std::ifstream& operator >> (std::ifstream& ifs, GridBox& gb);
00097 std::stringstream& operator << (std::stringstream& ofs, const GridBox& gb);
00098 
00099 std::stringstream& operator >> (std::stringstream& ifs, GridBox& gb);
00100 
00101 #endif
00102 
00103 
00104 

Generated on Fri Aug 24 13:00:29 2007 for AMROC's Hierachical Data Structures - by  doxygen 1.4.7