File tree Expand file tree Collapse file tree 5 files changed +62
-0
lines changed Expand file tree Collapse file tree 5 files changed +62
-0
lines changed Original file line number Diff line number Diff line change 1111BLOBSTAMPER_SRC := $(wildcard blobstamper/* .cpp)
1212BLOBSTAMPER_OBJ := $(addsuffix .o, $(basename $(BLOBSTAMPER_SRC ) ) )
1313
14+ EXAMPLES_SRC = $(wildcard examples/* .cpp)
15+ EXAMPLES_BIN = $(basename $(EXAMPLES_SRC ) )
16+
17+
1418.PHONY : all blob-stamper-all blob-stamper-clean clean test gagaga
1519
1620all : $(BLOBSTAMPER_OBJ )
4650# test_dict: test_dict.o blob-stamper-all
4751# $(CXX) $(LDFLAGS) $@.o -o $@ $(BLOB_STAMPER_OBJ)
4852
53+ examples : $(BLOBSTAMPER_OBJ )
54+ $(MAKE ) -C examples
4955
5056gagaga :
5157 @echo ------- $(BLOBSTAMPER_OBJ )
Original file line number Diff line number Diff line change @@ -111,3 +111,10 @@ Blob::asVector()
111111 return res;
112112}
113113
114+ /* Do not use in prod. For tests and examples only */
115+ std::string
116+ Blob::asString ()
117+ {
118+ std::string res ((char *)data + begin, Size ());
119+ return res;
120+ }
Original file line number Diff line number Diff line change @@ -42,6 +42,7 @@ class Blob
4242 std::vector<char > ChopBlank (StampBase &stmp);
4343 void DataDup (char *& data_out, size_t & size_out);
4444 std::vector<char > asVector ();
45+ std::string asString (); /* Should not be used in prod, for tests and examples only*/
4546};
4647
4748class OutOfData /* An exeption. Experemental for now*/
Original file line number Diff line number Diff line change 1+
2+ BLOBSTAMPER_SRC := $(wildcard ../blobstamper/* .cpp)
3+ BLOBSTAMPER_OBJ := $(addsuffix .o, $(basename $(BLOBSTAMPER_SRC ) ) )
4+
5+ EXAMPLES_SRC = $(wildcard * .cpp)
6+ EXAMPLES_BIN = $(basename $(EXAMPLES_SRC ) )
7+
8+
9+ all : $(EXAMPLES_BIN )
10+
11+ build-libtappp :
12+ $(MAKE ) -C ../libtappp
13+
14+ ../blobstamper-pg/% .o : ../blobstamper-pg/% .cpp
15+ $(CXX ) -c -g $(CXXFLAGS ) -I .. $< -o $@
16+
17+ ../wrappers/% .o : ../wrappers/% .cpp
18+ $(CXX ) -c -g $(CXXFLAGS ) -I .. $< -o $@
19+
20+
21+ % : % .cpp $(BLOBSTAMPER_OBJ ) $(BLOBSTAMPER_PG_OBJ ) $(WRAPPERS_OBJ )
22+ $(CXX ) $(CXXFLAGS ) -I.. -o $@ $< $(BLOBSTAMPER_OBJ )
23+
24+ clean :
25+ -rm $(EXAMPLES_BIN ) 2> /dev/null
26+
27+ .PHONY : test clean all
28+
Original file line number Diff line number Diff line change 1+ #include < stdio.h>
2+ #include < string.h>
3+
4+ #include < string>
5+ #include < iostream>
6+
7+ #include < blobstamper/blobstamper.h>
8+
9+ int main ()
10+ {
11+ char data[] = " abcde" ;
12+ Blob blob (data, strlen (data));
13+ StampArithm<short int > stamp;
14+ std::string s = stamp.ExtractStr (blob);
15+
16+ std::cout << " Stamp minSize: " << stamp.minSize () << " \n " ;
17+ std::cout << " Stamp maxSize: " << stamp.maxSize () << " \n " ;
18+ std::cout << " Extracted value: " << s <<" \n " ;
19+ std::cout << " Remaining blob: " << blob.asString () << " \n " ;
20+ }
You can’t perform that action at this time.
0 commit comments