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

reporter.h

Go to the documentation of this file.
00001 // -*- C++ -*- 
00002 /*
00003 ** Copyright (C) 2000 Alan McIvor <alan@mcivor.gen.nz>
00004 **  
00005 ** This program is free software; you can redistribute it and/or modify
00006 ** it under the terms of the GNU General Public License as published by
00007 ** the Free Software Foundation; either version 2 of the License, or
00008 ** (at your option) any later version.
00009 ** 
00010 ** This program is distributed in the hope that it will be useful,
00011 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
00012 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00013 ** GNU General Public License for more details.
00014 ** 
00015 ** You should have received a copy of the GNU General Public License
00016 ** along with this program; if not, write to the Free Software 
00017 ** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
00018 */
00019 
00020 #ifndef REPORTER_H
00021 #define REPORTER_H
00022 
00023 #include "openschedException.h"
00024 #include "project.h"
00025 
00026 typedef struct NETWORK_CELL
00027 {
00028     int isSpace;
00029     TASK *task;
00030 
00031     struct NETWORK_CELL *prev;
00032     struct NETWORK_CELL *next;
00033 }
00034 NETWORK_CELL;
00035 
00036 
00037 class TASKGRAPH
00038 {
00039 public:
00040     TASKGRAPH(int s, int f, string &fn) : start(s), finish(f), filename(fn) {};
00041     int start;
00042     int finish;
00043     const string filename;
00044 };
00045 
00046 
00047 class TASKNET
00048 {
00049 public:
00050     TASKNET(int s, int f, string &fn) : start(s), finish(f), filename(fn) {};
00051     int start;
00052     int finish;
00053     const string filename;
00054 };
00055 
00056 
00057 class Reporter
00058 {
00059 public:
00060     
00061     typedef enum
00062     {
00063         TXT_REPORT,
00064         TEX_REPORT,
00065         HTML_REPORT
00066     }
00067     REPORTTYPE;
00068 
00069 # define VARIABLE(AA,BB,CC) AA BB;
00070 #include "reporter.i"
00071 
00072     Reporter();
00073     void DoReports( Project *project );
00074     void HTMLReport( Project *project, char *filename);
00075     void WeeklyReport( Project *project, char *filename, REPORTTYPE rep_type);
00076     void MonthlyReport( Project *project, char *filename, REPORTTYPE rep_type);
00077     void UtilGraph( Project *project, char *filename);
00078     void AddTaskGraph( int d1, int d2, char *fname );
00079     void AddNetworkDiagram(int c1, int c2, char *fname);
00080     void checkComplete();
00081     void SlippageReport( Project *project );
00082     void TextReport( Project *project, char *filename);
00083     void XMLReport( Project *project, char *filename);
00084     void HardSchedule( Project *project, char *filename);
00085     void TexReport( Project *project, char *filename);
00086     void PrintResourcePeriod( Project *project,
00087                               FILE *f, RESOURCE *r, int dayNo, int lastDay,
00088                               REPORTTYPE rep_type);
00089 
00090 private:
00091 
00092     typedef int (Reporter::* Pperfunc)(Project *project, int day, char *name);
00093 
00094     int Wday(time_t t);
00095     int Mday(time_t t);
00096     void PrintPeriod(Project *project,
00097                      FILE *f, int dayNo, int lastDay, char *weekName,
00098                      REPORTTYPE rep_type);
00099     void PeriodicReport( Project * project,
00100                          Pperfunc IsPeriod,
00101                          char *filename,
00102                          REPORTTYPE rep_type);
00103     int IsWeek(Project *project, int dayNo, char *name);
00104     int IsMonth(Project *project, int dayNo, char *name);
00105 
00106     void Debug(char *fmt, ...);
00107     void Error(char *fmt, ...);
00108     void Warning(char *fmt, ...);
00109     FILE *OpenOutputFile(char *filename);
00110     char *TeXFix(char *buf, const char *txt);
00111     char *HTMLFix(char *buf, const char *txt);
00112     int MapX( Project *project, int dayNo, int start, int finish);
00113     int Bound(int x, int x1, int x2);
00114     int Offset(int x, int x1, int x2 );
00115     FILE *OpenTaskGraph(const char *filename, int x1, int y1, int x2, int y2);
00116     void TaskGraph( Project *project, int start, int finish, const char *filename);
00117     FILE *openNetworkDiagram( Project *project, 
00118                               const char *filename, int llx, int lly, int urx, int ury);
00119     void write_milestones( Project *project, 
00120                            FILE *fp, int ax, int bx, int ay, int by);
00121     void write_chart( Project *project, int start, int finish, const char *filename);
00122     NETWORK_CELL *findCellInColumn(int x, const char *id);
00123     void NetworkDiagram( Project *project, int start, int finish, const char *filename);
00124     // network diagrams
00125     void constructStartFinish( Project *project );
00126     int maximumX(Project *project);
00127     void assignY(Project *project);
00128     TASK * mStartTask;
00129     TASK * mFinishTask;
00130     // cost reports
00131     void TeXCostReport(Project *project, FILE *f);
00132     void HTMLCostReport(Project *project, FILE *f);
00133     void CostReport(Project *project, char *filename, REPORTTYPE rep_type);
00134 
00135     char *monthNames[13];
00136     int Month(time_t t);
00137     int Year(time_t t);
00138 
00139     vector<TASKGRAPH *> mTaskGraphs;
00140     vector<TASKNET *> mTaskNets;
00141 };
00142 
00143 
00144 class ReporterException 
00145   : public OpenschedException
00146 {
00147 public:
00148     ReporterException( string reason );
00149     ~ReporterException();
00150 };
00151 
00152 #endif
00153 
00154 
00155 
00156 
00157 
00158 

Generated on Wed Feb 18 22:23:54 2004 for Opensched by doxygen1.2.15