1 // Copyright (C) 2006-2015 CEA/DEN, EDF R&D
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either
6 // version 2.1 of the License, or (at your option) any later version.
8 // This library is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 // Lesser General Public License for more details.
13 // You should have received a copy of the GNU Lesser General Public
14 // License along with this library; if not, write to the Free Software
15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
20 #ifndef __LINKINFO_HXX__
21 #define __LINKINFO_HXX__
23 #include "YACSlibEngineExport.hxx"
24 #include "Exception.hxx"
41 class CollectorSwOutPort;
47 I_BACK = 43,//In loop context
48 I_BACK_USELESS = 44,//In loop context - Not implemented yet
49 I_BACK_CRAZY = 45,//Out of loop context
57 W_COLLAPSE_AND_USELESS = 142,
59 W_COLLAPSE_EL_AND_USELESS = 144,
60 W_BACK_COLLAPSE = 145,
61 W_BACK_COLLAPSE_AND_USELESS = 146,
62 W_BACK_COLLAPSE_EL = 147,
63 W_BACK_COLLAPSE_EL_AND_USELESS = 148,
69 E_NEVER_SET_INPUTPORT = 241,
70 E_ONLY_BACKWARD_DEFINED = 242,
71 E_DS_LINK_UNESTABLISHABLE = 243,
72 E_COLLAPSE_DFDS = 244,
74 E_UNPREDICTABLE_FED = 246,
80 * \brief Class that deal with list of \b semantics links for high level analysis.
82 class YACSLIBENGINE_EXPORT LinkInfo
87 unsigned char _levelOfInfo;
88 std::vector<InPort *> _unsetInPort;
89 std::vector<InPort *> _onlyBackDefined;
90 std::set< std::pair<Node *, Node *> > _uselessLinks;
91 std::map<InfoReason, std::vector< std::pair<OutPort *,InPort *> > > _infos;
92 std::map<WarnReason, std::vector< std::vector< std::pair<OutPort *,InPort *> > > > _collapse;
93 std::map<ErrReason, std::vector< std::pair<OutPort *,InPort *> > > _errors;
94 std::vector<CollectorSwOutPort *> _errorsOnSwitchCases;
96 LinkInfo(unsigned char level);
98 void startCollapseTransac();
99 void endCollapseTransac() throw(Exception);
100 void setPointOfView(ComposedNode *pov);
101 void pushInfoLink(OutPort *semStart, InPort *end, InfoReason reason);
102 void pushWarnLink(OutPort *semStart, InPort *end, WarnReason reason);
103 void pushErrLink(OutPort *semStart, InPort *end, ErrReason reason) throw(Exception);
104 void pushErrSwitch(CollectorSwOutPort *collector) throw(Exception);
105 void pushUselessCFLink(Node *start, Node *end);
106 void takeDecision() const throw(Exception);
107 //Typically methods for high level use.
108 std::string getGlobalRepr() const;
109 std::string getInfoRepr() const;
110 std::string getWarnRepr() const;
111 std::string getErrRepr() const;
112 bool areWarningsOrErrors() const;
113 unsigned getNumberOfInfoLinks(InfoReason reason) const;
114 unsigned getNumberOfWarnLinksGrp(WarnReason reason) const;
115 unsigned getNumberOfErrLinks(ErrReason reason) const;
116 std::set< std::pair<Node *, Node *> > getInfoUselessLinks() const;
117 std::pair<OutPort *, InPort *> getInfoLink(unsigned id, InfoReason reason) const;
118 std::vector< std::pair<OutPort *, InPort *> > getWarnLink(unsigned id, WarnReason reason) const;
119 std::pair<OutPort *, InPort *> getErrLink(unsigned id, ErrReason reason) const;
121 static std::string getStringReprOfI(InfoReason reason);
122 static std::string getStringReprOfW(WarnReason reason);
123 static std::string getStringReprOfE(ErrReason reason);
124 static std::string printThereIsAre(unsigned val, const std::string& other);
126 static const unsigned char ALL_STOP_ASAP = 1;
127 static const unsigned char ALL_DONT_STOP = 2;
128 static const unsigned char WARN_ONLY_DONT_STOP = 3;