Version: 8.3.0
YACS::ENGINE::AbstractPoint Class Referenceabstract

#include <AbstractPoint.hxx>

Inheritance diagram for YACS::ENGINE::AbstractPoint:
Collaboration diagram for YACS::ENGINE::AbstractPoint:

Public Member Functions

 AbstractPoint (AbstractPoint *father)
 
AbstractPointgetFather () const
 
AbstractPointgetGodFather ()
 
bool amIGod ()
 
void setFather (AbstractPoint *father)
 
bool isBegin ()
 
bool isLast ()
 
bool isSimplyLinkedBeforeAfter (BlocPoint *sop)
 
bool isSimplyLinkedAfterNullBefore (BlocPoint *sop)
 
bool isSimplyLinkedBeforeNullAfter (BlocPoint *sop)
 
LinkedBlocPointtryAsLink (BlocPoint *sop)
 
ForkBlocPointtryAsFork (BlocPoint *sop)
 
ForkBlocPointtryAsForkBis (BlocPoint *sop)
 
ForkBlocPointtryAsForkTer (BlocPoint *sop)
 
virtual NodegetFirstNode ()=0
 
virtual NodegetLastNode ()=0
 
virtual AbstractPointfindPointWithNode (Node *node)=0
 
virtual bool contains (Node *node)=0
 
virtual int getNumberOfNodes () const =0
 
virtual int getMaxLevelOfParallelism () const =0
 
virtual std::string getRepr () const =0
 
virtual ~AbstractPoint ()
 
bool isSimplyLinkedAfter (BlocPoint *sop, Node *node)
 
bool isSimplyLinkedBefore (BlocPoint *sop, Node *node)
 

Static Public Member Functions

static bool IsGatherB4Ext (Node *node)
 
static bool IsSimplyLinkedAfterExt (Node *node)
 
static bool IsScatterAfterExt (Node *node)
 
static bool IsSimplyLinkedBeforeExt (Node *node)
 
static bool IsNoLinksBefore (Node *node)
 
static bool IsNoLinksAfter (Node *node)
 
static NodeGetNodeB4 (Node *node)
 
static NodeGetNodeAfter (Node *node)
 
static AbstractPointGetDirectSonOf (AbstractPoint *refFather, AbstractPoint *sonOrLittleSon)
 
static bool IsCommonDirectSonOf (AbstractPoint *refFather, const std::list< OutGate * > &outgs, AbstractPoint *&ret)
 
static bool IsCommonDirectSonOf (AbstractPoint *refFather, const std::list< InGate * > &ings, AbstractPoint *&ret)
 

Protected Attributes

AbstractPoint_father
 

Detailed Description

Definition at line 40 of file AbstractPoint.hxx.

Constructor & Destructor Documentation

YACS::ENGINE::AbstractPoint::AbstractPoint ( AbstractPoint father)
inline

Definition at line 43 of file AbstractPoint.hxx.

43 :_father(father) { }
AbstractPoint::~AbstractPoint ( )
virtual

Definition at line 28 of file AbstractPoint.cxx.

29 {
30 }

Member Function Documentation

bool YACS::ENGINE::AbstractPoint::amIGod ( )
inline

Definition at line 46 of file AbstractPoint.hxx.

46 { return getGodFather()==0; }
virtual bool YACS::ENGINE::AbstractPoint::contains ( Node node)
pure virtual
virtual AbstractPoint* YACS::ENGINE::AbstractPoint::findPointWithNode ( Node node)
pure virtual
AbstractPoint * AbstractPoint::GetDirectSonOf ( AbstractPoint refFather,
AbstractPoint sonOrLittleSon 
)
static

Definition at line 292 of file AbstractPoint.cxx.

References getFather().

Referenced by YACS::ENGINE::BlocPoint::findPointWithNode(), and IsCommonDirectSonOf().

293 {
294  AbstractPoint *curFath(sonOrLittleSon->getFather()),*cur(sonOrLittleSon);
295  while(curFath && curFath!=refFather)
296  {
297  cur=curFath;
298  curFath=cur->getFather();
299  }
300  if(!curFath)
301  throw YACS::Exception("AbstractPoint::GetDirectSonOf : not in the same family !");
302  return cur;
303 }
AbstractPoint* YACS::ENGINE::AbstractPoint::getFather ( ) const
inline

