logic: code controller communication
- Replaced CodeAccess with LocationAccess. - Implemented basic functionality for CodeController. - Added messaging to the project. - Added QtThreadedFunctor to enable our Messaging thread to invoke calls on the QtThread. - Added GraphController. fortune cookie message = Good news from someone dear is coming soon.
This commit is contained in:
@@ -173,6 +173,16 @@ void Storage::logLocations() const
|
||||
LOG_INFO(str.str());
|
||||
}
|
||||
|
||||
Token* Storage::getToken(Id tokenId)
|
||||
{
|
||||
return m_graph.getTokenById(tokenId);
|
||||
}
|
||||
|
||||
TokenLocation* Storage::getTokenLocation(Id locationId)
|
||||
{
|
||||
return m_locationCollection.findTokenLocationById(locationId);
|
||||
}
|
||||
|
||||
Edge::AccessType Storage::convertAccessType(ParserClient::AccessType access) const
|
||||
{
|
||||
switch (access)
|
||||
|
||||
@@ -4,11 +4,13 @@
|
||||
#include <memory>
|
||||
#include <vector>
|
||||
|
||||
#include "data/access/GraphAccess.h"
|
||||
#include "data/access/LocationAccess.h"
|
||||
#include "data/graph/Graph.h"
|
||||
#include "data/location/TokenLocationCollection.h"
|
||||
#include "data/parser/ParserClient.h"
|
||||
|
||||
class Storage: public ParserClient
|
||||
class Storage: public ParserClient, public GraphAccess, public LocationAccess
|
||||
{
|
||||
public:
|
||||
Storage();
|
||||
@@ -40,6 +42,9 @@ public:
|
||||
void logGraph() const;
|
||||
void logLocations() const;
|
||||
|
||||
virtual Token* getToken(Id tokenId);
|
||||
virtual TokenLocation* getTokenLocation(Id locationId);
|
||||
|
||||
private:
|
||||
Edge::AccessType convertAccessType(ParserClient::AccessType access) const;
|
||||
TokenLocation* addTokenLocation(Token* token, const ParseLocation& location);
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
#include "data/access/CodeAccess.h"
|
||||
@@ -1,9 +0,0 @@
|
||||
#ifndef CODE_ACCESS_H
|
||||
#define CODE_ACCESS_H
|
||||
|
||||
class CodeAccess
|
||||
{
|
||||
};
|
||||
|
||||
|
||||
#endif // CODE_ACCESS_H
|
||||
@@ -1 +1,5 @@
|
||||
#include "data/access/GraphAccess.h"
|
||||
|
||||
GraphAccess::~GraphAccess()
|
||||
{
|
||||
}
|
||||
|
||||
@@ -1,8 +1,16 @@
|
||||
#ifndef GRAPH_ACCESS_H
|
||||
#define GRAPH_ACCESS_H
|
||||
|
||||
#include "utility/types.h"
|
||||
|
||||
class Token;
|
||||
|
||||
class GraphAccess
|
||||
{
|
||||
public:
|
||||
virtual ~GraphAccess();
|
||||
|
||||
virtual Token* getToken(Id tokenId) = 0;
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
#include "data/access/LocationAccess.h"
|
||||
|
||||
LocationAccess::~LocationAccess()
|
||||
{
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
#ifndef LOCATION_ACCESS_H
|
||||
#define LOCATION_ACCESS_H
|
||||
|
||||
#include "utility/types.h"
|
||||
|
||||
class TokenLocation;
|
||||
|
||||
class LocationAccess
|
||||
{
|
||||
public:
|
||||
virtual ~LocationAccess();
|
||||
virtual TokenLocation* getTokenLocation(Id locationId) = 0;
|
||||
|
||||
};
|
||||
|
||||
|
||||
#endif // LOCATION_ACCESS_H
|
||||
@@ -31,7 +31,7 @@ private:
|
||||
Token(const Token&);
|
||||
void operator=(const Token&);
|
||||
|
||||
const Id m_id;
|
||||
const Id m_id; // own id
|
||||
|
||||
std::vector<Id> m_locationIds;
|
||||
};
|
||||
|
||||
@@ -40,9 +40,9 @@ public:
|
||||
std::shared_ptr<TokenLocation> createPlainCopy(TokenLocationLine* line) const;
|
||||
|
||||
private:
|
||||
static Id s_locationId;
|
||||
static Id s_locationId; // next free own id
|
||||
|
||||
const Id m_id;
|
||||
const Id m_id; // own id
|
||||
const Id m_tokenId;
|
||||
|
||||
TokenLocationLine* const m_line;
|
||||
|
||||
Reference in New Issue
Block a user