DiaDes  0.1
DIAgnosis of Discrete-Event System
Classes | Public Types | Public Member Functions | Static Public Member Functions | Private Types | Private Attributes | List of all members
Diades::Automata::Topology Class Reference

#include <Topology.hh>

Classes

struct  CliqueIterator
 

Public Types

typedef Diades::Graph::Node Connection
 
typedef Diades::Graph::Node Node
 
typedef unordered_set< Connection >::const_iterator ConnectionIterator
 
typedef unordered_set< Node >::const_iterator NodeIterator
 
typedef Diades::Utils::Exception< TopologyException
 
typedef CliqueIterator NodeConnectionIterator
 

Public Member Functions

Node getNodeOfName (const Identifier &name) const
 
void setNodeName (Node node, const Identifier &name)
 
const IdentifiergetNodeName (Node node) const
 
const IdentifiergetConnectionLabel (Connection connection) const
 
void setConnectionLabel (Connection connection, const Identifier &label)
 
unsigned numberOfNodes () const
 
unsigned numberOfConnections () const
 
bool isSimple (const Connection &connection) const
 
Connection addConnection (Node n1, Node n2)
 
Connection addConnection (Node n1, Node n2, const Identifier &label)
 
unsigned cliqueSize (Connection connection) const
 
CliqueIterator cliqueBegin (Connection connection) const
 
CliqueIterator cliqueEnd (Connection connection) const
 
ConnectionIterator connectionBegin () const
 
ConnectionIterator connectionEnd () const
 
 Topology ()
 
virtual ~Topology ()
 
unsigned nbConnections (const Node &n1, const Node &n2) const
 
unsigned connectivity (const Node &n) const
 
unsigned structuralConnectivity (const Node &n) const
 
bool isConnected (const Node &n1, const Node &n2) const
 
void getConnections (const Node &n1, const Node &n2, list< Connection > &connections) const
 
Connection addClique (const set< Node > &clique)
 
Node addNode ()
 
Node addNode (const Identifier &name)
 
NodeIterator nodeBegin () const
 
NodeIterator nodeEnd () const
 
NodeConnectionIterator nodeConnectionBegin (Node n) const
 
NodeConnectionIterator nodeConnectionEnd (Node n) const
 
void removeConnection (Connection connection)
 
void removeNode (Node n)
 
void topology2dot (const string &fileName)
 
void clear ()
 
void import (const string &fileName)
 
void save (const string &fileName)
 
bool valid () const
 
bool operator== (const Topology &topology) const
 
bool contains (Node node) const
 
const Graphgraph () const
 

Static Public Member Functions

static string typeName ()
 

Private Types

typedef Diades::Graph::Graph Graph
 
typedef Diades::Graph::Edge Edge
 

Private Attributes

Graph _graph
 
unordered_set< Connection_connections
 
unordered_set< Node_nodes
 
Diades::Graph::NodeMap< Identifier_labels
 

Detailed Description

This class implements toplogies. A Topology is composed of a set of nodes and a set of connections Here, a node corresponds to a component and a connection corresponds to a synchronisation. Basically, a Topology is represented by a Graph (see Grph::Graph). A node is represented by a Node (Grph::Node) and a Connection is represented by a Node and a set of Edge linking the Connection node to the nodes representing the components. By doing so, a Connection may involve more than two component Node. A set of iterators are also defined (namely ConnectionIterator, NodeIterator, CliqueIterator and NodeConnectionIterator). A ConnectionIterator iterates over the set of Connections of the Topology. A NodeIterator iterates over the component nodes. A CliqueIterator iterates over the clique of component nodes involved in the same Connection. And finally, a NodeConnectionIterator iterates over the Connections linked to a given component Node.

Definition at line 35 of file Topology.hh.

Member Typedef Documentation

◆ Connection

Definition at line 38 of file Topology.hh.

◆ ConnectionIterator