Definition at line 44 of file AbstractPoint.hxx.

Referenced by GetDirectSonOf(), tryAsFork(), tryAsForkBis(), tryAsForkTer(), and tryAsLink().

44 { return _father; }
AbstractPoint * AbstractPoint::getGodFather ( )

Definition at line 32 of file AbstractPoint.cxx.

References _father, and getGodFather().

Referenced by getGodFather().

33 {
34  if(_father==0)
35  return this;
36  else
37  return _father->getGodFather();
38 }
virtual int YACS::ENGINE::AbstractPoint::getMaxLevelOfParallelism ( ) const
pure virtual
Node * AbstractPoint::GetNodeAfter ( Node node)
static

Definition at line 281 of file AbstractPoint.cxx.

References YACS::ENGINE::Node::getOutGate().

Referenced by tryAsFork(), tryAsForkBis(), and tryAsForkTer().

282 {
283  OutGate *oug(node->getOutGate());
284  std::list<InGate *> fl(oug->edSetInGate());
285  if(fl.size()>1)
286  throw Exception("AbstractPoint::GetNodeAfter : precond not OK !");
287  if(fl.size()==0)
288  return 0;
289  return (*fl.begin())->getNode();
290 }
Node * AbstractPoint::GetNodeB4 ( Node node)
static

Definition at line 270 of file AbstractPoint.cxx.

References YACS::ENGINE::Node::getInGate().

Referenced by tryAsFork(), tryAsForkBis(), and tryAsForkTer().

271 {
272  InGate *ing(node->getInGate());
273  std::list<OutGate *> bl(ing->getBackLinks());
274  if(bl.size()>1)
275  throw Exception("AbstractPoint::GetNodeB4 : precond not OK !");
276  if(bl.size()==0)
277  return 0;
278  return bl.front()->getNode();
279 }
virtual int YACS::ENGINE::AbstractPoint::getNumberOfNodes ( ) const
pure virtual
virtual std::string YACS::ENGINE::AbstractPoint::getRepr ( ) const
pure virtual
bool AbstractPoint::isBegin ( )

Definition at line 40 of file AbstractPoint.cxx.

References YACS::ENGINE::InGate::getBackLinks(), getFirstNode(), and YACS::ENGINE::Node::getInGate().

41 {
42  Node *beg(getFirstNode());
43  InGate *ing(beg->getInGate());
44  return ing->getBackLinks().empty();
45 }
bool AbstractPoint::IsCommonDirectSonOf ( AbstractPoint refFather,
const std::list< OutGate * > &  outgs,
AbstractPoint *&  ret 
)
static

Definition at line 305 of file AbstractPoint.cxx.

References findPointWithNode(), GetDirectSonOf(), and gui.CONNECTOR::ref().

Referenced by YACS::ENGINE::BlocPoint::getNodeAfter(), YACS::ENGINE::BlocPoint::getNodeB4(), isSimplyLinkedAfter(), and isSimplyLinkedBefore().

306 {
307  if(outgs.size()<1)
308  throw YACS::Exception("AbstractPoint::GetCommonDirectSonOf1 : not enough !");
309  std::list<OutGate *>::const_iterator it(outgs.begin());
310  OutGate *ref(*(it++));
311  AbstractPoint *ref2(GetDirectSonOf(refFather,refFather->findPointWithNode(ref->getNode())));
312  for(;it!=outgs.end();it++)
313  {
314  if(!ref2->contains((*it)->getNode()))
315  return false;
316  }
317  ret=ref2;
318  return true;
319 }
bool AbstractPoint::IsCommonDirectSonOf ( AbstractPoint refFather,
const std::list< InGate * > &  ings,
AbstractPoint *&  ret 
)
static

Definition at line 321 of file AbstractPoint.cxx.

References findPointWithNode(), GetDirectSonOf(), and gui.CONNECTOR::ref().

322 {
323  if(ings.size()<1)
324  throw YACS::Exception("AbstractPoint::GetCommonDirectSonOf2 : not enough !");
325  std::list<InGate *>::const_iterator it(ings.begin());
326  InGate *ref(*(it++));
327  AbstractPoint *ref2(GetDirectSonOf(refFather,refFather->findPointWithNode(ref->getNode())));
328  for(;it!=ings.end();it++)
329  {
330  if(!ref2->contains((*it)->getNode()))
331  return false;
332  }
333  ret=ref2;
334  return true;
335 }
bool AbstractPoint::IsGatherB4Ext ( Node node)
static

