Create header file for Node

This commit is contained in:
2021-01-02 15:37:05 +01:00
parent 047e9ee732
commit 004e7a9cd6
8 changed files with 31 additions and 28 deletions

View File

@@ -1 +1 @@
add_library(sets STATIC FineList.cpp LazyList.cpp OptimisticList.cpp MultiSet.cpp Node.cpp Set.cpp) add_library(sets STATIC Node.h Node.cpp Set.cpp FineList.cpp LazyList.cpp OptimisticList.cpp MultiSet.cpp )

View File

@@ -2,7 +2,7 @@
#include <bits/stdc++.h> #include <bits/stdc++.h>
#include"Node.cpp" #include"Node.h"
#include"Set.cpp" #include"Set.cpp"
class FineSet:public Set { class FineSet:public Set {

View File

@@ -2,7 +2,7 @@
#include <bits/stdc++.h> #include <bits/stdc++.h>
#include"Node.cpp" #include"Node.h"
#include"Set.cpp" #include"Set.cpp"
class LazySet:public Set { class LazySet:public Set {

View File

@@ -2,7 +2,7 @@
#include <bits/stdc++.h> #include <bits/stdc++.h>
#include"Node.cpp" #include"Node.h"
#include"Set.cpp" #include"Set.cpp"
class MultiSet:public Set { class MultiSet:public Set {

View File

@@ -1,28 +1,7 @@
#pragma once #pragma once
#include <mutex> #include <mutex>
#include <lib/Node.h>
class Node {
protected:
int data;
bool is_dummy;
std::mutex mut;
public:
Node* next;
bool deleted;
Node(int element);
static Node* Dummy();
// Dummy();
void lock();
void unlock();
bool is_smaller_than(int n);
bool is_smaller_than(Node* n);
bool is_equal(int n);
};
Node::Node(int element){ Node::Node(int element){
data = element; data = element;

24
Assignment_2/lib/Node.h Normal file
View File

@@ -0,0 +1,24 @@
#pragma once
#include <mutex>
class Node {
protected:
int data;
bool is_dummy;
std::mutex mut;
public:
Node* next;
bool deleted;
Node(int element);
static Node* Dummy();
// Dummy();
void lock();
void unlock();
bool is_smaller_than(int n);
bool is_smaller_than(Node* n);
bool is_equal(int n);
};

View File

@@ -2,7 +2,7 @@
#include <bits/stdc++.h> #include <bits/stdc++.h>
#include"Node.cpp" #include"Node.h"
#include"Set.cpp" #include"Set.cpp"
class OptimisticSet:public Set { class OptimisticSet:public Set {

View File

@@ -1,6 +1,6 @@
#pragma once #pragma once
#include "Node.cpp" #include "Node.h"
class Set { class Set {
protected: protected: