1 
2 // This file is part of the Alliance Project.
3 // Copyright (C) Laboratoire LIP6 - Departement ASIM
4 // Universite Pierre et Marie Curie
5 //
6 // The Alliance Project  is free software;  you can  redistribute it and/or
7 // modify  it  under the  terms  of  the  GNU  General  Public License  as
8 // published by  the Free  Software Foundation; either  version 2  of  the
9 // License, or (at your option) any later version.
10 //
11 // The Alliance Project  is distributed in the hope that it will be useful,
12 // but  WITHOUT  ANY  WARRANTY;  without  even  the  implied  warranty  of
13 // MERCHANTABILITY  or  FITNESS  FOR A  PARTICULAR PURPOSE.   See  the GNU
14 // General Public License for more details.
15 //
16 // You should have received a copy  of  the  GNU  General  Public  License
17 // along with  the Alliance Project;  if  not,  write to the  Free Software
18 // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19 //
20 //
21 // License-Tag
22 //
23 // Date   : 29/01/2004
24 // Author : Christophe Alexandre  <Christophe.Alexandre@lip6.fr>
25 //
26 // Authors-Tag
27 #ifndef __PSubRow_h
28 #define __PSubRow_h
29 
30 #include <iostream>
31 #include <fstream>
32 #include <vector>
33 #include <map>
34 #include "PContainer.h"
35 #include "PRow.h"
36 
37 class PBin;
38 class PToPlaceIns;
39 
40 class PSubRow : public PContainer {
41 
42     friend class PRow;
43 
44   public:
45    typedef vector <PBin*> PBins;
46    typedef map <double, unsigned> PBinsXMax;
47 
48   private:
49     PRow*		_row;
50     PBins               _bins;
51     PBinsXMax		_binsXMax;
52     double              _size;   // somme des Width des bins de la row
53     double              _capa;   // l'occupation ideale de la subrow
54     double		_max;	// seuil de la sousligne !!ne pas d�passer
55     unsigned            _nBins;  // Bins.size();
56 
57   public:
58     			PSubRow();
59     			~PSubRow();
60     void		Init(PRow* row, double y, double minx, double maxx, double margin, double maxbinwidth, double minbinwidth);
61     bool                InsertIns(PToPlaceIns& Ins, int BinNumber);
62     void                ForceIns(PToPlaceIns& Ins, int BinNumber);
GetOrientation()63     bool		GetOrientation() const		{ return _row->GetOrientation(); }
GetRow()64     PRow*		GetRow()			{ return _row; }
65     PBin&               GetBin(const double X);
GetBins()66     PBins&		GetBins()			{ return _bins; }
67     double              GetBinsSize() const;
68     double              GetBinsCapa() const;
69 
GetCapa()70     double		GetCapa() const                 { return _capa; }
GetSize()71     double              GetSize() const                 { return _size; }
GetMax()72     double		GetMax() const			{ return _max; }
73     unsigned		GetNIns() const;
74     double              GetBinCost() const;
AddSize(const double Value)75     void		AddSize(const double Value)     { _size += Value; }
76     unsigned		GetNBins() const;
77 
78     ostream&	Print(ostream& os) const;
79     ofstream&	Plot(ofstream& out) const;
80     ofstream&	PlotLabel(ofstream& out, unsigned TotalMoves) const;
81 };
82 #endif /* __PSubRow_h */
83