Definition at line 210 of file AbstractPoint.cxx.

References YACS::ENGINE::InGate::getBackLinks(), and YACS::ENGINE::Node::getInGate().

Referenced by tryAsLink().

211 {
212  InGate *ing(node->getInGate());
213  return ing->getBackLinks().size()!=1;
214 }
bool AbstractPoint::isLast ( )

Definition at line 47 of file AbstractPoint.cxx.

References YACS::ENGINE::OutGate::edSetInGate(), getLastNode(), and YACS::ENGINE::Node::getOutGate().

48 {
49  Node *endd(getLastNode());
50  OutGate *oug(endd->getOutGate());
51  return oug->edSetInGate().empty();
52 }
bool AbstractPoint::IsNoLinksAfter ( Node node)
static

Definition at line 264 of file AbstractPoint.cxx.

References YACS::ENGINE::OutGate::edSetInGate(), and YACS::ENGINE::Node::getOutGate().

Referenced by isSimplyLinkedBeforeNullAfter(), and tryAsForkTer().

265 {
266  OutGate *oug(node->getOutGate());
267  return oug->edSetInGate().size()==0;
268 }
bool AbstractPoint::IsNoLinksBefore ( Node node)
static

Definition at line 258 of file AbstractPoint.cxx.

References YACS::ENGINE::InGate::getBackLinks(), and YACS::ENGINE::Node::getInGate().

Referenced by isSimplyLinkedAfterNullBefore(), and tryAsForkBis().

259 {
260  InGate *ing(node->getInGate());
261  return ing->getBackLinks().size()==0;
262 }
bool AbstractPoint::IsScatterAfterExt ( Node node)
static

Definition at line 234 of file AbstractPoint.cxx.

References YACS::ENGINE::OutGate::edSetInGate(), and YACS::ENGINE::Node::getOutGate().

Referenced by tryAsLink().

235 {
236  OutGate *oug(node->getOutGate());
237  return oug->edSetInGate().size()!=1;
238 }
bool AbstractPoint::isSimplyLinkedAfter ( BlocPoint sop,
Node node 
)

Definition at line 216 of file AbstractPoint.cxx.

References YACS::ENGINE::Node::getOutGate(), and IsCommonDirectSonOf().

Referenced by isSimplyLinkedAfterNullBefore(), isSimplyLinkedBeforeAfter(), and tryAsLink().

217 {
218  OutGate *oug(node->getOutGate());
219  std::list<InGate *> ings(oug->edSetInGate());
220  if(ings.size()==1)
221  return true;
222  if(ings.size()==0)
223  return false;
224  AbstractPoint *dummy=0;
225  return IsCommonDirectSonOf(sop,ings,dummy);
226 }
bool AbstractPoint::IsSimplyLinkedAfterExt ( Node node)
static

Definition at line 228 of file AbstractPoint.cxx.

References YACS::ENGINE::OutGate::edSetInGate(), and YACS::ENGINE::Node::getOutGate().

Referenced by tryAsFork(), and tryAsForkBis().

229 {
230  OutGate *oug(node->getOutGate());
231  return oug->edSetInGate().size()<=1;
232 }
bool AbstractPoint::isSimplyLinkedAfterNullBefore ( BlocPoint sop)

Definition at line 60 of file AbstractPoint.cxx.

References getFirstNode(), getLastNode(), IsNoLinksBefore(), and isSimplyLinkedAfter().

61 {
62  Node *beg(getFirstNode()),*endd(getLastNode());
63  return IsNoLinksBefore(beg) && isSimplyLinkedAfter(sop,endd);
64 }
bool AbstractPoint::isSimplyLinkedBefore ( BlocPoint sop,
Node node 
)

Definition at line 240 of file AbstractPoint.cxx.

References YACS::ENGINE::Node::getInGate(), and IsCommonDirectSonOf().

Referenced by isSimplyLinkedBeforeAfter(), isSimplyLinkedBeforeNullAfter(), and tryAsLink().

