The Gaudi Framework  master (37c0b60a)
concurrency::ProductionAmbiguityFinder Class Reference

#include </builds/gaudi/Gaudi/GaudiHive/src/PRGraph/Visitors/Validators.h>

Inheritance diagram for concurrency::ProductionAmbiguityFinder:
Collaboration diagram for concurrency::ProductionAmbiguityFinder:

Public Member Functions

bool visitEnter (AlgorithmNode &) const override
 
bool visitEnter (DecisionNode &) const override
 
bool visit (DataNode &) override
 
bool visit (ConditionNode &) override
 
std::string reply () const
 
bool passed () const
 
void reset () override
 
virtual bool visit (DecisionNode &)
 
virtual bool visit (AlgorithmNode &)
 
virtual bool visit (DataNode &)
 
virtual bool visit (ConditionNode &)
 
virtual bool visitEnter (DecisionNode &) const
 
virtual bool visitEnter (AlgorithmNode &) const
 
virtual bool visitEnter (DataNode &) const
 
virtual bool visitEnter (ConditionNode &) const
 
- Public Member Functions inherited from concurrency::IGraphVisitor
virtual ~IGraphVisitor ()=default
 
virtual bool visit (DecisionNode &)
 
virtual bool visit (AlgorithmNode &)
 
virtual bool visitEnter (DataNode &) const
 
virtual bool visitEnter (ConditionNode &) const
 

Private Types

using visitor_book = std::map< DataNode *, std::set< AlgorithmNode *, CompareNodes< AlgorithmNode * > >, CompareNodes< DataNode * > >
 

Private Attributes

bool m_foundViolations { false }
 
visitor_book m_conditionalProducers
 
visitor_book m_unconditionalProducers
 

Detailed Description

Definition at line 132 of file Validators.h.

Member Typedef Documentation

◆ visitor_book

Member Function Documentation

◆ passed()

bool concurrency::ProductionAmbiguityFinder::passed ( ) const
inline

Definition at line 144 of file Validators.h.

144  {
146  []( const auto& pr ) { return pr.second.size() == 1; } );
147  }

◆ reply()

std::string concurrency::ProductionAmbiguityFinder::reply ( ) const

Definition at line 192 of file Validators.cpp.

192  {
193 
194  std::ostringstream status{ " No topology violations found in the DF realm" };
195 
196  if ( m_foundViolations ) {
197  status << " Conditional (C) and/or unconditional (U) topology violations found in the DF realm:\n\n";
198 
199  for ( const auto& upr : m_unconditionalProducers ) {
200 
201  // add unconditional violations to the report
202  status << " (U): " << upr.first->name() << " <---- |";
203  for ( const auto& algo : upr.second )
204  status << " " << algo->name() << " (U)"
205  << " |";
206 
207  // add conditional violations to the report
208  auto result = m_conditionalProducers.find( upr.first );
209  if ( result != m_conditionalProducers.end() ) {
210  for ( const auto& algo : result->second )
211  status << " " << algo->name() << " (C)"
212  << " |";
213  }
214 
215  status << "\n";
216  }
217 
218  // add remaining conditional violations to the report
219  for ( const auto& cpr : m_conditionalProducers ) {
220 
221  if ( m_unconditionalProducers.find( cpr.first ) != m_unconditionalProducers.end() ) continue;
222 
223  status << " (C): " << cpr.first->name() << " <---- |";
224  for ( const auto& algo : cpr.second )
225  status << " " << algo->name() << " (C)"
226  << " |";
227  status << "\n";
228  }
229  }
230 
231  return status.str();
232  }

◆ reset()

void concurrency::ProductionAmbiguityFinder::reset ( )
inlineoverridevirtual

Reimplemented from concurrency::IGraphVisitor.

Definition at line 148 of file Validators.h.

148  {
149  m_foundViolations = false;
152  }

◆ visit() [1/6]

virtual bool concurrency::IGraphVisitor::visit
inline

Definition at line 29 of file IGraphVisitor.h.

29 { return true; }

◆ visit() [2/6]

virtual bool concurrency::IGraphVisitor::visit
inline

Definition at line 35 of file IGraphVisitor.h.

35 { return true; }

◆ visit() [3/6]

bool concurrency::ProductionAmbiguityFinder::visit ( ConditionNode node)
overridevirtual

Reimplemented from concurrency::IGraphVisitor.

