dfagraph.h
No OneTemporary

File Metadata

Created
Thu, Jul 9, 1:24 AM

dfagraph.h

/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
* File: dfa.h
* Author: pgess <v.melnychenko@xreate.org>
*
* Created on June 27, 2016, 1:50 PM
*/
#ifndef DFA_H
#define DFA_H
#include "clasplayer.h"
namespace xreate {namespace dfa {
struct SymbolAnonymous {
SymbolAnonymous(unsigned int symbolId): id(symbolId){}
unsigned int id;
std::list<Expression> tags;
ScopePacked scope;
std::list<SymbolPacked> dependencies;
};
struct SymbolInvalid { };
typedef boost::variant<SymbolInvalid, SymbolAnonymous, SymbolPacked> SymbolNode;
/** \brief Holds DFA Analysis report produced by DFAPass */
class DFAGraph: public IAnalysisReport{
friend class VisitorAddTag;
friend class VisitorAddLink;
friend class VisitorGetDependencyConnection;
friend class VisitorSetDependencyConnection;
public:
DFAGraph(ClaspLayer* engine): __clasp(engine){}
SymbolPacked createAnonymousSymbol(const ScopePacked& scope);
void addAnnotation(SymbolNode& identifier, Expression&& tag);
void addConnection(const SymbolPacked& identifierTo, const SymbolNode& identifierFrom, DFGConnection link);
void addDependencyConnection(SymbolNode& identifierTo, SymbolNode& identifierFrom);
bool isConnected(const SymbolPacked& identifierTo, const SymbolPacked& identifierFrom);
void print(std::ostringstream& output) const;
private:
typedef unsigned int EdgeId;
std::vector<std::pair<SymbolPacked, SymbolPacked>> __edges;
std::multimap<SymbolPacked, EdgeId> __outEdges;
std::vector<DFGConnection> __data;
std::multimap<SymbolPacked, Expression> __tags;
std::multimap<SymbolPacked, SymbolPacked> __dependencies;
unsigned int __countAnonymousSymbols=0;
ClaspLayer* __clasp;
};
}} // end of namespace xreate::dfa
#endif /* DFA_H */

Event Timeline