241 {
242  InGate *ing(node->getInGate());
243  std::list<OutGate *> outgs(ing->getBackLinks());
244  if(outgs.size()==1)
245  return true;
246  if(outgs.size()==0)
247  return false;
248  AbstractPoint *dummy=0;
249  return IsCommonDirectSonOf(sop,outgs,dummy);
250 }
bool AbstractPoint::isSimplyLinkedBeforeAfter ( BlocPoint sop)

Definition at line 54 of file AbstractPoint.cxx.

References getFirstNode(), getLastNode(), isSimplyLinkedAfter(), and isSimplyLinkedBefore().

Referenced by tryAsLink().

55 {
56  Node *beg(getFirstNode()),*endd(getLastNode());
57  return isSimplyLinkedBefore(sop,beg) && isSimplyLinkedAfter(sop,endd);
58 }
bool AbstractPoint::IsSimplyLinkedBeforeExt ( Node node)
static

Definition at line 252 of file AbstractPoint.cxx.

References YACS::ENGINE::InGate::getBackLinks(), and YACS::ENGINE::Node::getInGate().

Referenced by tryAsFork(), and tryAsForkTer().

253 {
254  InGate *ing(node->getInGate());
255  return ing->getBackLinks().size()<=1;
256 }
bool AbstractPoint::isSimplyLinkedBeforeNullAfter ( BlocPoint sop)

Definition at line 66 of file AbstractPoint.cxx.

References getFirstNode(), getLastNode(), IsNoLinksAfter(), and isSimplyLinkedBefore().

67 {
68  Node *beg(getFirstNode()),*endd(getLastNode());
69  return IsNoLinksAfter(endd) && isSimplyLinkedBefore(sop,beg);
70 }
void YACS::ENGINE::AbstractPoint::setFather ( AbstractPoint father)
inline

Definition at line 47 of file AbstractPoint.hxx.

Referenced by YACS::ENGINE::BlocPoint::BlocPoint().

47 { _father=father; }
ForkBlocPoint * AbstractPoint::tryAsFork ( BlocPoint sop)

precondition : isSimplyLinkedBeforeAfter must return true on this.

Definition at line 129 of file AbstractPoint.cxx.

References YACS::ENGINE::BlocPoint::findPointWithNode(), getFather(), getFirstNode(), getLastNode(), YACS::ENGINE::BlocPoint::getListOfPoints(), GetNodeAfter(), GetNodeB4(), IsSimplyLinkedAfterExt(), and IsSimplyLinkedBeforeExt().

130 {
132  AbstractPoint *bb2(sop->findPointWithNode(bb)),*ee2(sop->findPointWithNode(ee));
133  //
134  const std::list<AbstractPoint *>& lp(sop->getListOfPoints());
135  std::list<AbstractPoint *> l; l.push_back(this);
136  for(std::list<AbstractPoint *>::const_iterator it=lp.begin();it!=lp.end();it++)
137  {
138  if(*it==this)
139  continue;
140  Node *curFirst((*it)->getFirstNode()),*curEnd((*it)->getLastNode());
141  if(!IsSimplyLinkedBeforeExt(curFirst) || !IsSimplyLinkedAfterExt(curEnd))
142  continue;
143  Node *curbb(GetNodeB4(curFirst)),*curee(GetNodeAfter(curEnd));
144  AbstractPoint *bb3(sop->findPointWithNode(curbb)),*ee3(sop->findPointWithNode(curee));
145  if(bb2==bb3 && ee2==ee3)
146  l.push_back(*it);
147  }
148  if(l.size()>1)
149  {
150  return new ForkBlocPoint(l,getFather());
151  }
152  else
153  return 0;
154 }
ForkBlocPoint * AbstractPoint::tryAsForkBis ( BlocPoint sop)

Definition at line 156 of file AbstractPoint.cxx.

References YACS::ENGINE::BlocPoint::findPointWithNode(), getFather(), getFirstNode(), getLastNode(), YACS::ENGINE::BlocPoint::getListOfPoints(), GetNodeAfter(), GetNodeB4(), IsNoLinksBefore(), and IsSimplyLinkedAfterExt().

