Restructure source directory to a more modular hierarchy. Patch by Anand Rathi. Reviewed by Atri Sharma
diff --git a/Design Documents/Hash Table design b/Design/Hash Table design
similarity index 100%
rename from Design Documents/Hash Table design
rename to Design/Hash Table design
diff --git a/Design Documents/skip lists tests b/Design/skip lists tests
similarity index 100%
rename from Design Documents/skip lists tests
rename to Design/skip lists tests
diff --git a/src/CacheManager.h b/include/CacheManager.h
similarity index 100%
rename from src/CacheManager.h
rename to include/CacheManager.h
diff --git a/src/ConcDCT.h b/include/ConcDCT.h
similarity index 100%
rename from src/ConcDCT.h
rename to include/ConcDCT.h
diff --git a/src/ConcDef.h b/include/ConcDef.h
similarity index 100%
rename from src/ConcDef.h
rename to include/ConcDef.h
diff --git a/src/ConcInvertedIndex.h b/include/ConcInvertedIndex.h
similarity index 100%
rename from src/ConcInvertedIndex.h
rename to include/ConcInvertedIndex.h
diff --git a/src/ConcMAT.h b/include/ConcMAT.h
similarity index 100%
rename from src/ConcMAT.h
rename to include/ConcMAT.h
diff --git a/src/ConcQueue.h b/include/ConcQueue.h
similarity index 100%
rename from src/ConcQueue.h
rename to include/ConcQueue.h
diff --git a/src/ConcSegHashTable.h b/include/ConcSegHashTable.h
similarity index 100%
rename from src/ConcSegHashTable.h
rename to include/ConcSegHashTable.h
diff --git a/src/QueueLock.h b/include/QueueLock.h
similarity index 100%
rename from src/QueueLock.h
rename to include/QueueLock.h
diff --git a/src/QueueLock2.h b/include/QueueLock2.h
similarity index 100%
rename from src/QueueLock2.h
rename to include/QueueLock2.h
diff --git a/src/TransactionManager.h b/include/TransactionManager.h
similarity index 100%
rename from src/TransactionManager.h
rename to include/TransactionManager.h
diff --git a/makefile b/makefile
index db60c8e..adfb34a 100644
--- a/makefile
+++ b/makefile
@@ -9,25 +9,25 @@
 libconcerted.a : $(OBJS)
 	ar cr build/libconcerted.a $(OBJS)
 
-obj/CacheManager.o : src/CacheManager.h
+obj/CacheManager.o : include/CacheManager.h
 	g++ -c $< -o $@
 
-obj/ConcDCT.o : src/ConcDCT.h
+obj/ConcDCT.o : include/ConcDCT.h
 	g++ -c $< -o $@
 
-obj/ConcInvertedIndex.o : src/ConcInvertedIndex.h
+obj/ConcInvertedIndex.o : include/ConcInvertedIndex.h
 	g++ -c $< -o $@
 
-obj/ConcMAT.o : src/ConcMAT.h
+obj/ConcMAT.o : include/ConcMAT.h
 	g++ -c $< -o $@
 
-obj/ConcQueue.o : src/ConcQueue.h
+obj/ConcQueue.o : include/ConcQueue.h
 	g++ -c $< -o $@
 
-obj/ConcSegHashTable.o : src/ConcSegHashTable.h
+obj/ConcSegHashTable.o : include/ConcSegHashTable.h
 	g++ -c $< -o $@
 
 clean:
 	rm build/libconcerted.a
 	rm -r obj
-	rm -r build
\ No newline at end of file
+	rm -r build
diff --git a/Tests/ConcDCTConcurrencyTest.cpp b/test/ConcDCTConcurrencyTest.cpp
similarity index 100%
rename from Tests/ConcDCTConcurrencyTest.cpp
rename to test/ConcDCTConcurrencyTest.cpp
diff --git a/Tests/ConcDCTFileReader.cpp b/test/ConcDCTFileReader.cpp
similarity index 92%
copy from Tests/ConcDCTFileReader.cpp
copy to test/ConcDCTFileReader.cpp
index 5e4d6c5..33ac373 100644
--- a/Tests/ConcDCTFileReader.cpp
+++ b/test/ConcDCTFileReader.cpp
@@ -2,7 +2,7 @@
 #include <sstream>
 #include <fstream>
 #include <string>
-#include "../ConcDCT.h"
+#include "../include/ConcDCT.h"
 
 using namespace std;
 
@@ -24,7 +24,7 @@
   char c;
 
    int value;