typedef unordered_set<Connection>::const_iterator Diades::Automata::Topology::ConnectionIterator

Definition at line 40 of file Topology.hh.

◆ Edge

Definition at line 45 of file Topology.hh.

◆ Exception

Definition at line 53 of file Topology.hh.

◆ Graph

Definition at line 44 of file Topology.hh.

◆ Node

Definition at line 39 of file Topology.hh.

◆ NodeConnectionIterator

Definition at line 166 of file Topology.hh.

◆ NodeIterator

typedef unordered_set<Node>::const_iterator Diades::Automata::Topology::NodeIterator

Definition at line 41 of file Topology.hh.

Constructor & Destructor Documentation

◆ Topology()

Diades::Automata::Topology::Topology ( )
inline

Default contructor, make an empty Topology

Definition at line 323 of file Topology.hh.

References Diades::Graph::NodeMap< T >::init().

◆ ~Topology()

virtual Diades::Automata::Topology::~Topology ( )
inlinevirtual

Member Function Documentation

◆ addClique()

Connection Diades::Automata::Topology::addClique ( const set< Node > &  clique)

Create a new connection involving the nodes of 'clique'

Parameters
clique
Returns
the created Connection

Referenced by ~Topology().

◆ addConnection() [1/2]

Connection Diades::Automata::Topology::addConnection ( Node  n1,
Node  n2 
)

Add a new Connection between the Node n1 and the Node n2

Parameters
n1
n2
Returns
the created Connection

Referenced by isSimple().

◆ addConnection() [2/2]

Connection Diades::Automata::Topology::addConnection ( Node  n1,
Node  n2,
const Identifier label 
)

Add a new Connection between the Node n1 and the Node n2 with a label

Parameters
n1
n2
label
Returns
the created Connection

◆ addNode() [1/2]

Node Diades::Automata::Topology::addNode ( )
inline