157 {
159  AbstractPoint *ee2(sop->findPointWithNode(ee));
160  //
161  const std::list<AbstractPoint *>& lp(sop->getListOfPoints());
162  std::list<AbstractPoint *> l; l.push_back(this);
163  for(std::list<AbstractPoint *>::const_iterator it=lp.begin();it!=lp.end();it++)
164  {
165  if(*it==this)
166  continue;
167  Node *curFirst((*it)->getFirstNode()),*curEnd((*it)->getLastNode());
168  if(!IsNoLinksBefore(curFirst) || !IsSimplyLinkedAfterExt(curEnd))
169  continue;
170  Node *curee(GetNodeAfter(curEnd));
171  AbstractPoint *ee3(sop->findPointWithNode(curee));
172  if(ee2==ee3)
173  l.push_back(*it);
174  }
175  if(l.size()>1)
176  {
177  return new ForkBlocPoint(l,getFather());
178  }
179  else
180  return 0;
181 }
ForkBlocPoint * AbstractPoint::tryAsForkTer ( BlocPoint sop)

Definition at line 183 of file AbstractPoint.cxx.

References YACS::ENGINE::BlocPoint::findPointWithNode(), getFather(), getFirstNode(), getLastNode(), YACS::ENGINE::BlocPoint::getListOfPoints(), GetNodeAfter(), GetNodeB4(), IsNoLinksAfter(), and IsSimplyLinkedBeforeExt().

184 {
186  AbstractPoint *bb2(sop->findPointWithNode(bb));
187  //
188  const std::list<AbstractPoint *>& lp(sop->getListOfPoints());
189  std::list<AbstractPoint *> l; l.push_back(this);
190  for(std::list<AbstractPoint *>::const_iterator it=lp.begin();it!=lp.end();it++)
191  {
192  if(*it==this)
193  continue;
194  Node *curFirst((*it)->getFirstNode()),*curEnd((*it)->getLastNode());
195  if(!IsSimplyLinkedBeforeExt(curFirst) || !IsNoLinksAfter(curEnd))
196  continue;
197  Node *curbb(GetNodeB4(curFirst));
198  AbstractPoint *bb3(sop->findPointWithNode(curbb));
199  if(bb2==bb3)
200  l.push_back(*it);
201  }
202  if(l.size()>1)
203  {
204  return new ForkBlocPoint(l,getFather());
205  }
206  else
207  return 0;
208 }
LinkedBlocPoint * AbstractPoint::tryAsLink ( BlocPoint sop)

precondition : isSimplyLinkedBeforeAfter must return true on this.

Definition at line 75 of file AbstractPoint.cxx.

References getFather(), getFirstNode(), getLastNode(), YACS::ENGINE::BlocPoint::getNodeAfter(), YACS::ENGINE::BlocPoint::getNodeB4(), IsGatherB4Ext(), IsScatterAfterExt(), isSimplyLinkedAfter(), isSimplyLinkedBefore(), and isSimplyLinkedBeforeAfter().

76 {
77  Node *bb(getFirstNode()),*ee(getLastNode());
78  std::list<AbstractPoint *> l; l.push_back(this);
79  AbstractPoint *cur2(0);
80  //
81  cur2=sop->getNodeB4(bb);
82  while(cur2)
83  {
84  Node *cur3(cur2->getFirstNode());
85  if(cur2->isSimplyLinkedBeforeAfter(sop))
86  {
87  l.push_front(cur2);
88  cur2=sop->getNodeB4(cur3);
89  continue;
90  }
91  else if(IsGatherB4Ext(cur3) && isSimplyLinkedAfter(sop,cur2->getLastNode()))
92  {
93  l.push_front(cur2);
94  break;
95  }
96  else
97  break;
98  }
99  //
100  cur2=sop->getNodeAfter(ee);
101  while(cur2)
102  {
103  Node *cur3(cur2->getLastNode());
104  if(cur2->isSimplyLinkedBeforeAfter(sop))
105  {
106  l.push_back(cur2);
107  cur2=sop->getNodeAfter(cur3);
108  continue;
109  }
110  else if(IsScatterAfterExt(cur3) && isSimplyLinkedBefore(sop,cur2->getFirstNode()))
111  {
112  l.push_back(cur2);
113  break;
114  }
115  else
116  break;
117  }
118  if(l.size()>1)
119  {
120  return new LinkedBlocPoint(l,getFather());
121  }
122  else
123  return 0;
124 }

Member Data Documentation

AbstractPoint* YACS::ENGINE::AbstractPoint::_father
protected

Definition at line 83 of file AbstractPoint.hxx.

Referenced by getGodFather().


The documentation for this class was generated from the following files: