From: Matthew Fernandez Date: Sat, 7 Nov 2020 21:27:58 +0000 (-0800) Subject: remove use of std::endl in VPSC X-Git-Tag: 2.46.0~13^2 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=4bf2972508d4abf0547036fa7a465848bf09ca6d;p=graphviz remove use of std::endl in VPSC Use of std::endl is generally considered an anti-pattern these days. --- diff --git a/lib/vpsc/block.cpp b/lib/vpsc/block.cpp index cb1dfae99..a6537cc8d 100644 --- a/lib/vpsc/block.cpp +++ b/lib/vpsc/block.cpp @@ -24,7 +24,6 @@ #include using std::ios; using std::ofstream; -using std::endl; using std::vector; #ifndef RECTANGLE_OVERLAP_LOGGING @@ -90,7 +89,7 @@ void Block::setUpConstraintHeap(PairingHeap* &h,bool in) { void Block::merge(Block* b, Constraint* c) { if (RECTANGLE_OVERLAP_LOGGING) { ofstream f(LOGFILE,ios::app); - f<<" merging on: "<<*c<<",c->left->offset="<left->offset<<",c->right->offset="<right->offset<left->offset="<left->offset<<",c->right->offset="<right->offset<<"\n"; } double dist = c->right->offset - c->left->offset - c->gap; Block *l=c->left->block; @@ -102,7 +101,7 @@ void Block::merge(Block* b, Constraint* c) { } if (RECTANGLE_OVERLAP_LOGGING) { ofstream f(LOGFILE,ios::app); - f<<" merged block="<<(b->deleted?*this:*b)<active=true; wposn+=b->wposn-dist*b->weight; @@ -133,7 +132,7 @@ void Block::merge(Block *b, Constraint *c, double dist) { void Block::mergeIn(Block *b) { if (RECTANGLE_OVERLAP_LOGGING) { ofstream f(LOGFILE,ios::app); - f<<" merging constraint heaps... "<merge(b->in); if (RECTANGLE_OVERLAP_LOGGING) { ofstream f(LOGFILE,ios::app); - f<<" merged heap: "<<*in<slack()<0) { ofstream f(LOGFILE,ios::app); - f<<" violated internal constraint found! "<<*v<deleteMin(); if (RECTANGLE_OVERLAP_LOGGING) { ofstream f(LOGFILE,ios::app); - f<<" ... skipping internal constraint"<timeStamp < lb->timeStamp) { // block at other end of constraint has been moved since this @@ -181,7 +180,7 @@ Constraint *Block::findMinInConstraint() { outOfDate.push_back(v); if (RECTANGLE_OVERLAP_LOGGING) { ofstream f(LOGFILE,ios::app); - f<<" reinserting out of date (reinsert later)"<deleteMin(); if (RECTANGLE_OVERLAP_LOGGING) { ofstream f(LOGFILE,ios::app); - f<<"deleteMinInConstraint... "< using std::ios; using std::ofstream; -using std::endl; using std::set; using std::vector; using std::iterator; @@ -82,7 +81,7 @@ void Blocks::dfsVisit(Variable *v, list *order) { } if (RECTANGLE_OVERLAP_LOGGING) { ofstream f(LOGFILE,ios::app); - f<<" order="<<*v<push_front(v); } @@ -93,7 +92,7 @@ void Blocks::dfsVisit(Variable *v, list *order) { void Blocks::mergeLeft(Block *r) { if (RECTANGLE_OVERLAP_LOGGING) { ofstream f(LOGFILE,ios::app); - f<<"mergeLeft called on "<<*r<timeStamp=++blockTimeCtr; r->setUpInConstraints(); @@ -101,7 +100,7 @@ void Blocks::mergeLeft(Block *r) { while (c != NULL && c->slack()<0) { if (RECTANGLE_OVERLAP_LOGGING) { ofstream f(LOGFILE,ios::app); - f<<"mergeLeft on constraint: "<<*c<deleteMinInConstraint(); Block *l = c->left->block; @@ -120,7 +119,7 @@ void Blocks::mergeLeft(Block *r) { } if (RECTANGLE_OVERLAP_LOGGING) { ofstream f(LOGFILE,ios::app); - f<<"merged "<<*r<setUpOutConstraints(); Constraint *c = l->findMinOutConstraint(); while (c != NULL && c->slack()<0) { if (RECTANGLE_OVERLAP_LOGGING) { ofstream f(LOGFILE,ios::app); - f<<"mergeRight on constraint: "<<*c<deleteMinOutConstraint(); Block *r = c->right->block; @@ -153,7 +152,7 @@ void Blocks::mergeRight(Block *l) { } if (RECTANGLE_OVERLAP_LOGGING) { ofstream f(LOGFILE,ios::app); - f<<"merged "<<*l<split(l,r,c); if (RECTANGLE_OVERLAP_LOGGING) { ofstream f(LOGFILE,ios::app); - f<<"Split left: "<<*l<posn = b->posn; r->wposn = r->posn * r->weight; diff --git a/lib/vpsc/csolve_VPSC.cpp b/lib/vpsc/csolve_VPSC.cpp index 0676d7353..716c30dee 100644 --- a/lib/vpsc/csolve_VPSC.cpp +++ b/lib/vpsc/csolve_VPSC.cpp @@ -94,7 +94,7 @@ void satisfyVPSC(VPSC* vpsc) { try { vpsc->satisfy(); } catch(const char *e) { - std::cerr << e << std::endl; + std::cerr << e << "\n"; std::exit(1); } } diff --git a/lib/vpsc/remove_rectangle_overlap.cpp b/lib/vpsc/remove_rectangle_overlap.cpp index ff94baef7..ca649616d 100644 --- a/lib/vpsc/remove_rectangle_overlap.cpp +++ b/lib/vpsc/remove_rectangle_overlap.cpp @@ -25,7 +25,6 @@ #include using std::ios; using std::ofstream; -using std::endl; #ifndef RECTANGLE_OVERLAP_LOGGING #define RECTANGLE_OVERLAP_LOGGING 0 @@ -66,7 +65,7 @@ void removeRectangleOverlap(int n, Rectangle *rs[], double xBorder, double yBord VPSC vpsc_x(n,vs,m,cs); if (RECTANGLE_OVERLAP_LOGGING) { ofstream f(LOGFILE,ios::app); - f<<"Calling VPSC: Horizontal pass 1"< using std::ios; using std::ofstream; -using std::endl; using std::ostringstream; using std::list; @@ -60,10 +59,10 @@ void VPSC::printBlocks() { ofstream f(LOGFILE,ios::app); for(set::iterator i=bs->begin();i!=bs->end();i++) { Block *b=*i; - f<<" "<<*b<slack()<-0.0000001) { if (RECTANGLE_OVERLAP_LOGGING) { ofstream f(LOGFILE,ios::app); - f<<"Error: Unsatisfied constraint: "<<*cs[i]<slack()>-0.0000001); throw "Unsatisfied constraint"; @@ -118,7 +117,7 @@ void VPSC::refine() { if(c!=NULL && c->lm<0) { if (RECTANGLE_OVERLAP_LOGGING) { ofstream f(LOGFILE,ios::app); - f<<"Split on constraint: "<<*c<cost(); do { @@ -161,7 +160,7 @@ void IncVPSC::solve() { cost = bs->cost(); if (RECTANGLE_OVERLAP_LOGGING) { ofstream f(LOGFILE,ios::app); - f<<" cost="<0.0001); } @@ -181,7 +180,7 @@ void IncVPSC::solve() { void IncVPSC::satisfy() { if (RECTANGLE_OVERLAP_LOGGING) { ofstream f(LOGFILE,ios::app); - f<<"satisfy_inc()..."<cleanup(); for(unsigned i=0;i::const_iterator i(bs->begin());i!=bs->end();i++) { Block *b = *i; @@ -233,7 +232,7 @@ void IncVPSC::moveBlocks() { } if (RECTANGLE_OVERLAP_LOGGING) { ofstream f(LOGFILE,ios::app); - f<<" moved blocks."<lm < -0.0000001) { if (RECTANGLE_OVERLAP_LOGGING) { ofstream f(LOGFILE,ios::app); - f<<" found split point: "<<*v<<" lm="<lm<left->block, *l=NULL, *r=NULL; @@ -262,13 +261,13 @@ void IncVPSC::splitBlocks() { inactive.push_back(v); if (RECTANGLE_OVERLAP_LOGGING) { ofstream f(LOGFILE,ios::app); - f<<" new blocks: "<<*l<<" and "<<*r<cleanup(); } @@ -281,7 +280,7 @@ double IncVPSC::mostViolated(ConstraintList &l, Constraint* &v) { double minSlack = DBL_MAX; if (RECTANGLE_OVERLAP_LOGGING) { ofstream f(LOGFILE,ios::app); - f<<"Looking for most violated..."<