Re: rootcint: constants

From: Selim Issever (selim.issever@desy.de)
Date: Tue Jun 01 1999 - 19:19:16 MEST


Hi Rene,..

up to now I was tasked by a bunch of uninteressting but important stuff,..
therefor this late answer.

Rene Brun wrote:
> 
> Hi Selim,
> I could not run a complete test with your files. I am still missing
> Date.H.

I attached Date.H to this mail,..

[...  http://root.cern.ch/root/RootCintMan.html ...]

I will proceed with the [...] and also try Masaharu's advises.

Many, many Thanks!
Selim

-- 
Selim Issever | Tel: 040 8998-2843    +---- I'd horsewhip you --------
DESY-F15      | Fax: 040 8998-4033    +--------- if I had a horse. ---
Notkestr. 85  | selim.issever@desy.de +--------------- Groucho Marx --
22603 Hamburg/Germany   |  http://www.physik.uni-dortmund.de/~issevers

#ifndef Date_H
#define Date_H

#include <time.h>
// struct    tm {
//   int  tm_sec;   /* seconds after the minute - [0, 61] */
//                  /* for leap seconds */
//   int  tm_min;   /* minutes after the hour - [0, 59] */
//   int  tm_hour;  /* hour since midnight - [0, 23] */
//   int  tm_mday;  /* day of the month - [1, 31] */
//   int  tm_mon;   /* months since January - [0, 11] */
//   int  tm_year;  /* years since 1900 */
//   int  tm_wday;  /* days since Sunday - [0, 6] */
//   int  tm_yday;  /* days since January 1 - [0, 365] */
//   int  tm_isdst; /* flag for alternate daylight */
//                  /* savings time */
// };
#include "TObject.h"
#include "TList.h"


// === Date =============================================================
// format: year,month,day,hour,min,sec list of decimals, 
//         seperated by non decimals
class Date {
public:
  Date(char *aDateStr); 
  Date(time_t aSecs=0);

  void set(time_t aSecs);
  void set(const Date& aDate);
  void set(char  *aDateStr);

  void addSeconds(time_t aSecs);

  time_t GetSeconds() const;
  time_t GetDayStartSeconds() const;
  int    GetDayHours() const;
  double GetTimeInHoursFromDay() const;
  double GetTimeInHoursFromDayFromDate(Date *aDate) const;
  time_t GetTimeInSecondsFromDate(Date *aDate) const;
  const char*  GetAsString() const;
  const char*  GetAsMyString() const;

  // -- comparison operators
  bool   operator< (const Date& aDate) const;
  bool   operator> (const Date& aDate) const;
  bool   operator<=(const Date& aDate) const;
  bool   operator>=(const Date& aDate) const;
  bool   operator==(const Date& aDate) const;
  bool   operator!=(const Date& aDate) const;

private:
  void      updateString();
  char      pReturner[512];
  char      pReturner2[512];

  //struct tm pDate;
  time_t    pSecs;
};
const Date& max(const Date& aDate1, const Date& aDate2);
const Date& min(const Date& aDate1, const Date& aDate2);
// === DateRange ==========================================================
class DateRange : public TObject {
public:
  DateRange(time_t aStart=0, time_t aEnd=1);
  DateRange(const Date& aStart, const Date& aEnd);
  DateRange(char* aStart, char* aEnd);

  const Date& getStart() const;
  const Date& getEnd() const;

  bool  isOverlapping(const DateRange& aDR) const;
  bool  isntOverlapping(const DateRange& aDR) const;
  bool  containsTotally(const DateRange& aDR) const;
  void  merge(const DateRange& aDR); // not fool proove! may do something else than expected!
  DateRange*  cutOut(const DateRange& aDR); // not fool proove! may do something else than expected!
private:
  Date pStart;
  Date pEnd;
};
// === Date vs DateRange ==================================================
bool operator< (const Date& aDate, const DateRange& aDateRange);
bool operator> (const Date& aDate, const DateRange& aDateRange);
bool operator<=(const Date& aDate, const DateRange& aDateRange);
bool operator>=(const Date& aDate, const DateRange& aDateRange);
bool operator!=(const Date& aDate, const DateRange& aDateRange);
bool operator==(const Date& aDate, const DateRange& aDateRange);

// === DateRangeList ======================================================
class DateRangeList {
public:
  DateRangeList();
  ~DateRangeList();

  void include(DateRange &aDR);
  void exclude(DateRange &aDR);
  
  DateRange* init();
  DateRange* next();

  void       clear();

  void       show();
private:
  TList       pDRList;
  TObject*    pActDR;
  
};

#endif



This archive was generated by hypermail 2b29 : Tue Jan 04 2000 - 00:43:34 MET