-  while (iss >> value) 
+  while (iss >> value)
   {
 	if (count == 3)
 	{
diff --git a/Tests/ConcDCTFileReader.cpp b/test/ConcDCTFileReader.cpp~
similarity index 96%
rename from Tests/ConcDCTFileReader.cpp
rename to test/ConcDCTFileReader.cpp~
index 5e4d6c5..630c35e 100644
--- a/Tests/ConcDCTFileReader.cpp
+++ b/test/ConcDCTFileReader.cpp~
@@ -24,7 +24,7 @@
   char c;
 
    int value;
-  while (iss >> value) 
+  while (iss >> value)
   {
 	if (count == 3)
 	{
diff --git a/test/ConcDCTTest.cpp b/test/ConcDCTTest.cpp
new file mode 100644
index 0000000..d17b277
--- /dev/null
+++ b/test/ConcDCTTest.cpp
@@ -0,0 +1,62 @@
+#include "../include/ConcDCT.h"
+	int main()
+	{
+		int att_array[3];
+		int i = 0;
+		TransactionManager transact_val1;
+		dct_tree *tree_val = NULL;
+		dct_tree *tree_val2 = NULL;
+		dct_tree *tree_val3 = NULL;
+		dct_node *temp = NULL;
+		tree_val = build_dcttree(3);
+		tree_val3 = build_dcttree(3);
+		att_array[0] = 1;
+		att_array[1] = 2;
+		att_array[2] = 3;
+		try
+		{
+			insert_val(att_array, tree_val, transact_val1);
+			insert_val(att_array, tree_val3, transact_val1);
+			//throw -1;
+			transact_val1.commit_transaction();
+			tree_val2 = copy_val((tree_val->getdummy()), (tree_val->getnumber_of_nodes()));
+		}catch (int e)
+		{
+			cout<<"exception caught"<<" "<<e<<endl;
+			return 1;
+		}
+
+		//att_array[2] = 3;
+		if (search_val(att_array, tree_val))
+		{
+			cout<<"All values found"<<endl;
+		}
+		else
+		{
+			cout<<"All values not found"<<endl;
+		}
+
+		temp = search_val(att_array, tree_val2);
+		if (temp != NULL)
+		{
+			cout<<" All values found copy tree"<<endl;
+		}
+		else
+		{
+			cout<<"All values not found copy tree"<<endl;
+		}
+
+		if (search_val(att_array, tree_val3))
+		{
+			cout<<"All values found3"<<endl;
+		}
+		else
+		{
+			cout<<"All values not found3"<<endl;
+		}
+
+		delete tree_val;
+		delete tree_val2;
+		delete tree_val3;
+		delete temp;
+	}
diff --git a/Tests/ConcDCTTest.cpp b/test/ConcDCTTest.cpp~
similarity index 100%
rename from Tests/ConcDCTTest.cpp
rename to test/ConcDCTTest.cpp~
diff --git a/test/ConcInvertedIndexTest.cpp b/test/ConcInvertedIndexTest.cpp
new file mode 100644
index 0000000..35ba9e0
--- /dev/null
+++ b/test/ConcInvertedIndexTest.cpp
@@ -0,0 +1,28 @@
+#include "../include/ConcInvertedIndex.h"
+
+int main()
+	{
+		inv_index<3,0> *index1;
+		int att_values[3];
+		int return_value;
+
+		return_value = 0;
+		index1 = new inv_index<3,0>;
+		att_values[0] = 3;
+		att_values[1] = 4;
+		att_values[2] = 5;
+
+		insert_val(att_values, index1);
+
+		return_value = search_val(&(att_values[0]), index1);
+
+		if (return_value == 1)
+		{
+			cout<<"values found"<<" "<<return_value<<endl;
+		}
+		else
+		{
+			cout<<"values not found"<<" "<<return_value<<endl;
+		}
+
+	}
diff --git a/Tests/ConcInvertedIndexTest.cpp b/test/ConcInvertedIndexTest.cpp~
similarity index 100%
rename from Tests/ConcInvertedIndexTest.cpp
rename to test/ConcInvertedIndexTest.cpp~
diff --git a/Tests/ConcMATFileReader.cpp b/test/ConcMATFileReader.cpp
similarity index 100%
rename from Tests/ConcMATFileReader.cpp
rename to test/ConcMATFileReader.cpp
diff --git a/test/ConcMATTest.cpp b/test/ConcMATTest.cpp
new file mode 100644
index 0000000..555c033
--- /dev/null
+++ b/test/ConcMATTest.cpp
@@ -0,0 +1,24 @@
+#include "../include/ConcMAT.h"
+
+	int main()
+	{
+		int att_array[3];
+		int i = 0;
+		mat_tree *tree_val = NULL;
+		tree_val = build_mattree(3);
+		att_array[0] = 1;
+		att_array[1] = 2;
+		att_array[2] = 3;
+		insert_val(att_array, tree_val);
+		if (search_val(att_array, tree_val))
+		{
+			cout<<"All values found"<<endl;
+		}
+		else
+		{
+			cout<<"All values not found"<<endl;
+		}
+
+		delete tree_val;
+	}
+
diff --git a/Tests/ConcMATTest.cpp b/test/ConcMATTest.cpp~
similarity index 100%
rename from Tests/ConcMATTest.cpp
rename to test/ConcMATTest.cpp~
diff --git a/test/ConcSegHashTableTest.cpp b/test/ConcSegHashTableTest.cpp
new file mode 100644
index 0000000..92b8ce5
--- /dev/null
+++ b/test/ConcSegHashTableTest.cpp
@@ -0,0 +1,87 @@
+#include "../include/ConcSegHashTable.h"
+
+ConcSegHashTable<int> tab1(10,2);
+void *thread_lock_test(void *arg1)
+{
+	//tab1.GetWriteLock(0,2,(char*)arg1);
+	//tab1.InsertElement(5, false, (char*)arg1);
+	if((tab1.InsertElement(5, false,(char*)arg1)) == 0)
+	{
+		cout<<"Value not inserted"<<" "<<(char*)arg1<<" "<<5<<endl;
+		sleep(1);
+	}
+
+	tab1.InsertElement(6, false,(char*)arg1);
+	//tab1.InsertElement(5, false,(char*)arg1);
+	//tab1.InsertElement(5, false,(char*)arg1);
+	//cout<<"read lock with"<<" "<<(char*)arg1<<endl;
+	//sleep(1);
+	//tab1.ReleaseWriteLock(0,2,(char*)arg1);
+	//cout<<"read lock released by"<<" "<<(char*)arg1<<endl;
+}
+
+void *thread_lock_test2(void *arg1)
+{
+	//tab1.GetWriteLock(0,2, (char*)arg1);
+	//cout<<"write lock with"<<" "<<(char*)arg1<<endl;
+	//tab1.ReleaseWriteLock(0,2, (char*)arg1);
+	//cout<<"write lock released by"<<" "<<(char*)arg1<<endl;
+	if((tab1.InsertElement(5, false, (char*)arg1)) == 0)
+	{
+		cout<<"Value not inserted"<<" "<<(char*)arg1<<" "<<5<<endl;
+		sleep(1);
+	}
+
+	if((tab1.InsertElement(6, false, (char*)arg1)) == 0)
+	{
+		cout<<"Value not inserted"<<" "<<(char*)arg1<<" "<<6<<endl;
+		sleep(1);
+	}
+}
+
+void *thread_lock_test3(void *arg1)
+{
+	/*tab1.GetReadLock(0,2, (char*)arg1);
+	cout<<"read lock with"<<" "<<(char*)arg1<<endl;
+	tab1.ReleaseReadLock(0,2, (char*)arg1);
+	cout<<"read lock released by"<<" "<<(char*)arg1<<endl;*/
+	if((tab1.InsertElement(6, false, (char*)arg1)) == 0)
+	{
+		cout<<"Value not inserted"<<" "<<(char*)arg1<<" "<<6<<endl;
+	}
+
+	//tab1.InsertElement(6, false, (char*)arg1);
+}
+
+void *thread_lock_test4(void *arg1)
+{
+	tab1.InsertElement(6,false,(char*)arg1);
+	tab1.InsertElement(9,false,(char*)arg1);
+}
+
+int main()
+{
+	pthread_t tid1;
+	pthread_t tid2;
+	pthread_t tid3;
+	pthread_t tid4;
+	char name1[] = "thread1";
+	char name2[] = "thread2";
+	char name3[] = "thread3";
+	char name4[] = "thread4";
+
+	pthread_create(&tid1,NULL,thread_lock_test,(void*)name1);
+	pthread_create(&tid2,NULL,thread_lock_test2,(void*)name2);
+	pthread_create(&tid3,NULL,thread_lock_test3,(void*)name3);
+	pthread_create(&tid4,NULL,thread_lock_test4,(void*)name4);
+
+	pthread_join(tid1,NULL);
+	pthread_join(tid2,NULL);
+	pthread_join(tid3,NULL);
+	pthread_join(tid4,NULL);
+
+	tab1.PrintValues();
+
+	//tab1.GetWriteLock(2,3);
+	//tab1.ReleaseWriteLock(2,3);
+}
diff --git a/Tests/ConcSegHashTableTest.cpp b/test/ConcSegHashTableTest.cpp~
similarity index 100%
rename from Tests/ConcSegHashTableTest.cpp
rename to test/ConcSegHashTableTest.cpp~
diff --git a/Tests/ConcSkipListTest.cpp b/test/ConcSkipListTest.cpp
similarity index 98%
rename from Tests/ConcSkipListTest.cpp
rename to test/ConcSkipListTest.cpp
index 83d9a5c..95552ff 100644
--- a/Tests/ConcSkipListTest.cpp
+++ b/test/ConcSkipListTest.cpp
@@ -1,4 +1,4 @@
-#include "../QueueLock.h"
+#include "../include/QueueLock.h"
 
 class linked_list
 {
diff --git a/Tests/ConcSkipListTest.cpp b/test/ConcSkipListTest.cpp~
similarity index 98%
copy from Tests/ConcSkipListTest.cpp
copy to test/ConcSkipListTest.cpp~
index 83d9a5c..95552ff 100644
--- a/Tests/ConcSkipListTest.cpp
+++ b/test/ConcSkipListTest.cpp~
@@ -1,4 +1,4 @@
-#include "../QueueLock.h"
+#include "../include/QueueLock.h"
 
 class linked_list
 {
diff --git a/Tests/FileReader.cpp b/test/FileReader.cpp
similarity index 92%
rename from Tests/FileReader.cpp
rename to test/FileReader.cpp
index 3e924fc..e87cd19 100644
--- a/Tests/FileReader.cpp
+++ b/test/FileReader.cpp
@@ -2,7 +2,7 @@
 #include <sstream>
 #include <fstream>
 #include <string>
-#include "../ConcMAT.h"
+#include "../include/ConcMAT.h"
 
 using namespace std;
 
@@ -23,7 +23,7 @@
   char c;
 
    int value;
-  while (iss >> value) 
+  while (iss >> value)
   {
 	if (count == 3)
 	{
diff --git a/Tests/ConcMATFileReader.cpp b/test/FileReader.cpp~
similarity index 100%
copy from Tests/ConcMATFileReader.cpp
copy to test/FileReader.cpp~
diff --git a/test/QueueLockTest.cpp b/test/QueueLockTest.cpp
new file mode 100644
index 0000000..1b28d40
--- /dev/null
+++ b/test/QueueLockTest.cpp
@@ -0,0 +1,43 @@
+#include<unistd.h>
+#include "../include/QueueLock.h"
+
+QueueLock GlobalQueueLock;
+void *thread_getlock_start(void *arg1)
+{
+	GlobalQueueLock.GetLock();
+	cout<<"Lock acquired by"<<" "<<(char*)arg1<<endl;
+	usleep(1);
+	GlobalQueueLock.ReleaseLock();
+}
+
+int main()
+{
+	int data_value = 5;
+	QueueLock lock1;
+	pthread_t tid1;
+	pthread_t tid2;
+	pthread_t tid3;
+	pthread_t tid4;
+	pthread_t tid5;
+	pthread_t tid6;
+	pthread_t tid7;
+	char name1[] = "thread1";
+	char name2[] = "thread2";
+	char name3[] = "thread3";
+	char name4[] = "thread4";
+	char name5[] = "thread5";
+
+	pthread_create(&tid1,NULL,thread_getlock_start,(void*)(name1));
+	pthread_create(&tid2,NULL,thread_getlock_start,(void*)(name2));
+	pthread_create(&tid3,NULL,thread_getlock_start,(void*)(name3));
+	pthread_create(&tid4,NULL,thread_getlock_start,(void*)(name4));
+	pthread_create(&tid5,NULL,thread_getlock_start,(void*)(name5));
+
+	pthread_join(tid1,NULL);
+	pthread_join(tid2,NULL);
+	pthread_join(tid3,NULL);
+	pthread_join(tid4,NULL);
+	pthread_join(tid5,NULL);
+}
+	
+
diff --git a/Tests/QueueLockTest.cpp b/test/QueueLockTest.cpp~
similarity index 100%
rename from Tests/QueueLockTest.cpp
rename to test/QueueLockTest.cpp~