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

resource.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 RESOURCE_H
00021 #define RESOURCE_H
00022 
00023 #include "namedid.h"
00024 #include "timeblock.h"
00025 #include "note.h"
00026 
00027 class RESOURCE : public NAMED_ID
00028 {
00029 public:
00030 
00031     typedef vector<RESOURCE *> PTRLIST;
00032 
00033     RESOURCE( char * id, char * name );
00034 
00035     double efficiency() { return mEfficiency; };
00036     void setEfficiency(double e);
00037     double rate();
00038     void setRate(double r);
00039     bool IsAvailable( int start, int finish );
00040     bool IsUsed( int dayNo );
00041     bool reverseIsAvailable( int start, int finish );
00042     void AddNote(const string & note);
00043     NOTE_ITERATOR begin_notes() { return mNotes.begin(); };
00044     NOTE_ITERATOR end_notes() { return mNotes.end(); };
00045 
00046     void addTimeBlock(TASK *r, int start, int finish, TimeBlock::Type type);
00047     ResourceTimeBlockIterator begin_booked()  { return mBooked.begin(); };
00048     ResourceTimeBlockIterator end_booked()  { return mBooked.end(); };
00049     void addReverseTimeBlock(TASK *r, int start, int finish, TimeBlock::Type type);
00050     ResourceTimeBlockIterator begin_rbooked()  { return mRbooked.begin(); };
00051     ResourceTimeBlockIterator end_rbooked()  { return mRbooked.end(); };
00052 
00053     // TO SORT OUT LATER
00054 //    bool isGroup() { return mIsGroup; };
00055     int is_group;
00056     PTRLIST belongs_to; 
00057     PTRLIST contains;   
00058 
00059     static void setDefaultRate(double rate);
00060     static double defaultRate() { return sDefaultRate; };
00061 
00062 private:
00063     double mEfficiency;                 
00064 //    bool mIsGroup;                    ///< is it a group?
00065     double mRate;                       
00066 
00067     NOTES mNotes;                       
00068 
00069     ResourceTimeBlockList mBooked;      // when is the resource available?
00070     ResourceTimeBlockList mRbooked;     // when is the resource available?
00071 
00072     void Error(char *fmt, ...);
00073 
00074     static double sDefaultRate;         
00075 };
00076 
00077 #endif

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