Definition at line 173 of file Validators.cpp.

173  {
174 
175  if ( node.getProducers().size() > 1 ) {
176 
177  if ( !m_foundViolations ) m_foundViolations = true;
178 
179  // all violations related to Condition Node are unconditional as
180  // Condition Algorithms are detached from the CF realm
181  for ( const auto& producer : node.getProducers() ) {
182  // register unconditional violation
183  auto pr = m_unconditionalProducers.try_emplace( &node );
184  pr.first->second.insert( producer );
185  }
186  }
187 
188  return true;
189  }

◆ visit() [4/6]

virtual bool concurrency::IGraphVisitor::visit
inline

Definition at line 32 of file IGraphVisitor.h.

32 { return true; }

◆ visit() [5/6]

bool concurrency::ProductionAmbiguityFinder::visit ( DataNode node)
overridevirtual

Reimplemented from concurrency::IGraphVisitor.

Definition at line 143 of file Validators.cpp.

143  {
144 
145  if ( node.getProducers().size() > 1 ) {
146 
147  if ( !m_foundViolations ) m_foundViolations = true;
148 
149  auto scout = ConditionalLineageFinder();
150 
151  for ( const auto& producer : node.getProducers() ) {
152 
153  producer->accept( scout );
154 
155  if ( scout.negative() ) {
156  // register unconditional violation
157  auto pr = m_unconditionalProducers.try_emplace( &node );
158  pr.first->second.insert( producer );
159  } else {
160  // register conditional violation
161  auto pr = m_conditionalProducers.try_emplace( &node );
162  pr.first->second.insert( producer );
163  }
164 
165  scout.reset();
166  }
167  }
168 
169  return true;
170  }

◆ visit() [6/6]

virtual bool concurrency::IGraphVisitor::visit
inline

Definition at line 26 of file IGraphVisitor.h.

26 { return true; }

◆ visitEnter() [1/6]

virtual bool concurrency::IGraphVisitor::visitEnter
inline

Definition at line 28 of file IGraphVisitor.h.

28 { return true; }

◆ visitEnter() [2/6]

bool concurrency::ProductionAmbiguityFinder::visitEnter ( AlgorithmNode ) const
inlineoverridevirtual

Reimplemented from concurrency::IGraphVisitor.

Definition at line 137 of file Validators.h.

137 { return false; }

◆ visitEnter() [3/6]

virtual bool concurrency::IGraphVisitor::visitEnter
inline

Definition at line 34 of file IGraphVisitor.h.

34 { return true; }

◆ visitEnter() [4/6]

virtual bool concurrency::IGraphVisitor::visitEnter
inline

Definition at line 31 of file IGraphVisitor.h.

31 { return true; }

◆ visitEnter() [5/6]

virtual bool concurrency::IGraphVisitor::visitEnter
inline

Definition at line 25 of file IGraphVisitor.h.

25 { return true; }

◆ visitEnter() [6/6]

bool concurrency::ProductionAmbiguityFinder::visitEnter ( DecisionNode ) const
inlineoverridevirtual

Reimplemented from concurrency::IGraphVisitor.

Definition at line 138 of file Validators.h.

138 { return false; }

Member Data Documentation

◆ m_conditionalProducers

visitor_book concurrency::ProductionAmbiguityFinder::m_conditionalProducers
private

Definition at line 159 of file Validators.h.

◆ m_foundViolations

bool concurrency::ProductionAmbiguityFinder::m_foundViolations { false }
private

Definition at line 155 of file Validators.h.

◆ m_unconditionalProducers

visitor_book concurrency::ProductionAmbiguityFinder::m_unconditionalProducers
private

Definition at line 160 of file Validators.h.


The documentation for this class was generated from the following files:
concurrency::ProductionAmbiguityFinder::m_conditionalProducers
visitor_book m_conditionalProducers
Definition: Validators.h:159
concurrency::ProductionAmbiguityFinder::m_foundViolations
bool m_foundViolations
Definition: Validators.h:155
std::map::find
T find(T... args)
std::all_of
T all_of(T... args)
std::map::clear
T clear(T... args)
concurrency::ProductionAmbiguityFinder::m_unconditionalProducers
visitor_book m_unconditionalProducers
Definition: Validators.h:160
std::ostringstream
STL class.
std::map::begin
T begin(T... args)
std::map::insert
T insert(T... args)
std::map::end
T end(T... args)