Add a new component node to the Topology (automatic generation of the name

Returns
the new Node

Definition at line 398 of file Topology.hh.

References ensure, and graph().

Referenced by main().

◆ addNode() [2/2]

Node Diades::Automata::Topology::addNode ( const Identifier name)
inline

Add a new component node to the Topology

Returns
the new Node

Definition at line 424 of file Topology.hh.

References ensure, and graph().

◆ clear()

void Diades::Automata::Topology::clear ( )

Clear the Topology

Referenced by removeConnection().

◆ cliqueBegin()

CliqueIterator Diades::Automata::Topology::cliqueBegin ( Connection  connection) const
inline

Start iterator on the clique of the Connection connection. The clique is the set of nodes involved in the Connection

Parameters
connection
Returns
a start iterator over the clique of the Connection 'connection'

Definition at line 258 of file Topology.hh.

References Diades::Automata::Topology::CliqueIterator::CliqueIterator(), graph(), and require.

Referenced by Diades::Automata::ConnectionMap::ConnectionMap(), getOutputProjection(), getSynchronisedInteraction(), and main().

◆ cliqueEnd()

CliqueIterator Diades::Automata::Topology::cliqueEnd ( Connection  connection) const
inline

End iterator on the clique of the Connection connection. The clique is the set of nodes involved in the Connection

Parameters
connection
Returns
a end iterator over the clique of the Connection 'connection'

Definition at line 279 of file Topology.hh.

References Diades::Automata::Topology::CliqueIterator::CliqueIterator(), graph(), and require.

Referenced by Diades::Automata::ConnectionMap::ConnectionMap(), getOutputProjection(), getSynchronisedInteraction(), and main().

◆ cliqueSize()

unsigned Diades::Automata::Topology::cliqueSize ( Connection  connection) const
inline
Parameters
connectiona connection
Returns
the size of the clique induced by the connection

Definition at line 243 of file Topology.hh.

◆ connectionBegin()

ConnectionIterator Diades::Automata::Topology::connectionBegin ( ) const
inline

Start iterator on the connections

Returns
a start iterator on the connections

Definition at line 304 of file Topology.hh.

Referenced by main().

◆ connectionEnd()

ConnectionIterator Diades::Automata::Topology::connectionEnd ( ) const
inline

End iterator on the connections

Returns
an end iterator on the connections

Definition at line 314 of file Topology.hh.

Referenced by main().

◆ connectivity()

unsigned Diades::Automata::Topology::connectivity ( const Node n) const

Connectivity of a Node n

Parameters
na Node
Returns
the number of connections involving the node n. If there are 2 connections involving Node n annd another node n2 the connectivity between n and n2 is 2

Referenced by checkEventConsistency(), main(), and ~Topology().

◆ contains()

bool Diades::Automata::Topology::contains ( Node  node) const
inline

◆ getConnectionLabel()

const Identifier& Diades::Automata::Topology::getConnectionLabel ( Connection  connection) const
inline

Definition at line 114 of file Topology.hh.

References graph(), and require.

Referenced by main().

◆ getConnections()

void Diades::Automata::Topology::getConnections ( const Node n1,
const Node n2,
list< Connection > &  connections 
) const
Parameters
n1a Node
n2a Node
connectionsthe returned list of connections involving n1 and n2

Referenced by ~Topology().

◆ getNodeName()

const Identifier& Diades::Automata::Topology::getNodeName ( Node  node) const
inline

Definition at line 98 of file Topology.hh.

References graph(), and require.

Referenced by generateSharedEvents(), getOutputProjection(), getSynchronisedInteraction(), and main().

◆ getNodeOfName()

Node Diades::Automata::Topology::getNodeOfName ( const Identifier name) const
inline

Definition at line 55 of file Topology.hh.

References nodeBegin(), and nodeEnd().

◆ graph()

const Graph& Diades::Automata::Topology::graph ( ) const
inline

◆ import()

void Diades::Automata::Topology::import ( const string &  fileName)

Import the Topology from a file with the following format

    p top nbComponent nbConnection
    label1: node1, node2;
    label2: node1, node3, node4;
    ...
Parameters
fileName
Todo:
incorporate the comments in the input language
c this is a comment 

Referenced by main().

◆ isConnected()

bool Diades::Automata::Topology::isConnected ( const Node n1,
const Node n2 
) const
Returns
true if n1 and n2 share at least one connection

Referenced by ~Topology().

◆ isSimple()

bool Diades::Automata::Topology::isSimple ( const Connection connection) const
inline

Is the Connection simple or not

Parameters
connectiona Connection
Returns
true if the Connection connection involves only two nodes

Definition at line 202 of file Topology.hh.

References addConnection(), graph(), and require.

◆ nbConnections()

unsigned Diades::Automata::Topology::nbConnections ( const Node n1,
const Node n2 
) const

Number of connections involving Node n1 and Node n2

Parameters
n1
n2
Returns
Number of connections involving Node n1 and Node n2

Referenced by ~Topology().

◆ nodeBegin()

NodeIterator Diades::Automata::Topology::nodeBegin ( ) const
inline

Start iterator on the component nodes

Returns
Start iterator on the component nodes

Definition at line 447 of file Topology.hh.

Referenced by checkEventConsistency(), generateBehaviour(), generateSharedEvents(), getNodeOfName(), and main().

◆ nodeConnectionBegin()

NodeConnectionIterator Diades::Automata::Topology::nodeConnectionBegin ( Node  n) const
inline

Start iterator on the connection in which the node n is involved

Parameters
n
Returns
Start iterator on the connection in which the node n is involved

Definition at line 469 of file Topology.hh.

References graph(), and require.

Referenced by generateSharedEvents(), getOutputProjection(), getSynchronisedInteraction(), main(), and Diades::Automata::SubConfiguration::SubConfiguration().

◆ nodeConnectionEnd()

NodeConnectionIterator Diades::Automata::Topology::nodeConnectionEnd ( Node  n) const
inline

End iterator on the connection in which the node n is involved

Parameters
n
Returns
End iterator on the connection in which the node n is involved

Definition at line 489 of file Topology.hh.

References graph(), and require.

Referenced by generateSharedEvents(), getOutputProjection(), getSynchronisedInteraction(), main(), and Diades::Automata::SubConfiguration::SubConfiguration().

◆ nodeEnd()

NodeIterator Diades::Automata::Topology::nodeEnd ( ) const
inline

End iterator on the component nodes

Returns
End iterator on the component nodes

Definition at line 457 of file Topology.hh.

Referenced by checkEventConsistency(), generateBehaviour(), generateSharedEvents(), getNodeOfName(), and main().

◆ numberOfConnections()

unsigned Diades::Automata::Topology::numberOfConnections ( ) const
inline
Returns
the number of connections in the topology

Definition at line 188 of file Topology.hh.

Referenced by main().

◆ numberOfNodes()

unsigned Diades::Automata::Topology::numberOfNodes ( ) const
inline
Returns
the number of nodes in the topology

Definition at line 177 of file Topology.hh.

Referenced by main(), and valid().

◆ operator==()

bool Diades::Automata::Topology::operator== ( const Topology topology) const
inline
Returns
true if both topology are actually the same one (reference equality)

Definition at line 575 of file Topology.hh.

◆ removeConnection()

void Diades::Automata::Topology::removeConnection ( Connection  connection)
inline

Remove the Connection 'connection'

Parameters
connection

Definition at line 507 of file Topology.hh.

References clear(), graph(), removeNode(), require, save(), and topology2dot().

◆ removeNode()

void Diades::Automata::Topology::removeNode ( Node  n)

Remove the component Node 'n'. Any associated Connection is also totally removed

Parameters
n

Referenced by removeConnection().

◆ save()

void Diades::Automata::Topology::save ( const string &  fileName)

Save the Topology into a file with the following format

     p top nbComponent nbConnection
    label1: node1, node2;
    label2: node1, node3, node4;
    ...
Parameters
fileName

Referenced by main(), and removeConnection().

◆ setConnectionLabel()

void Diades::Automata::Topology::setConnectionLabel ( Connection  connection,
const Identifier label 
)
inline

Definition at line 129 of file Topology.hh.

References graph(), and require.

◆ setNodeName()

void Diades::Automata::Topology::setNodeName ( Node  node,
const Identifier name 
)
inline

Definition at line 84 of file Topology.hh.

References graph(), and require.

◆ structuralConnectivity()

unsigned Diades::Automata::Topology::structuralConnectivity ( const Node n) const

Structural connectivity of a Node n

Parameters
na Node
Returns
the number of structuarl connections involving the node n. If there are more than one connections involving Node n annd another node n2 the connectivity between n1 and n2 is only one (structural link as opposed to shared event link)

Referenced by ~Topology().

◆ topology2dot()

void Diades::Automata::Topology::topology2dot ( const string &  fileName)

Export the Topology to Dot file (use of neato is preferable for this type of generated file)

Parameters
fileName

Referenced by main(), and removeConnection().

◆ typeName()

static string Diades::Automata::Topology::typeName ( )
inlinestatic

Definition at line 52 of file Topology.hh.

◆ valid()

bool Diades::Automata::Topology::valid ( ) const
inline

Member Data Documentation

◆ _connections

unordered_set<Connection> Diades::Automata::Topology::_connections
private

Definition at line 47 of file Topology.hh.

◆ _graph

Graph Diades::Automata::Topology::_graph
private

Definition at line 46 of file Topology.hh.

Referenced by graph().

◆ _labels

Diades::Graph::NodeMap<Identifier> Diades::Automata::Topology::_labels
private

Definition at line 49 of file Topology.hh.

◆ _nodes

unordered_set<Node> Diades::Automata::Topology::_nodes
private

Definition at line 48 of file Topology.hh.


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