added basic data model and structures
This commit is contained in:
parent
4acfd3a493
commit
829a0370b4
7
data_model/data_model.hpp
Normal file
7
data_model/data_model.hpp
Normal file
@ -0,0 +1,7 @@
|
||||
#ifndef MEMGRAPH_DATA_MODEL_DATA_MODEL_HPP
|
||||
#define MEMGRAPH_DATA_MODEL_DATA_MODEL_HPP
|
||||
|
||||
#include "node.hpp"
|
||||
#include "edge.hpp"
|
||||
|
||||
#endif
|
16
data_model/edge.hpp
Normal file
16
data_model/edge.hpp
Normal file
@ -0,0 +1,16 @@
|
||||
#ifndef MEMGRAPH_DATA_MODEL_EDGE_HPP
|
||||
#define MEMGRAPH_DATA_MODEL_EDGE_HPP
|
||||
|
||||
template <class T>
|
||||
struct Node;
|
||||
|
||||
template <class T>
|
||||
struct Edge
|
||||
{
|
||||
|
||||
Node<T>* from;
|
||||
Node<T>* to;
|
||||
T* data;
|
||||
};
|
||||
|
||||
#endif
|
@ -1,5 +1,5 @@
|
||||
#ifndef JSON_ALL_HPP
|
||||
#define JSON_ALL_HPP
|
||||
#ifndef MEMGRAPH_DATA_MODEL_JSON_ALL_HPP
|
||||
#define MEMGRAPH_DATA_MODEL_JSON_ALL_HPP
|
||||
|
||||
#include "array.hpp"
|
||||
#include "bool.hpp"
|
||||
|
@ -1,11 +1,11 @@
|
||||
#ifndef JSON_ARRAY_HPP
|
||||
#define JSON_ARRAY_HPP
|
||||
#ifndef MEMGRAPH_DATA_MODEL_JSON_ARRAY_HPP
|
||||
#define MEMGRAPH_DATA_MODEL_JSON_ARRAY_HPP
|
||||
|
||||
#include <cassert>
|
||||
#include <memory>
|
||||
#include <vector>
|
||||
|
||||
#include "../utilities/utils.hpp"
|
||||
#include "utilities/string/intercalate.hpp"
|
||||
|
||||
#include "json.hpp"
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
#ifndef JSON_BOOL_HPP
|
||||
#define JSON_BOOL_HPP
|
||||
#ifndef MEMGRAPH_DATA_MODEL_JSON_BOOL_HPP
|
||||
#define MEMGRAPH_DATA_MODEL_JSON_BOOL_HPP
|
||||
|
||||
#include "primitive.hpp"
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
#ifndef JSON_INTEGRAL_HPP
|
||||
#define JSON_INTEGRAL_HPP
|
||||
#ifndef MEMGRAPH_DATA_MODEL_JSON_INTEGRAL_HPP
|
||||
#define MEMGRAPH_DATA_MODEL_JSON_INTEGRAL_HPP
|
||||
|
||||
#include "primitive.hpp"
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
#ifndef JSON_JSON_HPP
|
||||
#define JSON_JSON_HPP
|
||||
#ifndef MEMGRAPH_DATA_MODEL_JSON_JSON_HPP
|
||||
#define MEMGRAPH_DATA_MODEL_JSON_JSON_HPP
|
||||
|
||||
#include <initializer_list>
|
||||
#include <string>
|
||||
|
@ -1,5 +1,5 @@
|
||||
#ifndef JSON_NULL_HPP
|
||||
#define JSON_NULL_HPP
|
||||
#ifndef MEMGRAPH_DATA_MODEL_JSON_NULL_HPP
|
||||
#define MEMGRAPH_DATA_MODEL_JSON_NULL_HPP
|
||||
|
||||
#include "json.hpp"
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
#ifndef JSON_OBJECT_HPP
|
||||
#define JSON_OBJECT_HPP
|
||||
#ifndef MEMGRAPH_DATA_MODEL_JSON_OBJECT_HPP
|
||||
#define MEMGRAPH_DATA_MODEL_JSON_OBJECT_HPP
|
||||
|
||||
#include <iostream>
|
||||
|
||||
@ -9,7 +9,7 @@
|
||||
#include <vector>
|
||||
#include <map>
|
||||
|
||||
#include "../utilities/utils.hpp"
|
||||
#include "utilities/string/intercalate.hpp"
|
||||
|
||||
#include "json.hpp"
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
#ifndef JSON_PRIMITIVE
|
||||
#define JSON_PRIMITIVE
|
||||
#ifndef MEMGRAPH_DATA_MODEL_JSON_PRIMITIVE_HPP
|
||||
#define MEMGRAPH_DATA_MODEL_JSON_PRIMITIVE_HPP
|
||||
|
||||
#include "json.hpp"
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
#ifndef JSON_REAL_HPP
|
||||
#define JSON_REAL_HPP
|
||||
#ifndef MEMGRAPH_DATA_MODEL_JSON_REAL_HPP
|
||||
#define MEMGRAPH_DATA_MODEL_JSON_REAL_HPP
|
||||
|
||||
#include "primitive.hpp"
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
#ifndef JSON_STRING_HPP
|
||||
#define JSON_STRING_HPP
|
||||
#ifndef MEMGRAPH_DATA_MODEL_JSON_STRING_HPP
|
||||
#define MEMGRAPH_DATA_MODEL_JSON_STRING_HPP
|
||||
|
||||
#include "primitive.hpp"
|
||||
|
||||
|
16
data_model/node.hpp
Normal file
16
data_model/node.hpp
Normal file
@ -0,0 +1,16 @@
|
||||
#ifndef MEMGRAPH_DATA_MODEL_NODE_HPP
|
||||
#define MEMGRAPH_DATA_MODEL_NODE_HPP
|
||||
|
||||
#include <vector>
|
||||
|
||||
#include "edge.hpp"
|
||||
|
||||
template <class T>
|
||||
struct Node
|
||||
{
|
||||
std::vector<Edge<T>*> in;
|
||||
std::vector<Edge<T>*> out;
|
||||
T* data;
|
||||
};
|
||||
|
||||
#endif
|
37
data_structures/spinlock_stack.hpp
Normal file
37
data_structures/spinlock_stack.hpp
Normal file
@ -0,0 +1,37 @@
|
||||
#ifndef MEMGRAPH_DATA_STRUCTURES_SPINLOCK_STACK_HPP
|
||||
#define MEMGRAPH_DATA_STRUCTURES_SPINLOCK_STACK_HPP
|
||||
|
||||
#include <stack>
|
||||
|
||||
#include "utils/sync/spinlock.hpp"
|
||||
|
||||
template <class T>
|
||||
class SpinLockStack
|
||||
{
|
||||
public:
|
||||
|
||||
T pop()
|
||||
{
|
||||
lock.acquire();
|
||||
|
||||
T elem = stack.top();
|
||||
stack.pop();
|
||||
|
||||
lock.release();
|
||||
|
||||
return elem;
|
||||
}
|
||||
|
||||
void push(const T& elem)
|
||||
{
|
||||
lock.acquire();
|
||||
stack.push(elem);
|
||||
lock.release();
|
||||
}
|
||||
|
||||
private:
|
||||
SpinLock lock;
|
||||
std::stack<T> stack;
|
||||
};
|
||||
|
||||
#endif
|
Loading…
Reference in New Issue
Block a user