#ifndef NODE_H #define NODE_H #include #include #include #include #include "data/graph/Edge.h" #include "data/graph/Token.h" class Node: public Token { public: enum NodeType { NODE_UNDEFINED, NODE_CLASS, NODE_STRUCT, NODE_GLOBAL, NODE_FIELD, NODE_FUNCTION, NODE_METHOD, NODE_NAMESPACE, NODE_ENUM }; Node(NodeType type, const std::string& name); virtual ~Node(); std::shared_ptr createPlainCopy() const; NodeType getType() const; void setType(NodeType type); const std::string& getName() const; const std::vector& getEdges() const; void addEdge(Edge* edge); void removeEdge(Edge* edge); Edge* getMemberEdge() const; Edge* findEdge(std::function func) const; Edge* findEdgeOfType(Edge::EdgeType type, std::function func) const; void forEachEdge(std::function func) const; void forEachEdgeOfType(Edge::EdgeType type, std::function func) const; // Token implementation. virtual bool isNode() const; virtual bool isEdge() const; // Additional field accessors for different NodeTypes. void setAccess(Edge::AccessType access); bool isConst() const; void setConst(bool isConst); bool isStatic() const; void setStatic(bool isStatic); // Logging. std::string getTypeString(NodeType type) const; std::string getAsString() const; private: // Constructor for plain copies. Node(Id id, NodeType type, const std::string& name); NodeType m_type; std::string m_name; std::vector m_edges; // Additional fields for different NodeTypes. bool m_isConst; bool m_isStatic; }; std::ostream& operator<<(std::ostream& ostream, const Node& node); #endif // NODE_H