From 34db2a6c085c02e087954dd66ae6ab063b0c1d00 Mon Sep 17 00:00:00 2001 From: Iain Emsley Date: Fri, 13 Sep 2013 12:05:51 +0100 Subject: [PATCH 1/6] Added namespace to stirng --- SplitSentence.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/SplitSentence.h b/SplitSentence.h index e82ceed..b9c32d0 100644 --- a/SplitSentence.h +++ b/SplitSentence.h @@ -48,13 +48,13 @@ void splitString( parts.clear(); size_t delimiterPos = text.find(delimiter); size_t lastPos = 0; - if (delimiterPos == string::npos) + if (delimiterPos == std::string::npos) { parts.push_back(text); return; } - while(delimiterPos != string::npos) + while(delimiterPos != std::string::npos) { parts.push_back(text.substr(lastPos, delimiterPos - lastPos)); lastPos = delimiterPos + delimiter.size(); From 3ae21bbb76fdaf9df7ebc925be0849fe15f5971c Mon Sep 17 00:00:00 2001 From: Iain Emsley Date: Fri, 13 Sep 2013 12:11:07 +0100 Subject: [PATCH 2/6] Altered int to being unsigned --- SplitSentence.h | 2 +- Storm.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/SplitSentence.h b/SplitSentence.h index b9c32d0..22b65ed 100644 --- a/SplitSentence.h +++ b/SplitSentence.h @@ -72,7 +72,7 @@ class SplitSentence : public BasicBolt std::string s = tuple.GetValues()[2].asString(); std::vector tokens; splitString(s, tokens, " "); - for (int i = 0; i < tokens.size(); ++i) + for (unsigned int i = 0; i < tokens.size(); ++i) { Json::Value j_token; j_token.append(tokens[i]); diff --git a/Storm.h b/Storm.h index 5d820f7..cd92b77 100644 --- a/Storm.h +++ b/Storm.h @@ -258,7 +258,7 @@ namespace storm if (!stream.empty()) v["stream"] = stream; Json::Value json_anchors; - for (int i = 0; i < anchors.size(); ++i) + for (unsigned int i = 0; i < anchors.size(); ++i) json_anchors.append(anchors[i].GetID()); v["anchors"] = json_anchors; if (task != -1) From 7fd154cb3ca8bd553848a4f3a0140b21088064c3 Mon Sep 17 00:00:00 2001 From: Iain Emsley Date: Fri, 13 Sep 2013 12:14:22 +0100 Subject: [PATCH 3/6] Patch file for compiler errors --- integer.patch | 72 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 72 insertions(+) create mode 100644 integer.patch diff --git a/integer.patch b/integer.patch new file mode 100644 index 0000000..9d73347 --- /dev/null +++ b/integer.patch @@ -0,0 +1,72 @@ +From 34db2a6c085c02e087954dd66ae6ab063b0c1d00 Mon Sep 17 00:00:00 2001 +From: Iain Emsley +Date: Fri, 13 Sep 2013 12:05:51 +0100 +Subject: [PATCH 1/2] Added namespace to stirng + +--- + SplitSentence.h | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/SplitSentence.h b/SplitSentence.h +index e82ceed..b9c32d0 100644 +--- a/SplitSentence.h ++++ b/SplitSentence.h +@@ -48,13 +48,13 @@ void splitString( + parts.clear(); + size_t delimiterPos = text.find(delimiter); + size_t lastPos = 0; +- if (delimiterPos == string::npos) ++ if (delimiterPos == std::string::npos) + { + parts.push_back(text); + return; + } + +- while(delimiterPos != string::npos) ++ while(delimiterPos != std::string::npos) + { + parts.push_back(text.substr(lastPos, delimiterPos - lastPos)); + lastPos = delimiterPos + delimiter.size(); +-- +1.7.9.5 + + +From 3ae21bbb76fdaf9df7ebc925be0849fe15f5971c Mon Sep 17 00:00:00 2001 +From: Iain Emsley +Date: Fri, 13 Sep 2013 12:11:07 +0100 +Subject: [PATCH 2/2] Altered int to being unsigned + +--- + SplitSentence.h | 2 +- + Storm.h | 2 +- + 2 files changed, 2 insertions(+), 2 deletions(-) + +diff --git a/SplitSentence.h b/SplitSentence.h +index b9c32d0..22b65ed 100644 +--- a/SplitSentence.h ++++ b/SplitSentence.h +@@ -72,7 +72,7 @@ class SplitSentence : public BasicBolt + std::string s = tuple.GetValues()[2].asString(); + std::vector tokens; + splitString(s, tokens, " "); +- for (int i = 0; i < tokens.size(); ++i) ++ for (unsigned int i = 0; i < tokens.size(); ++i) + { + Json::Value j_token; + j_token.append(tokens[i]); +diff --git a/Storm.h b/Storm.h +index 5d820f7..cd92b77 100644 +--- a/Storm.h ++++ b/Storm.h +@@ -258,7 +258,7 @@ namespace storm + if (!stream.empty()) + v["stream"] = stream; + Json::Value json_anchors; +- for (int i = 0; i < anchors.size(); ++i) ++ for (unsigned int i = 0; i < anchors.size(); ++i) + json_anchors.append(anchors[i].GetID()); + v["anchors"] = json_anchors; + if (task != -1) +-- +1.7.9.5 + From 7ff61903f236d2a59c17efd8c5aafa69596a144e Mon Sep 17 00:00:00 2001 From: Iain Emsley Date: Fri, 13 Sep 2013 12:59:19 +0100 Subject: [PATCH 4/6] Makefile for project --- Makefile | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 Makefile diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..c8d0d55 --- /dev/null +++ b/Makefile @@ -0,0 +1,15 @@ +CC = g++ +CFLAGS = -Werror -Wall +#include path for the JSON header files +IJSON = /home/iain/git/jsoncpp-src-0.6.0-rc2/include +#location of the JSON library +JSON = json +#the main storm library +STORM = Storm.cpp + + +split_sentence: + $(CC) $(CFLAGS) -I$(IJSON) SplitSentenceTest.cpp $(STORM) -o split_sentence -l$(JSON) + +clean: + rm -f split_sentence \ No newline at end of file From a3cd448c8f9fbaa7ff8c136693546d16d8e3a0dd Mon Sep 17 00:00:00 2001 From: Iain Emsley Date: Fri, 13 Sep 2013 14:13:20 +0100 Subject: [PATCH 5/6] Makefile --- Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index c8d0d55..3d29aa6 100644 --- a/Makefile +++ b/Makefile @@ -1,7 +1,7 @@ CC = g++ CFLAGS = -Werror -Wall #include path for the JSON header files -IJSON = /home/iain/git/jsoncpp-src-0.6.0-rc2/include +IJSON = path/to/jsoncpp/includes #location of the JSON library JSON = json #the main storm library @@ -9,7 +9,7 @@ STORM = Storm.cpp split_sentence: - $(CC) $(CFLAGS) -I$(IJSON) SplitSentenceTest.cpp $(STORM) -o split_sentence -l$(JSON) + $(CC) $(CFLAGS) -I$(IJSON) SplitSentenceTest.cpp $(STORM) -L/usr/local/lib -o split_sentence -l$(JSON) clean: rm -f split_sentence \ No newline at end of file From 40a2c88b6ebe6aa1efd2acc40c052f609f5bc938 Mon Sep 17 00:00:00 2001 From: Iain Emsley Date: Fri, 13 Sep 2013 14:26:09 +0100 Subject: [PATCH 6/6] Storm can now be made into a library object --- Makefile | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index 3d29aa6..54b454b 100644 --- a/Makefile +++ b/Makefile @@ -1,15 +1,18 @@ CC = g++ CFLAGS = -Werror -Wall #include path for the JSON header files -IJSON = path/to/jsoncpp/includes +IJSON = /path/to/jsonccp/includes #location of the JSON library JSON = json #the main storm library STORM = Storm.cpp +STORMLIB = storm.o +storm: + $(CC) $(CFLAGS) -fPIC -I$(IJSON) -c $(STORM) -o $(STORMLIB) split_sentence: - $(CC) $(CFLAGS) -I$(IJSON) SplitSentenceTest.cpp $(STORM) -L/usr/local/lib -o split_sentence -l$(JSON) + $(CC) $(CFLAGS) -I$(IJSON) SplitSentenceTest.cpp $(STORMLIB) -o split_sentence.o -l$(JSON) clean: - rm -f split_sentence \ No newline at end of file + rm -f *.o \ No newline at end of file