00001 #ifndef CDBBDBSHARED_CELL_HH 00002 #define CDBBDBSHARED_CELL_HH 00003 00004 // File and Version Information: 00005 // $Id: CdbBdbSCell.hh,v 1.4 2004/08/06 05:54:24 bartoldu Exp $ 00006 00007 #include "BdbUtil/Bdb.hh" 00008 00009 #include "CdbBase/CdbCommon.hh" 00010 00011 #include "BdbTime/BdbTime.hh" 00012 00013 #include <iostream> 00014 00015 /// Object of this class represent "cells" 00016 /** 00017 * Objects of this embedded class represent a "cell" in 2-dimesion space 00018 * of the VALIDITY and INSERTION timelines. Each cell is described by its 00019 * range it spans in both dimensions. 00020 * 00021 * The surface occupied by a cell has the following semantics: 00022 * 00023 * [ beginValidity , endValidity ) 00024 * [ beginInsertion , endInsertion ) 00025 * 00026 * INSERTION 00027 * : ........ 00028 * : # . 00029 * : # . 00030 * : ######## 00031 * ..............VALIDITY 00032 */ 00033 class CdbBdbSCell { 00034 00035 public: 00036 00037 // Default and normal constructors 00038 00039 CdbBdbSCell( const BdbTime& theBeginValidity = BdbTime::minusInfinity, 00040 const BdbTime& theEndValidity = BdbTime::plusInfinity, 00041 const BdbTime& theBeginInsertion = BdbTime::minusInfinity, 00042 const BdbTime& theEndInsertion = BdbTime::plusInfinity ); 00043 00044 /// Copy constructor 00045 00046 CdbBdbSCell( const CdbBdbSCell& theCell ); 00047 00048 /// The destructor 00049 /** 00050 * NOTE: The destructor is NOT virtual because this is an embedded 00051 * class. 00052 */ 00053 ~CdbBdbSCell( ); 00054 00055 /// The assignment operator 00056 /** 00057 */ 00058 CdbBdbSCell& operator=( const CdbBdbSCell& theCell ); 00059 00060 /// Close the cell at specified point of the INSERTION timeline 00061 /** 00062 * The specified time must be strictly greater than the "bottom" insertion time 00063 * of the cell and be less or eqal to the "topmost" time. Otherwise the method will 00064 * abort the execution of an application. 00065 */ 00066 void close( const BdbTime& theTime ); 00067 00068 /// The "equal" operator 00069 00070 bool operator==( const CdbBdbSCell& theCell ) const; 00071 00072 /// The "not-equal" operator 00073 00074 inline bool operator!=( const CdbBdbSCell& theCell ) const 00075 { 00076 return ! operator==( theCell ); 00077 } 00078 00079 /// Check if specified point is inside the current cell 00080 00081 bool in( const BdbTime& theValidityTime, 00082 const BdbTime& theInsertionTime ) const; 00083 00084 /// Check if specified validity time is inside the validity range of the current cell 00085 00086 bool inValidityRange( const BdbTime& theTime ) const; 00087 00088 /// Check if specified cell overlaps with the current one 00089 /** 00090 * DEFINITION: Two cells are said to be "overlapped" when and only 00091 * when the area of their intersection is more than 0. 00092 * 00093 * Please, take into account the definition of the cell given at 00094 * the beginning of this file. 00095 */ 00096 bool overlap( const CdbBdbSCell& theCell ) const; 00097 00098 /// Dump the object contents into a stream 00099 00100 void dump( std::ostream& o ) const; 00101 00102 public: 00103 00104 // Non-mutable data members initialized by the constructor only 00105 00106 const BdbTime beginValidity; 00107 const BdbTime endValidity; 00108 const BdbTime beginInsertion; 00109 const BdbTime endInsertion; 00110 }; 00111 00112 inline std::ostream& 00113 operator<<( std::ostream& o, 00114 const CdbBdbSCell& theCell ) 00115 { 00116 theCell.dump( o ); 00117 return o; 00118 } 00119 00120 #endif // CDBBDBSHARED_CELL_HH
1.3-rc3