yosys-master
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
SubCircuit::SolverWorker::NodeSet Struct Reference

Public Member Functions

 NodeSet (std::string graphId, int node1, int node2)
 
 NodeSet (std::string graphId, const std::vector< int > &nodes)
 
void extend (const NodeSet &other)
 
int extendCandidate (const NodeSet &other) const
 
bool operator< (const NodeSet &other) const
 
std::string to_string () const
 

Data Fields

std::string graphId
 
std::set< int > nodes
 

Detailed Description

Definition at line 1217 of file subcircuit.cc.

Constructor & Destructor Documentation

SubCircuit::SolverWorker::NodeSet::NodeSet ( std::string  graphId,
int  node1,
int  node2 
)
inline

Definition at line 1220 of file subcircuit.cc.

1220  {
1221  this->graphId = graphId;
1222  nodes.insert(node1);
1223  nodes.insert(node2);
1224  }
SubCircuit::SolverWorker::NodeSet::NodeSet ( std::string  graphId,
const std::vector< int > &  nodes 
)
inline

Definition at line 1225 of file subcircuit.cc.

1225  {
1226  this->graphId = graphId;
1227  for (int node : nodes)
1228  this->nodes.insert(node);
1229  }

Member Function Documentation

void SubCircuit::SolverWorker::NodeSet::extend ( const NodeSet other)
inline

Definition at line 1230 of file subcircuit.cc.

1230  {
1231  assert(this->graphId == other.graphId);
1232  for (int node : other.nodes)
1233  nodes.insert(node);
1234  }

+ Here is the caller graph for this function:

int SubCircuit::SolverWorker::NodeSet::extendCandidate ( const NodeSet other) const
inline

Definition at line 1235 of file subcircuit.cc.

1235  {
1236  if (graphId != other.graphId)
1237  return 0;
1238  int newNodes = 0;
1239  bool intersect = false;
1240  for (int node : other.nodes)
1241  if (nodes.count(node) > 0)
1242  intersect = true;
1243  else
1244  newNodes++;
1245  return intersect ? newNodes : 0;
1246  }
bool SubCircuit::SolverWorker::NodeSet::operator< ( const NodeSet other) const
inline

Definition at line 1247 of file subcircuit.cc.

1247  {
1248  if (graphId != other.graphId)
1249  return graphId < other.graphId;
1250  return nodes < other.nodes;
1251  }
std::string SubCircuit::SolverWorker::NodeSet::to_string ( ) const
inline

Definition at line 1252 of file subcircuit.cc.

1252  {
1253  std::string str = graphId + "(";
1254  bool first = true;
1255  for (int node : nodes) {
1256  str += my_stringf("%s%d", first ? "" : " ", node);
1257  first = false;
1258  }
1259  return str + ")";
1260  }
static std::string my_stringf(const char *fmt,...)
Definition: subcircuit.cc:38

+ Here is the call graph for this function:

Field Documentation

std::string SubCircuit::SolverWorker::NodeSet::graphId

Definition at line 1218 of file subcircuit.cc.

std::set<int> SubCircuit::SolverWorker::NodeSet::nodes

Definition at line 1219 of file subcircuit.cc.


The documentation for this struct was generated from the following file: