├── .dockerignore
├── .gitignore
├── .travis.yml
├── Dockerfile
├── Makefile.am
├── README.md
├── autogen.sh
├── configure.ac
├── gnulib.sh
├── hdt-it
├── .cproject
├── .gitignore
├── .project
├── Camera.cpp
├── Camera.h
├── Color.cpp
├── Color.h
├── Info.plist
├── LICENSE
├── README.md
├── StopWatch.cpp
├── StopWatch.hpp
├── abouthdt.cpp
├── abouthdt.hpp
├── abouthdt.ui
├── colors.hpp
├── constants.h
├── createdmg.sh
├── dictionarysuggestions.cpp
├── dictionarysuggestions.hpp
├── doc
│ ├── hdtit.png
│ ├── manual.html
│ └── matrix.png
├── editreset.png
├── hdt-it.pro
├── hdt-it_es.qm
├── hdt-it_es.ts
├── hdtcachedinfo.cpp
├── hdtcachedinfo.hpp
├── hdtcontroller.cpp
├── hdtcontroller.hpp
├── hdtico.icns
├── hdtico.rc
├── hdtit.cpp
├── hdtit.hpp
├── hdtit.ui
├── hdtoperation.cpp
├── hdtoperation.hpp
├── hdtresources.qrc
├── hdtspecform.cpp
├── hdtspecform.hpp
├── hdtspecform.ui
├── hdtsummarygenerator.cpp
├── hdtsummarygenerator.hpp
├── hdtwinico.ico
├── hdtwinico2.ico
├── headermodel.cpp
├── headermodel.hpp
├── loading.gif
├── logo-hdt.png
├── logo-hdt2.png
├── main.cpp
├── matrixviewwidget.cpp
├── matrixviewwidget.hpp
├── myapplication.cpp
├── myapplication.hpp
├── predicatestatus.cpp
├── predicatestatus.hpp
├── qclearlineedit.cpp
├── qclearlineedit.hpp
├── regexmodel.cpp
├── regexmodel.hpp
├── resultcounter.cpp
├── resultcounter.hpp
├── searchresultsmodel.cpp
├── searchresultsmodel.hpp
├── sparqlform.cpp
├── sparqlform.hpp
├── sparqlform.ui
├── sparqlmodel.cpp
├── sparqlmodel.hpp
├── stringutils.cpp
├── stringutils.hpp
├── triplecomponentmodel.cpp
└── triplecomponentmodel.hpp
├── lib
├── .gitignore
└── Makefile.in
├── libcds
├── COPYRIGHT
├── Changelog
├── Doxyfile
├── Makefile.am
├── README
├── cds.pc.in
├── docs
│ └── delete_me
├── include
│ ├── Array.h
│ ├── BitSequence.h
│ ├── BitSequenceBuilder.h
│ ├── BitSequenceBuilderDArray.h
│ ├── BitSequenceBuilderRG.h
│ ├── BitSequenceBuilderRRR.h
│ ├── BitSequenceBuilderSDArray.h
│ ├── BitSequenceDArray.h
│ ├── BitSequenceRG.h
│ ├── BitSequenceRRR.h
│ ├── BitSequenceSDArray.h
│ ├── BitString.h
│ ├── BitmapsSequence.h
│ ├── Coder.h
│ ├── HuffmanCoder.h
│ ├── LCP.h
│ ├── LCP_DAC.h
│ ├── LCP_DAC_VAR.h
│ ├── LCP_FMN.h
│ ├── LCP_PT.h
│ ├── LCP_PhiSpare.h
│ ├── LCP_Sad.h
│ ├── LCP_naive.h
│ ├── Mapper.h
│ ├── MapperCont.h
│ ├── MapperNone.h
│ ├── MapperRev.h
│ ├── NPR.h
│ ├── NPR_CN.h
│ ├── NPR_FMN.h
│ ├── NSV.h
│ ├── PSV.h
│ ├── Permutation.h
│ ├── PermutationBuilder.h
│ ├── PermutationBuilderMRRR.h
│ ├── PermutationBuilderWT.h
│ ├── PermutationMRRR.h
│ ├── PermutationWT.h
│ ├── RMQ_succinct.h
│ ├── RMQ_succinct_lcp.h
│ ├── Sequence.h
│ ├── SequenceAlphPart.h
│ ├── SequenceBuilder.h
│ ├── SequenceBuilderAlphPart.h
│ ├── SequenceBuilderGMR.h
│ ├── SequenceBuilderGMRChunk.h
│ ├── SequenceBuilderStr.h
│ ├── SequenceBuilderWaveletMatrix.h
│ ├── SequenceBuilderWaveletTree.h
│ ├── SequenceBuilderWaveletTreeNoptrs.h
│ ├── SequenceBuilderWaveletTreeNoptrsS.h
│ ├── SequenceGMR.h
│ ├── SequenceGMRChunk.h
│ ├── SuffixTree.h
│ ├── SuffixTreeY.h
│ ├── TableOffsetRRR.h
│ ├── TextIndex.h
│ ├── TextIndexCSA.h
│ ├── WaveletMatrix.h
│ ├── WaveletTree.h
│ ├── WaveletTreeNoptrs.h
│ ├── WaveletTreeNoptrsS.h
│ ├── comparray4.h
│ ├── cppUtils.h
│ ├── factorization.h
│ ├── factorization_var.h
│ ├── huff.h
│ ├── interface.h
│ ├── libcdsBasics.h
│ ├── libcdsSDArray.h
│ ├── libcdsTrees.h
│ ├── mmap.h
│ ├── perm.h
│ ├── sdarraySadakane.h
│ ├── timing.h
│ ├── wt_coder.h
│ ├── wt_coder_binary.h
│ ├── wt_coder_huff.h
│ ├── wt_node.h
│ ├── wt_node_internal.h
│ └── wt_node_leaf.h
├── src
│ ├── static
│ │ ├── bitsequence
│ │ │ ├── BitSequence.cpp
│ │ │ ├── BitSequenceBuilderDArray.cpp
│ │ │ ├── BitSequenceBuilderRG.cpp
│ │ │ ├── BitSequenceBuilderRRR.cpp
│ │ │ ├── BitSequenceBuilderSDArray.cpp
│ │ │ ├── BitSequenceDArray.cpp
│ │ │ ├── BitSequenceRG.cpp
│ │ │ ├── BitSequenceRRR.cpp
│ │ │ ├── BitSequenceSDArray.cpp
│ │ │ ├── TableOffsetRRR.cpp
│ │ │ └── sdarraySadakane.cpp
│ │ ├── coders
│ │ │ ├── HuffmanCoder.cpp
│ │ │ └── huff.cpp
│ │ ├── mapper
│ │ │ ├── Makefile
│ │ │ ├── Mapper.cpp
│ │ │ ├── MapperCont.cpp
│ │ │ ├── MapperNone.cpp
│ │ │ └── MapperRev.cpp
│ │ ├── permutation
│ │ │ ├── Permutation.cpp
│ │ │ ├── PermutationBuilderMRRR.cpp
│ │ │ ├── PermutationBuilderWT.cpp
│ │ │ ├── PermutationMRRR.cpp
│ │ │ ├── PermutationWT.cpp
│ │ │ └── perm.cpp
│ │ ├── sequence
│ │ │ ├── BitmapsSequence.cpp
│ │ │ ├── Sequence.cpp
│ │ │ ├── SequenceAlphPart.cpp
│ │ │ ├── SequenceBuilderAlphPart.cpp
│ │ │ ├── SequenceBuilderGMR.cpp
│ │ │ ├── SequenceBuilderGMRChunk.cpp
│ │ │ ├── SequenceBuilderStr.cpp
│ │ │ ├── SequenceBuilderWaveletMatrix.cpp
│ │ │ ├── SequenceBuilderWaveletTree.cpp
│ │ │ ├── SequenceBuilderWaveletTreeNoptrs.cpp
│ │ │ ├── SequenceBuilderWaveletTreeNoptrsS.cpp
│ │ │ ├── SequenceGMR.cpp
│ │ │ ├── SequenceGMRChunk.cpp
│ │ │ ├── WaveletMatrix.cpp
│ │ │ ├── WaveletTree.cpp
│ │ │ ├── WaveletTreeNoptrs.cpp
│ │ │ ├── WaveletTreeNoptrsS.cpp
│ │ │ ├── wt_coder.cpp
│ │ │ ├── wt_coder_binary.cpp
│ │ │ ├── wt_coder_huff.cpp
│ │ │ ├── wt_node.cpp
│ │ │ ├── wt_node_internal.cpp
│ │ │ └── wt_node_leaf.cpp
│ │ ├── suffixtree
│ │ │ ├── LCP.cpp
│ │ │ ├── LCP_DAC.cpp
│ │ │ ├── LCP_DAC_VAR.cpp
│ │ │ ├── LCP_FMN.cpp
│ │ │ ├── LCP_PT.cpp
│ │ │ ├── LCP_PhiSpare.cpp
│ │ │ ├── LCP_Sad.cpp
│ │ │ ├── LCP_naive.cpp
│ │ │ ├── NPR.cpp
│ │ │ ├── NPR_CN.cpp
│ │ │ ├── NPR_FMN.cpp
│ │ │ ├── NSV.cpp
│ │ │ ├── PSV.cpp
│ │ │ ├── RMQ_succinct.cpp
│ │ │ ├── RMQ_succinct_lcp.cpp
│ │ │ ├── SuffixTree.cpp
│ │ │ ├── SuffixTreeY.cpp
│ │ │ ├── factorization.cpp
│ │ │ └── factorization_var.cpp
│ │ └── textindex
│ │ │ ├── TextIndex.cpp
│ │ │ ├── TextIndexCSA.cpp
│ │ │ ├── comparray4.cpp
│ │ │ ├── mmap.cpp
│ │ │ ├── qsufsort.cpp
│ │ │ └── suftest3.test.cpp
│ └── utils
│ │ ├── Array.cpp
│ │ ├── BitString.cpp
│ │ ├── cppUtils.cpp
│ │ └── timing.cpp
├── tests
│ ├── Makefile.am
│ ├── testArray.cpp
│ ├── testBitSequence.cpp
│ ├── testHuffman.cpp
│ ├── testLCP.cpp
│ ├── testNPR.cpp
│ ├── testQuantile.cpp
│ ├── testSequence.cpp
│ ├── testSuffixTree.cpp
│ ├── testTextIndex.cpp
│ ├── timeSequence.cpp
│ ├── toArray.cpp
│ └── toArray2.cpp
└── tutorial
│ ├── src
│ ├── ArrayExample.cpp
│ ├── ArrayExample2.cpp
│ ├── BitSequenceRGExample.cpp
│ ├── BitSequenceRRRExample.cpp
│ ├── BitSequenceSDArrayExample.cpp
│ ├── Makefile
│ ├── SequenceAlphPartExample.cpp
│ ├── SequenceGMRExample.cpp
│ └── SequenceWaveletTreeExample.cpp
│ ├── ssa
│ ├── Makefile
│ ├── build_index.cpp
│ ├── dump_bwt.cpp
│ ├── ssa.cpp
│ ├── ssa.h
│ └── test_count.cpp
│ └── tutorial.pdf
├── libhdt
├── .cproject
├── .gitignore
├── .project
├── COPYRIGHT
├── Doxyfile
├── Makefile.am
├── README.md
├── data
│ ├── literals.hdt
│ └── test.nt
├── examples
│ ├── .gitignore
│ ├── generate.cpp
│ ├── search.cpp
│ └── statistics.cpp
├── hdt.pc.in
├── include
│ ├── ControlInformation.hpp
│ ├── Dictionary.hpp
│ ├── HDT.hpp
│ ├── HDTEnums.hpp
│ ├── HDTListener.hpp
│ ├── HDTManager.hpp
│ ├── HDTSpecification.hpp
│ ├── HDTVersion.hpp
│ ├── HDTVocabulary.hpp
│ ├── Header.hpp
│ ├── Iterator.hpp
│ ├── RDF.hpp
│ ├── RDFParser.hpp
│ ├── RDFSerializer.hpp
│ ├── SingleTriple.hpp
│ └── Triples.hpp
├── presets
│ ├── bitmaphuff.hdtcfg
│ ├── bitmaplog.hdtcfg
│ ├── bitmapwavelet.hdtcfg
│ ├── compacthuff.hdtcfg
│ ├── compactlog.hdtcfg
│ ├── dictionaryfour.hdtcfg
│ ├── dictionaryliteral.hdtcfg
│ ├── fmindex.hdtcfg
│ ├── ops.hdtcfg
│ ├── plain.hdtcfg
│ ├── plainlog.hdtcfg
│ ├── tripleslist.hdtcfg
│ └── wrong_dictionaryfour.hdtcfg
├── src
│ ├── bitsequence
│ │ ├── BitSeq.h
│ │ ├── BitSequence375.cpp
│ │ └── BitSequence375.h
│ ├── dictionary
│ │ ├── FourSectionDictionary.cpp
│ │ ├── FourSectionDictionary.hpp
│ │ ├── KyotoDictionary.cpp
│ │ ├── KyotoDictionary.hpp
│ │ ├── LiteralDictionary.cpp
│ │ ├── LiteralDictionary.hpp
│ │ ├── PlainDictionary.cpp
│ │ └── PlainDictionary.hpp
│ ├── hdt
│ │ ├── BasicHDT.cpp
│ │ ├── BasicHDT.hpp
│ │ ├── BasicModifiableHDT.cpp
│ │ ├── BasicModifiableHDT.hpp
│ │ ├── ControlInformation.cpp
│ │ ├── HDTFactory.cpp
│ │ ├── HDTFactory.hpp
│ │ ├── HDTManager.cpp
│ │ ├── HDTSpecification.cpp
│ │ ├── TripleIDStringIterator.cpp
│ │ └── TripleIDStringIterator.hpp
│ ├── header
│ │ ├── PlainHeader.cpp
│ │ └── PlainHeader.hpp
│ ├── huffman
│ │ ├── Huffman.cpp
│ │ ├── Huffman.h
│ │ ├── huff.cpp
│ │ └── huff.h
│ ├── libdcs
│ │ ├── CSD.cpp
│ │ ├── CSD.h
│ │ ├── CSD_Cache.cpp
│ │ ├── CSD_Cache.h
│ │ ├── CSD_Cache2.cpp
│ │ ├── CSD_Cache2.h
│ │ ├── CSD_FMIndex.cpp
│ │ ├── CSD_FMIndex.h
│ │ ├── CSD_HTFC.cpp
│ │ ├── CSD_HTFC.h
│ │ ├── CSD_PFC.cpp
│ │ ├── CSD_PFC.h
│ │ ├── VByte.cpp
│ │ ├── VByte.h
│ │ ├── fmindex
│ │ │ ├── SSA.cpp
│ │ │ ├── SSA.h
│ │ │ ├── SuffixArray.cpp
│ │ │ └── SuffixArray.h
│ │ └── hutucker
│ │ │ ├── binarynode.h
│ │ │ └── hutucker.h
│ ├── rdf
│ │ ├── RDFParser.cpp
│ │ ├── RDFParserNtriples.cpp
│ │ ├── RDFParserNtriples.hpp
│ │ ├── RDFParserSerd.cpp
│ │ ├── RDFParserSerd.hpp
│ │ ├── RDFSerializer.cpp
│ │ ├── RDFSerializerNTriples.cpp
│ │ ├── RDFSerializerNTriples.hpp
│ │ ├── RDFSerializerSerd.cpp
│ │ └── RDFSerializerSerd.hpp
│ ├── sequence
│ │ ├── AdjacencyList.cpp
│ │ ├── AdjacencyList.hpp
│ │ ├── ArraySequence.cpp
│ │ ├── ArraySequence.hpp
│ │ ├── HuffmanSequence.cpp
│ │ ├── HuffmanSequence.hpp
│ │ ├── IntSequence.cpp
│ │ ├── IntSequence.hpp
│ │ ├── LogSequence.cpp
│ │ ├── LogSequence.hpp
│ │ ├── LogSequence2.cpp
│ │ ├── LogSequence2.hpp
│ │ ├── WaveletSequence.cpp
│ │ └── WaveletSequence.hpp
│ ├── sparql
│ │ ├── BaseJoinBinding.hpp
│ │ ├── CachedBinding.hpp
│ │ ├── IndexJoinBinding.cpp
│ │ ├── IndexJoinBinding.hpp
│ │ ├── JoinAlgorithms.cpp
│ │ ├── JoinAlgorithms.hpp
│ │ ├── MergeJoinBinding.cpp
│ │ ├── MergeJoinBinding.hpp
│ │ ├── QueryProcessor.cpp
│ │ ├── QueryProcessor.hpp
│ │ ├── SortBinding.cpp
│ │ ├── SortBinding.hpp
│ │ ├── TriplePatternBinding.cpp
│ │ ├── TriplePatternBinding.hpp
│ │ ├── VarBindingInterface.hpp
│ │ ├── VarFilterBinding.hpp
│ │ └── joins.hpp
│ ├── triples
│ │ ├── BitmapTriples.cpp
│ │ ├── BitmapTriples.hpp
│ │ ├── BitmapTriplesIterators.cpp
│ │ ├── PlainTriples.cpp
│ │ ├── PlainTriples.hpp
│ │ ├── TripleIterators.cpp
│ │ ├── TripleIterators.hpp
│ │ ├── TripleListDisk.cpp
│ │ ├── TripleListDisk.hpp
│ │ ├── TripleOrderConvert.cpp
│ │ ├── TripleOrderConvert.hpp
│ │ ├── TriplesComparator.cpp
│ │ ├── TriplesComparator.hpp
│ │ ├── TriplesKyoto.cpp
│ │ ├── TriplesKyoto.hpp
│ │ ├── TriplesList.cpp
│ │ ├── TriplesList.hpp
│ │ ├── predicateindex.cpp
│ │ └── predicateindex.hpp
│ └── util
│ │ ├── Histogram.h
│ │ ├── StopWatch.cpp
│ │ ├── StopWatch.hpp
│ │ ├── bitutil.cpp
│ │ ├── bitutil.h
│ │ ├── crc16.cpp
│ │ ├── crc16.h
│ │ ├── crc32.cpp
│ │ ├── crc32.h
│ │ ├── crc8.cpp
│ │ ├── crc8.h
│ │ ├── fdstream.hpp
│ │ ├── fileUtil.cpp
│ │ ├── fileUtil.hpp
│ │ ├── filemap.cpp
│ │ ├── filemap.h
│ │ ├── getopt.c
│ │ ├── lru_cache.h
│ │ ├── lrucache.hpp
│ │ ├── mygetopt.h
│ │ ├── propertyutil.cpp
│ │ ├── propertyutil.h
│ │ └── unicode.hpp
├── tests
│ ├── .gitignore
│ ├── Makefile.am
│ ├── README.md
│ ├── bit375.cpp
│ ├── bitutiltest.cpp
│ ├── c11.cpp
│ ├── cmp.cpp
│ ├── confm.cpp
│ ├── conops.cpp
│ ├── conpfc.cpp
│ ├── convert.cpp
│ ├── conwav.cpp
│ ├── csd.cpp
│ ├── dic.cpp
│ ├── dictionaries.cpp
│ ├── dumpDictionary.cpp
│ ├── filterSearch.cpp
│ ├── genCache.cpp
│ ├── genIndex.cpp
│ ├── getSuggestions.cpp
│ ├── getobj.cpp
│ ├── hdt2rdfNotMapping.cpp
│ ├── hdtExtract.cpp
│ ├── iter.cpp
│ ├── joinsearch.cpp
│ ├── jointest.cpp
│ ├── kyoto.cpp
│ ├── listener.cpp
│ ├── logarr.cpp
│ ├── mergeHDT.cpp
│ ├── mincor.cpp
│ ├── naiveComplete.cpp
│ ├── opendic.cpp
│ ├── parse.cpp
│ ├── patsearch.cpp
│ ├── popcnt.cpp
│ ├── properties.cpp
│ ├── randomSolution.cpp
│ ├── serd.cpp
│ ├── streamtest.cpp
│ ├── testmax.cpp
│ ├── userHeaderStats.cpp
│ └── wav.cpp
├── third
│ ├── fdstream.hpp
│ ├── gzstream.cpp
│ └── gzstream.h
└── tools
│ ├── .gitignore
│ ├── Makefile.am
│ ├── hdt2rdf.cpp
│ ├── hdtInfo.cpp
│ ├── hdtSearch.cpp
│ ├── modifyHeader.cpp
│ ├── rdf2hdt.cpp
│ ├── replaceHeader.cpp
│ └── searchHeader.cpp
├── m4
├── .gitignore
├── 00gnulib.m4
├── ax_cxx_compile_stdcxx.m4
├── ax_cxx_compile_stdcxx_11.m4
├── ax_require_defined.m4
├── gnulib-cache.m4
├── gnulib-common.m4
├── gnulib-comp.m4
├── gnulib-tool.m4
├── onceonly.m4
└── warnings.m4
└── rdf2hdt
├── .gitignore
├── rdf2hdt.cpp
└── rdf2hdt.pro
/.dockerignore:
--------------------------------------------------------------------------------
1 | .dockerignore
2 | .git
3 | .gitignore
4 | .travis.yml
5 | Dockerfile
6 | README.md
7 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | # Others
2 | *~
3 | .ycm_extra_conf.py
4 | # vim
5 | *.swp
6 |
7 | # C++ builds
8 | *.o
9 | *.so
10 | *.a
11 | *.out
12 | *.lo
13 | *.la
14 | .dirstamp
15 |
16 | # Wasm files
17 | *.wasm
18 |
19 | # Executables
20 | hdt2rdf
21 | hdtInfo
22 | hdtSearch
23 | rdf2hdt
24 | replaceHeader
25 | libhdt/examples/*
26 | libhdt/.libs
27 | libcds/.libs
28 |
29 | # Autotools
30 | m4/
31 | *.pc
32 | build/
33 | autom4te.cache/
34 | config.log
35 | config.status
36 | configure
37 | Makefile
38 | Makefile.in
39 | libtool
40 | aclocal.m4
41 |
42 | .DS_Store
43 | *.pro.user
44 | *.o
45 | unix
46 | macx
47 | win32
48 | delete_me
49 | Makefile
50 | README
51 | autom4te.cache/
52 | config.h
53 | *~
54 | config.log
55 | config.status
56 | stamp-h1
57 | .deps/
58 |
59 | *.hdt
60 | *.hdt.index*
61 | *.nq
62 | *.nt
63 | *.rdf
64 | *.trig
65 | *.ttl
66 | *.a
67 | **/examples/*
68 | **/tests/*
69 | libcds-v1.0.12/includes
70 | !**/examples/*.cpp
71 | !**/tests/*.cpp
72 | *.o
73 | *.lo
74 | .deps
75 |
--------------------------------------------------------------------------------
/Dockerfile:
--------------------------------------------------------------------------------
1 | FROM gcc:bullseye as build
2 |
3 | # Install build dependencies
4 | RUN apt update; \
5 | apt install -y --no-install-recommends \
6 | autoconf \
7 | build-essential \
8 | liblzma-dev \
9 | liblzo2-dev \
10 | libraptor2-dev \
11 | libserd-dev \
12 | libtool \
13 | zlib1g-dev \
14 | ; \
15 | rm -rf /var/lib/apt/lists/*;
16 |
17 | WORKDIR /usr/local/src/hdt-cpp
18 | COPY . .
19 |
20 | # Install HDT tools
21 | RUN ./autogen.sh && ./configure
22 | RUN make -j4
23 | RUN make install
24 |
25 | FROM debian:bullseye-slim
26 |
27 | # Install runtime dependencies
28 | RUN apt update; \
29 | apt install -y --no-install-recommends \
30 | libserd-0-0 \
31 | ; \
32 | rm -rf /var/lib/apt/lists/*;
33 |
34 | # Copy in libraries and binaries from build stage.
35 | COPY --from=build \
36 | /usr/local/lib/libcds* \
37 | /usr/local/lib/libhdt* \
38 | /usr/local/lib/
39 | COPY --from=build \
40 | /usr/local/lib64/libstdc++.* \
41 | /usr/local/lib64/
42 | COPY --from=build \
43 | /usr/local/bin/hdt2rdf \
44 | /usr/local/bin/hdtInfo \
45 | /usr/local/bin/hdtSearch \
46 | /usr/local/bin/modifyHeader \
47 | /usr/local/bin/rdf2hdt \
48 | /usr/local/bin/replaceHeader \
49 | /usr/local/bin/searchHeader \
50 | /usr/local/bin/
51 |
52 | # Add /usr/local/lib to LD_LIBRARY_PATH.
53 | ENV LD_LIBRARY_PATH=/usr/local/lib:/usr/local/lib64:$LD_LIBRARY_PATH
54 |
55 | CMD ["/bin/echo", "Available commands: rdf2hdt hdt2rdf hdtInfo hdtSearch modifyHeader replaceHeader searchHeader"]
56 |
--------------------------------------------------------------------------------
/Makefile.am:
--------------------------------------------------------------------------------
1 | AUTOMAKE_OPTIONS = subdir-objects
2 | SUBDIRS = libcds libhdt
3 | ACLOCAL_AMFLAGS = -I m4
4 | EXTRA_DIST = m4/gnulib-cache.m4
5 |
--------------------------------------------------------------------------------
/autogen.sh:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env bash
2 |
3 | #Before running this file, make sure that gnulib.sh was executed
4 | # or that m4 directory contains gnulib-*.m4 files
5 |
6 | aclocal -I m4 --install
7 | autoreconf --install --force
8 |
--------------------------------------------------------------------------------
/gnulib.sh:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env bash
2 | gnulib-tool --import warnings
3 |
--------------------------------------------------------------------------------
/hdt-it/.gitignore:
--------------------------------------------------------------------------------
1 | Makefile
2 | Makefile.Debug
3 | Makefile.Release
4 | unix/
5 | win32/
6 | macx/
7 | hdt-it.pro.user*
8 | object_script.*
9 |
--------------------------------------------------------------------------------
/hdt-it/.project:
--------------------------------------------------------------------------------
1 |
2 |
3 | hdt-it
4 |
5 |
6 |
7 |
8 |
9 | org.eclipse.cdt.managedbuilder.core.genmakebuilder
10 | clean,full,incremental,
11 |
12 |
13 |
14 |
15 | org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder
16 | full,incremental,
17 |
18 |
19 |
20 |
21 |
22 | org.eclipse.cdt.core.cnature
23 | org.eclipse.cdt.core.ccnature
24 | org.eclipse.cdt.managedbuilder.core.managedBuildNature
25 | org.eclipse.cdt.managedbuilder.core.ScannerConfigNature
26 |
27 |
28 |
--------------------------------------------------------------------------------
/hdt-it/Color.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Color.h
3 | *
4 | * Created on: 04/03/2011
5 | * Author: mck
6 | */
7 |
8 | #ifndef COLOR_H_
9 | #define COLOR_H_
10 |
11 | #include
12 |
13 | class Color {
14 | public:
15 | double r,g,b,a;
16 |
17 | public:
18 | Color();
19 | Color(double r, double g, double b);
20 | Color(double r, double g, double b, double a);
21 | virtual ~Color();
22 |
23 | void use();
24 | void invert();
25 |
26 | void setRGB(double r, double g, double b);
27 | void setRGBA(double r, double g, double b, double a);
28 | void setHSV(double h, double s, double v);
29 | QColor asQColor();
30 | };
31 |
32 | class ColorRamp {
33 | public:
34 | virtual void apply(Color *co, double v, double vmin, double vmax)=0;
35 | };
36 |
37 |
38 | class ColorRamp1 : public ColorRamp {
39 | public:
40 | void apply(Color *co, double v, double vmin, double vmax);
41 | };
42 |
43 |
44 | class ColorRamp2 : public ColorRamp {
45 | public:
46 | void apply(Color *co, double v, double vmin, double vmax);
47 | };
48 |
49 | #endif /* COLOR_H_ */
50 |
--------------------------------------------------------------------------------
/hdt-it/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleIconFile
6 | hdtico.icns
7 | CFBundlePackageType
8 | APPL
9 | CFBundleGetInfoString
10 | Created by Qt/QMake
11 | CFBundleSignature
12 | ????
13 | CFBundleExecutable
14 | HDT-it
15 | CFBundleIdentifier
16 | org.rdfhdt.HDT-it
17 | CFBundleDocumentTypes
18 |
19 |
20 | CFBundleTypeExtensions
21 |
22 | hdt
23 |
24 | CFBundleTypeIconFile
25 | hdtico.icns
26 | CFBundleTypeMIMETypes
27 |
28 | binary/rdf-hdt
29 |
30 | CFBundleTypeName
31 | HDT RDF File
32 | CFBundleTypeRole
33 | Editor
34 | LSIsAppleDefaultForType
35 |
36 |
37 |
38 | CFBundleTypeExtensions
39 |
40 | hdt.gz
41 |
42 | CFBundleTypeIconFile
43 | hdtico.icns
44 | CFBundleTypeMIMETypes
45 |
46 | binary/rdf-hdt
47 |
48 | CFBundleTypeName
49 | HDT RDF File
50 | CFBundleTypeRole
51 | Editor
52 | LSIsAppleDefaultForType
53 |
54 |
55 |
56 |
57 |
58 |
59 |
--------------------------------------------------------------------------------
/hdt-it/StopWatch.hpp:
--------------------------------------------------------------------------------
1 | /*
2 | * StopWatch.hpp
3 | *
4 | * Created on: 03/03/2011
5 | * Author: mck
6 | */
7 |
8 | #ifndef STOPWATCH_HPP_
9 | #define STOPWATCH_HPP_
10 |
11 | #ifdef WIN32
12 | #include
13 | #else
14 | # include
15 | # include
16 | #endif
17 |
18 | #include
19 | #include
20 |
21 | class StopWatch {
22 | private:
23 |
24 | #ifdef WIN32
25 | LARGE_INTEGER frequency;
26 | LARGE_INTEGER startCount;
27 | LARGE_INTEGER endCount;
28 | #else
29 | struct timeval user1, user2;
30 | struct timeval system1, system2;
31 | struct timeval real1, real2;
32 | #endif
33 |
34 | public:
35 | StopWatch();
36 |
37 | void reset();
38 | void stop();
39 |
40 | unsigned long long getUser();
41 | unsigned long long getSystem();
42 | unsigned long long getReal();
43 |
44 | std::string getUserStr();
45 | std::string getSystemStr();
46 | std::string getRealStr();
47 |
48 | unsigned long long stopUser();
49 | unsigned long long stopSystem();
50 | unsigned long long stopReal();
51 |
52 | std::string stopUserStr();
53 | std::string stopSystemStr();
54 | std::string stopRealStr();
55 |
56 | static std::string toHuman(unsigned long long time);
57 |
58 | friend std::ostream &operator<<(std::ostream &stream, StopWatch &sw);
59 | };
60 |
61 | #endif /* STOPWATCH_HPP_ */
62 |
--------------------------------------------------------------------------------
/hdt-it/abouthdt.cpp:
--------------------------------------------------------------------------------
1 | #include "abouthdt.hpp"
2 | #include "ui_abouthdt.h"
3 |
4 | Abouthdt::Abouthdt(QWidget *parent) :
5 | QDialog(parent),
6 | ui(new Ui::Abouthdt)
7 | {
8 | ui->setupUi(this);
9 | }
10 |
11 | Abouthdt::~Abouthdt()
12 | {
13 | delete ui;
14 | }
15 |
--------------------------------------------------------------------------------
/hdt-it/abouthdt.hpp:
--------------------------------------------------------------------------------
1 | #ifndef ABOUTHDT_HPP
2 | #define ABOUTHDT_HPP
3 |
4 | #include
5 |
6 | namespace Ui {
7 | class Abouthdt;
8 | }
9 |
10 | class Abouthdt : public QDialog
11 | {
12 | Q_OBJECT
13 |
14 | public:
15 | explicit Abouthdt(QWidget *parent = 0);
16 | ~Abouthdt();
17 |
18 | private:
19 | Ui::Abouthdt *ui;
20 | };
21 |
22 | #endif // ABOUTHDT_HPP
23 |
--------------------------------------------------------------------------------
/hdt-it/colors.hpp:
--------------------------------------------------------------------------------
1 | #ifndef COLORS_HPP
2 | #define COLORS_HPP
3 |
4 | #define SCREEN
5 |
6 | #ifndef SCREEN
7 | #define TEXT_COLOR 0.0, 0.0, 0.0, 1.0
8 | #define CROSS_COLOR 1.0, 0.0, 0.0, 1.0
9 | #define TEXT_BACKGROUND_COLOR 1.0, 1.0, 1.0, 0.9
10 | #define BACKGROUND_COLOR 1, 1, 1, 1
11 | #define SHARED_AREA_COLOR 0.9, 0.9, 0.9, 1.0
12 | #define SHARED_AREA_BORDER_COLOR 0.1, 0.1, 0.1, 1.0
13 | #define AXIS_COLOR 0.1, 0.1, 0.1, 1.0
14 | #define GRID_COLOR 0.3, 0.3, 0.3, 1.0
15 | #define RDF_POINT_SIZE 1.5
16 | #else
17 | #define TEXT_COLOR 1.0, 1.0, 1.0, 1.0
18 | #define CROSS_COLOR 1.0, 1.0, 1.0, 1.0
19 | #define TEXT_BACKGROUND_COLOR 0.0, 0.0, 0.0, 0.7
20 | #define BACKGROUND_COLOR 0, 0, 0, 1
21 | #define SHARED_AREA_COLOR 0.2, 0.2, 0.2, 1.0
22 | #define SHARED_AREA_BORDER_COLOR 0.3, 0.3, 0.3, 1.0
23 | #define AXIS_COLOR 0.8, 0.8, 0.8, 1.0
24 | #define GRID_COLOR 0.2, 0.2, 0.2, 1.0
25 | #define RDF_POINT_SIZE 1
26 | #endif
27 |
28 |
29 | #endif // COLORS_HPP
30 |
--------------------------------------------------------------------------------
/hdt-it/constants.h:
--------------------------------------------------------------------------------
1 | /*
2 | * constants.h
3 | *
4 | * Created on: 04/03/2011
5 | * Author: mck
6 | */
7 |
8 | #ifndef CONSTANTS_H_
9 | #define CONSTANTS_H_
10 |
11 | #define TIMER_DELAY 50
12 | #define RENDER_NUM_POINTS 100000
13 |
14 | #define SCREEN
15 |
16 | #ifndef SCREEN
17 | #define TEXT_COLOR 0.0, 0.0, 0.0, 1.0
18 | #define CROSS_COLOR 1.0, 0.0, 0.0, 1.0
19 | #define TEXT_BACKGROUND_COLOR 1.0, 1.0, 1.0, 0.9
20 | #define BACKGROUND_COLOR 1, 1, 1, 1
21 | #define SHARED_AREA_COLOR 0.9, 0.9, 0.9, 1.0
22 | #define SHARED_AREA_BORDER_COLOR 0.1, 0.1, 0.1, 1.0
23 | #define AXIS_COLOR 0.1, 0.1, 0.1, 1.0
24 | #define GRID_COLOR 0.3, 0.3, 0.3, 1.0
25 | #define RDF_POINT_SIZE 1.5
26 | #else
27 | #define TEXT_COLOR 1.0, 1.0, 1.0, 1.0
28 | #define CROSS_COLOR 0.0, 0.0, 0.0, 1.0
29 | #define TEXT_BACKGROUND_COLOR 0.0, 0.0, 0.0, 0.7
30 | #define BACKGROUND_COLOR 0, 0, 0, 1
31 | #define SHARED_AREA_COLOR 0.1, 0.1, 0.1, 1.0
32 | #define SHARED_AREA_BORDER_COLOR 0.2, 0.2, 0.2, 1.0
33 | #define AXIS_COLOR 0.8, 0.8, 0.8, 1.0
34 | #define GRID_COLOR 0.2, 0.2, 0.2, 1.0
35 | #define RDF_POINT_SIZE 1
36 | #endif
37 |
38 |
39 | #endif /* CONSTANTS_H_ */
40 |
--------------------------------------------------------------------------------
/hdt-it/dictionarysuggestions.hpp:
--------------------------------------------------------------------------------
1 | #ifndef DICTIONARYSUGGESTIONS_HPP
2 | #define DICTIONARYSUGGESTIONS_HPP
3 |
4 | #include
5 | #include
6 |
7 | #include
8 |
9 | QT_BEGIN_NAMESPACE
10 | class QLineEdit;
11 | class QTimer;
12 | class QTreeWidget;
13 | QT_END_NAMESPACE
14 |
15 | class DictionarySuggestions : public QObject
16 | {
17 | Q_OBJECT
18 | public:
19 | explicit DictionarySuggestions(QLineEdit *parent = 0);
20 | ~DictionarySuggestions();
21 | bool eventFilter(QObject *obj, QEvent *ev);
22 | void showCompletion(const vector &choices);
23 | void setController(HDTController *controller);
24 | void setRole(hdt::TripleComponentRole role);
25 |
26 | public slots:
27 | void doneCompletion();
28 | void preventSuggest();
29 | void autoSuggest();
30 |
31 | private:
32 | QLineEdit *editor;
33 | QTreeWidget *popup;
34 | QTimer *timer;
35 | HDTController *controller;
36 | hdt::TripleComponentRole role;
37 | };
38 |
39 | #endif // DICTIONARYSUGGESTIONS_HPP
40 |
--------------------------------------------------------------------------------
/hdt-it/doc/hdtit.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/rdfhdt/hdt-cpp/88110cc24d4d7d07080b40325d1905fae999ef95/hdt-it/doc/hdtit.png
--------------------------------------------------------------------------------
/hdt-it/doc/matrix.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/rdfhdt/hdt-cpp/88110cc24d4d7d07080b40325d1905fae999ef95/hdt-it/doc/matrix.png
--------------------------------------------------------------------------------
/hdt-it/editreset.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/rdfhdt/hdt-cpp/88110cc24d4d7d07080b40325d1905fae999ef95/hdt-it/editreset.png
--------------------------------------------------------------------------------
/hdt-it/hdt-it_es.qm:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/rdfhdt/hdt-cpp/88110cc24d4d7d07080b40325d1905fae999ef95/hdt-it/hdt-it_es.qm
--------------------------------------------------------------------------------
/hdt-it/hdtcachedinfo.hpp:
--------------------------------------------------------------------------------
1 | #ifndef HDTCACHEDINFO_HPP
2 | #define HDTCACHEDINFO_HPP
3 |
4 | #include
5 | #include
6 | #include
7 | #include "StopWatch.hpp"
8 |
9 | #include "Color.h"
10 |
11 |
12 | class HDTCachedInfo
13 | {
14 | private:
15 |
16 | hdt::HDT *hdt;
17 | vector triples;
18 |
19 | vector predicateColors;
20 | size_t maxPredicateCount;
21 | vector predicateCount;
22 |
23 | public:
24 | HDTCachedInfo(hdt::HDT *hdt);
25 |
26 | Color *getPredicateColor(size_t npred);
27 | size_t getPredicateUsages(size_t predicate);
28 | size_t getMaxPredicateCount();
29 | vector &getTriples();
30 |
31 | void generateGeneralInfo(hdt::ProgressListener *listener=NULL);
32 | void generateMatrix(hdt::ProgressListener *listener=NULL);
33 |
34 | void save(QString &fileName, hdt::ProgressListener *listener=NULL);
35 | void load(QString &fileName, hdt::ProgressListener *listener=NULL);
36 | };
37 |
38 | #endif // HDTCACHEDINFO_HPP
39 |
--------------------------------------------------------------------------------
/hdt-it/hdtico.icns:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/rdfhdt/hdt-cpp/88110cc24d4d7d07080b40325d1905fae999ef95/hdt-it/hdtico.icns
--------------------------------------------------------------------------------
/hdt-it/hdtico.rc:
--------------------------------------------------------------------------------
1 | IDI_ICON1 ICON DISCARDABLE "hdtwinico2.ico"
2 |
--------------------------------------------------------------------------------
/hdt-it/hdtresources.qrc:
--------------------------------------------------------------------------------
1 |
2 |
3 | editreset.png
4 | logo-hdt.png
5 | loading.gif
6 |
7 |
8 |
--------------------------------------------------------------------------------
/hdt-it/hdtspecform.hpp:
--------------------------------------------------------------------------------
1 | #ifndef HDTSPECFORM_HPP
2 | #define HDTSPECFORM_HPP
3 |
4 | #include
5 |
6 | #include
7 | #include
8 | #include
9 |
10 | namespace Ui {
11 | class HDTSpecForm;
12 | }
13 |
14 | class HDTSpecForm : public QDialog
15 | {
16 | Q_OBJECT
17 |
18 | public:
19 | explicit HDTSpecForm(QWidget *parent = 0);
20 | ~HDTSpecForm();
21 |
22 | public:
23 | QString getFileName();
24 | QString getBaseUri();
25 | void fillHDTSpecification(hdt::HDTSpecification &spec);
26 | hdt::RDFNotation getNotation();
27 |
28 | private:
29 | Ui::HDTSpecForm *ui;
30 | std::string getStreamType(int index);
31 |
32 | private slots:
33 | void on_triplesTypeCombo_currentIndexChanged(int index);
34 | void on_inputFileButton_clicked();
35 | void accept();
36 | };
37 |
38 | #endif // HDTSPECFORM_HPP
39 |
--------------------------------------------------------------------------------
/hdt-it/hdtsummarygenerator.hpp:
--------------------------------------------------------------------------------
1 | #ifndef HDTSUMMARYGENERATOR_HPP
2 | #define HDTSUMMARYGENERATOR_HPP
3 |
4 | #include
5 | #include
6 | #include "hdtcontroller.hpp"
7 |
8 | class HDTSummaryGenerator : public QObject
9 | {
10 | Q_OBJECT
11 | public:
12 | static QString getSummary(HDTController *hdtController);
13 | };
14 |
15 | #endif // HDTSUMMARYGENERATOR_HPP
16 |
--------------------------------------------------------------------------------
/hdt-it/hdtwinico.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/rdfhdt/hdt-cpp/88110cc24d4d7d07080b40325d1905fae999ef95/hdt-it/hdtwinico.ico
--------------------------------------------------------------------------------
/hdt-it/hdtwinico2.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/rdfhdt/hdt-cpp/88110cc24d4d7d07080b40325d1905fae999ef95/hdt-it/hdtwinico2.ico
--------------------------------------------------------------------------------
/hdt-it/headermodel.hpp:
--------------------------------------------------------------------------------
1 | #ifndef HEADERMODEL_HPP
2 | #define HEADERMODEL_HPP
3 |
4 | #include
5 |
6 | #include
7 |
8 | #include "hdtcontroller.hpp"
9 |
10 | class HDTController;
11 |
12 | class HeaderModel : public QAbstractTableModel {
13 | Q_OBJECT
14 | private:
15 | HDTController *hdtController;
16 | hdt::IteratorTripleString *triples;
17 | hdt::TripleString *currentTriple;
18 | unsigned int currentIndex;
19 |
20 | void findTriple(unsigned int index);
21 |
22 | public:
23 | HeaderModel(HDTController *view);
24 | ~HeaderModel();
25 |
26 | int rowCount(const QModelIndex &parent = QModelIndex()) const ;
27 | int columnCount(const QModelIndex &parent = QModelIndex()) const;
28 | Qt::ItemFlags flags(const QModelIndex &index) const;
29 | QVariant headerData(int section, Qt::Orientation orientation, int role) const;
30 | QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const;
31 | bool setData(const QModelIndex & index, const QVariant & value, int role);
32 |
33 | void updateDatasetChanged();
34 | signals:
35 | };
36 |
37 |
38 | #endif // HEADERMODEL_HPP
39 |
--------------------------------------------------------------------------------
/hdt-it/loading.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/rdfhdt/hdt-cpp/88110cc24d4d7d07080b40325d1905fae999ef95/hdt-it/loading.gif
--------------------------------------------------------------------------------
/hdt-it/logo-hdt.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/rdfhdt/hdt-cpp/88110cc24d4d7d07080b40325d1905fae999ef95/hdt-it/logo-hdt.png
--------------------------------------------------------------------------------
/hdt-it/logo-hdt2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/rdfhdt/hdt-cpp/88110cc24d4d7d07080b40325d1905fae999ef95/hdt-it/logo-hdt2.png
--------------------------------------------------------------------------------
/hdt-it/main.cpp:
--------------------------------------------------------------------------------
1 |
2 | #include
3 | #include
4 | #include
5 | #include "myapplication.hpp"
6 | #include "hdtit.hpp"
7 |
8 | #include
9 |
10 | int main(int argc, char *argv[])
11 | {
12 | MyApplication a(argc, argv);
13 |
14 | QTranslator qtTranslator;
15 | qtTranslator.load("qt_" + QLocale::system().name(),
16 | QLibraryInfo::location(QLibraryInfo::TranslationsPath));
17 | a.installTranslator(&qtTranslator);
18 |
19 | QTranslator myappTranslator;
20 | #ifdef __APPLE__
21 | myappTranslator.load("../Resources/hdt-it_"+QLocale::system().name());
22 | #else
23 | myappTranslator.load("hdt-it_"+QLocale::system().name());
24 | #endif
25 | a.installTranslator(&myappTranslator);
26 |
27 | HDTit w;
28 |
29 | a.setHDTit(&w);
30 |
31 | w.show();
32 |
33 | if(argc>1) {
34 | QString str(argv[1]);
35 | w.openHDTFile(str);
36 | }
37 |
38 | return a.exec();
39 | }
40 |
--------------------------------------------------------------------------------
/hdt-it/matrixviewwidget.hpp:
--------------------------------------------------------------------------------
1 | #ifndef MATRIXVIEWWIDGET_HPP
2 | #define MATRIXVIEWWIDGET_HPP
3 |
4 | #include
5 | #include
6 | #include
7 |
8 | #ifdef __APPLE__
9 | #include
10 | #else
11 | #include
12 | #endif
13 |
14 | #include
15 | #include
16 |
17 | #include "colors.hpp"
18 | #include "Camera.h"
19 | #include "StopWatch.hpp"
20 |
21 | #include "hdtcontroller.hpp"
22 | #include "searchresultsmodel.hpp"
23 | #include "triplecomponentmodel.hpp"
24 |
25 | class SearchResultsModel;
26 | class TripleComponentModel;
27 | class HDTController;
28 |
29 | #ifdef __APPLE__
30 | //#define GESTURES
31 | #endif
32 |
33 | class MatrixViewWidget : public QGLWidget
34 | {
35 | Q_OBJECT
36 |
37 | private:
38 | QTimer timer;
39 | Camera camera;
40 | int lastX, lastY, lastClickX, lastClickY, buttonClick;
41 | HDTController *hdtController;
42 |
43 | void unProject(int x, int y, double *outx, double *outy, double *outz);
44 |
45 | void paintShared();
46 | void paintScales();
47 | void paintPoints();
48 | void paintSelected();
49 |
50 | public:
51 | explicit MatrixViewWidget(QWidget *parent = 0);
52 | ~MatrixViewWidget();
53 |
54 | void setManager(HDTController *hdtManager);
55 |
56 | QSize minimumSizeHint() const;
57 | QSize sizeHint() const;
58 |
59 | Camera &getCamera();
60 | protected:
61 | void initializeGL();
62 | void paintGL();
63 | void resizeGL(int width, int height);
64 | void mousePressEvent(QMouseEvent *event);
65 | void mouseReleaseEvent(QMouseEvent *event);
66 | void mouseMoveEvent(QMouseEvent *event);
67 | void wheelEvent( QWheelEvent* e );
68 | #ifdef GESTURES
69 | bool event(QEvent *);
70 | #endif
71 |
72 | public slots:
73 | void reloadHDTInfo();
74 |
75 | signals:
76 | void rotationChanged();
77 | void cameraChanged();
78 | };
79 |
80 |
81 | #endif // MATRIXVIEWWIDGET_HPP
82 |
--------------------------------------------------------------------------------
/hdt-it/myapplication.cpp:
--------------------------------------------------------------------------------
1 | #include "myapplication.hpp"
2 |
3 | MyApplication::MyApplication(int &argc, char **argv) : QApplication(argc, argv), hdtIt(NULL)
4 | {
5 | }
6 |
7 | bool MyApplication::event(QEvent *event)
8 | {
9 | switch (event->type()) {
10 | case QEvent::FileOpen:
11 | loadFile(static_cast(event)->file());
12 | return true;
13 | default:
14 | return QApplication::event(event);
15 | }
16 | }
17 |
18 | void MyApplication::loadFile(QString fileName)
19 | {
20 | if(hdtIt) {
21 | hdtIt->openHDTFile(fileName);
22 | }
23 | }
24 |
25 | void MyApplication::setHDTit(HDTit *hdtIt)
26 | {
27 | this->hdtIt=hdtIt;
28 | }
29 |
30 | bool MyApplication::notify(QObject *o, QEvent *e)
31 | {
32 | try {
33 | return QApplication::notify(o, e);
34 | } catch (char *err) {
35 | std::cerr << "Exception caugth in notify (char *): " << err << endl;
36 | } catch (const char *err) {
37 | std::cerr << "Exception caugth in notify (const char *): " << err << endl;
38 | } catch (const std::exception& ex) {
39 | std::cerr << "Exception caugth in notify (std::exception &): " << ex.what() << endl;
40 | } catch (const std::string& ex) {
41 | std::cerr << "Exception caugth in notify (std::string &): " << ex << endl;
42 | } catch (...) {
43 | std::cerr << "Unknown Exception caugth in notify: " << endl;
44 | }
45 | }
46 |
--------------------------------------------------------------------------------
/hdt-it/myapplication.hpp:
--------------------------------------------------------------------------------
1 | #ifndef MYAPPLICATION_HPP
2 | #define MYAPPLICATION_HPP
3 |
4 | #include
5 | #include "hdtit.hpp"
6 |
7 | class MyApplication : public QApplication
8 | {
9 | Q_OBJECT
10 | private:
11 | HDTit *hdtIt;
12 | void loadFile(QString fileName);
13 | public:
14 | explicit MyApplication(int &argc, char **argv);
15 | bool event(QEvent *);
16 | void setHDTit(HDTit *hdtIt);
17 | bool notify(QObject *, QEvent *);
18 | signals:
19 |
20 | public slots:
21 |
22 | };
23 |
24 | #endif // MYAPPLICATION_HPP
25 |
--------------------------------------------------------------------------------
/hdt-it/predicatestatus.hpp:
--------------------------------------------------------------------------------
1 | #ifndef PREDICATESTATUS_HPP
2 | #define PREDICATESTATUS_HPP
3 |
4 | #include
5 | #include "hdtcontroller.hpp"
6 |
7 | class PredicateStatus : public QObject
8 | {
9 | Q_OBJECT
10 | private:
11 | vector activePredicate;
12 | size_t minPredicateCount;
13 | size_t maxPredicateCount;
14 | HDTController *controller;
15 |
16 | void setMinimumPredicateCountInternal(int count);
17 | public:
18 | explicit PredicateStatus(HDTController *controller);
19 |
20 | size_t getMinimumPredicateCount();
21 | size_t getMaximumPredicateCount();
22 |
23 | bool isPredicateActive(size_t i);
24 | void setPredicateActive(size_t i, bool b);
25 |
26 | signals:
27 | void predicatesChanged(size_t min, size_t max);
28 | void minimumPredicateCountChanged(size_t newval);
29 | void predicateSelected(size_t npred);
30 |
31 | public slots:
32 | void refreshAll();
33 | void selectPredicate(size_t pred);
34 | void selectAllPredicates();
35 | void selectNonePredicates();
36 | void setMinimumPredicateCount(int count);
37 | };
38 |
39 | #endif // PREDICATESTATUS_HPP
40 |
--------------------------------------------------------------------------------
/hdt-it/qclearlineedit.cpp:
--------------------------------------------------------------------------------
1 | #include "qclearlineedit.hpp"
2 | #include
3 | #include
4 |
5 | QClearLineEdit::QClearLineEdit(QWidget *parent)
6 | : QLineEdit(parent)
7 | {
8 | clearButton = new QToolButton(this);
9 | QPixmap pixmap(":/images/editreset.png");
10 | clearButton->setIcon(QIcon(pixmap));
11 | clearButton->setIconSize(pixmap.size());
12 | clearButton->setCursor(Qt::ArrowCursor);
13 | clearButton->setStyleSheet("QToolButton { border: none; padding: 0px; }");
14 | clearButton->hide();
15 | connect(clearButton, SIGNAL(clicked()), this, SLOT(clear()));
16 | connect(this, SIGNAL(textChanged(const QString&)), this, SLOT(updateCloseButton(const QString&)));
17 | int frameWidth = style()->pixelMetric(QStyle::PM_DefaultFrameWidth);
18 | setStyleSheet(QString("QLineEdit { padding-right: %1px; } ").arg(clearButton->sizeHint().width() + frameWidth + 1));
19 | QSize msz = minimumSizeHint();
20 | setMinimumSize(qMax(msz.width(), clearButton->sizeHint().height() + frameWidth * 2 + 2),
21 | qMax(msz.height(), clearButton->sizeHint().height() + frameWidth * 2 + 2));
22 |
23 | suggestions = new DictionarySuggestions(this);
24 | }
25 |
26 | QClearLineEdit::~QClearLineEdit()
27 | {
28 | delete suggestions;
29 | delete clearButton;
30 | }
31 |
32 | void QClearLineEdit::resizeEvent(QResizeEvent *)
33 | {
34 | QSize sz = clearButton->sizeHint();
35 | int frameWidth = style()->pixelMetric(QStyle::PM_DefaultFrameWidth);
36 | clearButton->move(rect().right() - frameWidth - sz.width(),
37 | (rect().bottom() + 1 - sz.height())/2);
38 | }
39 |
40 | void QClearLineEdit::updateCloseButton(const QString& text)
41 | {
42 | clearButton->setVisible(!text.isEmpty());
43 | }
44 |
45 | DictionarySuggestions * QClearLineEdit::getSuggestions()
46 | {
47 | return suggestions;
48 | }
49 |
--------------------------------------------------------------------------------
/hdt-it/qclearlineedit.hpp:
--------------------------------------------------------------------------------
1 | #ifndef QCLEARLINEEDIT_HPP
2 | #define QCLEARLINEEDIT_HPP
3 |
4 | #include
5 |
6 | #include "dictionarysuggestions.hpp"
7 |
8 | class QToolButton;
9 |
10 | class QClearLineEdit: public QLineEdit
11 | {
12 | Q_OBJECT
13 |
14 | public:
15 | QClearLineEdit(QWidget *parent = 0);
16 | ~QClearLineEdit();
17 | DictionarySuggestions *getSuggestions();
18 |
19 | protected:
20 | void resizeEvent(QResizeEvent *);
21 |
22 | private slots:
23 | void updateCloseButton(const QString &text);
24 |
25 | private:
26 | QToolButton *clearButton;
27 | DictionarySuggestions *suggestions;
28 | };
29 |
30 | #endif // QCLEARLINEEDIT_HPP
31 |
--------------------------------------------------------------------------------
/hdt-it/regexmodel.hpp:
--------------------------------------------------------------------------------
1 | #ifndef REGEXMODEL_HPP
2 | #define REGEXMODEL_HPP
3 |
4 | #include
5 |
6 | #include "hdtcontroller.hpp"
7 |
8 | class HDTController;
9 |
10 | class RegexModel : public QAbstractTableModel
11 | {
12 | Q_OBJECT
13 |
14 | private:
15 | HDTController *hdtController;
16 | uint32_t numResults;
17 | uint32_t *results;
18 |
19 | public:
20 | explicit RegexModel(HDTController *manager);
21 | ~RegexModel();
22 |
23 | void setQuery(QString query);
24 |
25 | int rowCount(const QModelIndex &parent = QModelIndex()) const ;
26 | int columnCount(const QModelIndex &parent = QModelIndex()) const;
27 | QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const;
28 | QVariant headerData(int section, Qt::Orientation orientation, int role) const;
29 |
30 | void updateDatasetChanged();
31 | signals:
32 |
33 | public slots:
34 |
35 | };
36 |
37 | #endif // REGEXMODEL_HPP
38 |
--------------------------------------------------------------------------------
/hdt-it/resultcounter.cpp:
--------------------------------------------------------------------------------
1 | #include "resultcounter.hpp"
2 | #include
3 |
4 |
5 | ResultCounter::ResultCounter(QObject *parent, HDTController *controller) :
6 | QObject(parent),
7 | hdtController(controller),
8 | iterator(NULL)
9 | {
10 | }
11 |
12 | void ResultCounter::startCounting()
13 | {
14 | if(!hdtController->hasHDT()){
15 | return;
16 | }
17 | iterator = hdtController->getHDT()->getTriples()->search(hdtController->getSearchPatternID());
18 | shouldCancel = false;
19 | QtConcurrent::run(this, &ResultCounter::run);
20 | }
21 |
22 | void ResultCounter::cancel()
23 | {
24 | shouldCancel = true;
25 | }
26 |
27 | void ResultCounter::run()
28 | {
29 | if(iterator==NULL) {
30 | return;
31 | }
32 | StopWatch cl;
33 | unsigned int numResults = 0;
34 | while(!shouldCancel && iterator->hasNext()) {
35 | iterator->next();
36 | numResults++;
37 |
38 | cl.stop();
39 | if(cl.getReal()>10000) {
40 | cl.reset();
41 | emit numResultsChanged(numResults);
42 | }
43 | }
44 | delete iterator;
45 | iterator = NULL;
46 | emit finished();
47 | }
48 |
--------------------------------------------------------------------------------
/hdt-it/resultcounter.hpp:
--------------------------------------------------------------------------------
1 | #ifndef RESULTCOUNTER_HPP
2 | #define RESULTCOUNTER_HPP
3 |
4 | #include
5 |
6 | #include
7 |
8 | class ResultCounter : public QObject
9 | {
10 | Q_OBJECT
11 | private:
12 | HDTController *hdtController;
13 | hdt::IteratorTripleID *iterator;
14 | bool shouldCancel;
15 | public:
16 | explicit ResultCounter(QObject *parent, HDTController *hdtController);
17 |
18 | void run();
19 | signals:
20 | void numResultsChanged(int numResults);
21 | void messageChanged(QString message);
22 | void finished();
23 | private slots:
24 | void startCounting();
25 | void cancel();
26 | public slots:
27 |
28 | };
29 |
30 | #endif // RESULTCOUNTER_HPP
31 |
--------------------------------------------------------------------------------
/hdt-it/searchresultsmodel.hpp:
--------------------------------------------------------------------------------
1 | #ifndef SEARCHRESULTSMODEL_HPP
2 | #define SEARCHRESULTSMODEL_HPP
3 |
4 | #include
5 |
6 | #include
7 |
8 | #include "hdtcontroller.hpp"
9 |
10 | class HDTController;
11 |
12 | class SearchResultsModel : public QAbstractTableModel {
13 | Q_OBJECT
14 | private:
15 | HDTController *hdtController;
16 | hdt::IteratorTripleID *triples;
17 | hdt::TripleID *currentTriple;
18 | unsigned int currentIndex;
19 | unsigned int numResults;
20 | bool goingUp;
21 |
22 | void findTriple(unsigned int index);
23 |
24 | public:
25 | SearchResultsModel(HDTController *view);
26 | ~SearchResultsModel();
27 |
28 | int rowCount(const QModelIndex &parent = QModelIndex()) const ;
29 | int columnCount(const QModelIndex &parent = QModelIndex()) const;
30 | QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const;
31 | QVariant headerData(int section, Qt::Orientation orientation, int role) const;
32 |
33 | void updateResultListChanged();
34 | void updateNumResultsChanged();
35 | signals:
36 | };
37 |
38 |
39 | #endif // SEARCHRESULTSMODEL_HPP
40 |
--------------------------------------------------------------------------------
/hdt-it/sparqlform.cpp:
--------------------------------------------------------------------------------
1 | #include "sparqlform.hpp"
2 | #include "ui_sparqlform.h"
3 |
4 | #include "sparqlmodel.hpp"
5 | #include "hdtit.hpp"
6 |
7 | SparqlForm::SparqlForm(QWidget *parent) :
8 | QMainWindow(parent),
9 | ui(new Ui::SparqlForm)
10 | {
11 | ui->setupUi(this);
12 |
13 | HDTit *hdtit = reinterpret_cast(parent);
14 | sparqlModel = new SparqlModel(hdtit->getManager());
15 | ui->sparqlResultTable->setModel(sparqlModel);
16 | }
17 |
18 | SparqlForm::~SparqlForm()
19 | {
20 | delete ui;
21 | }
22 |
23 | void SparqlForm::on_pushButton_clicked()
24 | {
25 | sparqlModel->setQuery(ui->sparqlTextEdit->toPlainText());
26 | ui->sparqlResultTable->scrollToTop();
27 | }
28 |
--------------------------------------------------------------------------------
/hdt-it/sparqlform.hpp:
--------------------------------------------------------------------------------
1 | #ifndef JOINFORM_HPP
2 | #define JOINFORM_HPP
3 |
4 | #include
5 |
6 | #include "sparqlmodel.hpp"
7 |
8 | namespace Ui {
9 | class SparqlForm;
10 | }
11 |
12 | class SparqlForm : public QMainWindow
13 | {
14 | Q_OBJECT
15 |
16 | public:
17 | explicit SparqlForm(QWidget *parent = 0);
18 | ~SparqlForm();
19 |
20 | private slots:
21 | void on_pushButton_clicked();
22 |
23 | private:
24 | Ui::SparqlForm *ui;
25 | SparqlModel *sparqlModel;
26 | };
27 |
28 | #endif // JOINFORM_HPP
29 |
--------------------------------------------------------------------------------
/hdt-it/sparqlmodel.hpp:
--------------------------------------------------------------------------------
1 | #ifndef JOINMODEL_HPP
2 | #define JOINMODEL_HPP
3 |
4 | #include
5 |
6 | #include
7 |
8 | #include "hdtcontroller.hpp"
9 |
10 | class SparqlModel : public QAbstractTableModel {
11 | Q_OBJECT
12 | private:
13 | HDTController *hdtController;
14 |
15 | hdt::VarBindingString *binding;
16 | unsigned int currentIndex;
17 | unsigned int numresults;
18 | void find(unsigned int index);
19 | public:
20 | SparqlModel(HDTController *controller);
21 | virtual ~SparqlModel();
22 |
23 | void setQuery(QString query);
24 |
25 | int rowCount(const QModelIndex &parent = QModelIndex()) const ;
26 | int columnCount(const QModelIndex &parent = QModelIndex()) const;
27 | QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const;
28 | QVariant headerData(int section, Qt::Orientation orientation, int role) const;
29 | signals:
30 | };
31 |
32 | #endif // JOINMODEL_HPP
33 |
--------------------------------------------------------------------------------
/hdt-it/stringutils.cpp:
--------------------------------------------------------------------------------
1 | #include
2 |
3 | #include
4 | #include "stringutils.hpp"
5 |
6 | QString stringutils::sizeHuman(unsigned long long size)
7 | {
8 | static const char *sizes[] = { "EB", "PB", "TB", "GB", "MB", "KB", "B" };
9 | static const quint64 exbibytes = 1024ULL * 1024ULL * 1024ULL * 1024ULL * 1024ULL * 1024ULL;
10 |
11 | quint64 multiplier = exbibytes;
12 |
13 | if(size==0) {
14 | return QString("0");
15 | }
16 |
17 | for (unsigned int i = 0; i < 7; i++, multiplier /= 1024)
18 | {
19 | if (size < multiplier) {
20 | continue;
21 | }
22 |
23 | return QString("%1 %2")
24 | .arg(QString::number((double)size / multiplier, 'f', 1))
25 | .arg(sizes[i]);
26 | }
27 | return QString("0");
28 | }
29 |
30 | QString stringutils::toQString(const char *str)
31 | {
32 |
33 | QString out = QString::fromUtf8(str);
34 |
35 | return out;
36 | }
37 |
38 | QString stringutils::escapeHTML(QString in)
39 | {
40 | return in.replace("<", "<").replace(">", ">");
41 | }
42 |
43 | void stringutils::cut(QString &in, int size)
44 | {
45 | if(in.length()>size) {
46 | in = in.left(size)+"...";
47 | }
48 | }
49 |
--------------------------------------------------------------------------------
/hdt-it/stringutils.hpp:
--------------------------------------------------------------------------------
1 | #ifndef STRINGUTILS_HPP
2 | #define STRINGUTILS_HPP
3 |
4 | #include
5 | #include
6 |
7 | class stringutils
8 | {
9 | public:
10 | static QString sizeHuman(unsigned long long size);
11 | static QString toQString(const char *str);
12 | static QString escapeHTML(QString in);
13 | static void cut(QString &in, int size);
14 | };
15 |
16 |
17 |
18 | #endif // STRINGUTILS_HPP
19 |
--------------------------------------------------------------------------------
/hdt-it/triplecomponentmodel.hpp:
--------------------------------------------------------------------------------
1 | #ifndef TRIPLECOMPONENTMODEL_HPP
2 | #define TRIPLECOMPONENTMODEL_HPP
3 |
4 | #include
5 |
6 | #include
7 |
8 | #include "hdtcontroller.hpp"
9 |
10 | class HDTController;
11 |
12 | class TripleComponentModel : public QAbstractTableModel {
13 | Q_OBJECT
14 | private:
15 | HDTController *hdtController;
16 | hdt::TripleComponentRole tripleComponentRole;
17 | public:
18 | TripleComponentModel(HDTController *view, hdt::TripleComponentRole compRole);
19 |
20 | int rowCount(const QModelIndex &parent = QModelIndex()) const ;
21 | int columnCount(const QModelIndex &parent = QModelIndex()) const;
22 | QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const;
23 | bool setData(const QModelIndex & index, const QVariant & value, int role);
24 | QVariant headerData(int section, Qt::Orientation orientation, int role) const;
25 | Qt::ItemFlags flags(const QModelIndex &index) const;
26 |
27 | public slots:
28 | void itemsChanged(unsigned int ini, unsigned int fin);
29 | void notifyLayoutChanged();
30 | signals:
31 | };
32 |
33 | #endif // TRIPLECOMPONENTMODEL_HPP
34 |
--------------------------------------------------------------------------------
/lib/.gitignore:
--------------------------------------------------------------------------------
1 | /Makefile.am
2 | /dummy.c
3 |
--------------------------------------------------------------------------------
/libcds/Changelog:
--------------------------------------------------------------------------------
1 |
2 | Version 0.9:
3 |
4 | - static_bitsequence:
5 | - added sdarray
6 | - static_sequence:
7 | - added sequence representation based in sdarray (no efficient access)
8 |
9 | Version 0.8:
10 |
11 | - trying:
12 | - git
13 | - missing:
14 | - improve design and class names
15 | - add namespaces
16 | - reference counters for coders and util clases
17 | - static_bitsequence:
18 | - Added base class with virtual functions
19 | - Added testing naive rank/select
20 | - Added rank/select with one-level sampling
21 | - Added compressed representation
22 | - static_sequence
23 | - Added wavelet tree without pointers
24 | - Added wavelet tree with pointers
25 | - Added coder for giving huffman/normal shape to the wavelet tree
26 | - Added Golynski et al.'s data structure for large alphabets
27 | - static_permutation
28 | - Added Diego Arroyuelo's implementation of Munro et al.'s permutations
29 | - Added base classes
30 | - TODO: check interface and add functionality
31 | - coders
32 | - temporal coders for the wavelet tree
33 | - TODO: add coders and a general interface for them
34 | - utils
35 | - Added the alphabet mapper interface
36 | - Added a dummy alphabet mapper
37 |
38 |
39 |
--------------------------------------------------------------------------------
/libcds/README:
--------------------------------------------------------------------------------
1 | libcds implements low-level succinct data structures such as bitmaps,
2 | sequences, permutations, etc. The main goal is to provide a set of
3 | structures that form the building block of most compressed/succinct
4 | solutions. In the near future we are planning to add compression
5 | algorithms and support for succinct trees.
6 |
7 | You can find more information at http://libcds.recoded.cl/
8 |
9 | Right now we are just fixing bugs and testing some new things in here,
10 | but most of the effort is being put into libcds2, this rewrite aims at
11 | solving many problems with 64bits systems. This is necessary in order
12 | to index bigger inputs.
--------------------------------------------------------------------------------
/libcds/cds.pc.in:
--------------------------------------------------------------------------------
1 | prefix=@prefix@
2 | exec_prefix=@exec_prefix@
3 | libdir=@libdir@
4 | includedir=@includedir@
5 |
6 | Name: libcds
7 | Description: CDS library
8 | Version: 1.0.12
9 | URL: @PACKAGE_URL@
10 | Libs: -L${libdir} -lcds
11 | Cflags: -I${includedir}
12 |
--------------------------------------------------------------------------------
/libcds/docs/delete_me:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/rdfhdt/hdt-cpp/88110cc24d4d7d07080b40325d1905fae999ef95/libcds/docs/delete_me
--------------------------------------------------------------------------------
/libcds/include/BitSequenceBuilderDArray.h:
--------------------------------------------------------------------------------
1 | /* BitSequenceBuilderDArray.h
2 | * Copyright (C) 2008, Francisco Claude, all rights reserved.
3 | *
4 | * Rodrigo Canovas
5 | *
6 | * This library is free software; you can redistribute it and/or
7 | * modify it under the terms of the GNU Lesser General Public
8 | * License as published by the Free Software Foundation; either
9 | * version 2.1 of the License, or (at your option) any later version.
10 | *
11 | * This library is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 | * Lesser General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU Lesser General Public
17 | * License along with this library; if not, write to the Free Software
18 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
19 | *
20 | */
21 |
22 | #ifndef BITSEQUENCEBUILDERDARRAY_H
23 | #define BITSEQUENCEBUILDERDARRAY_H
24 |
25 | #include
26 | #include
27 | #include
28 |
29 | namespace cds_static
30 | {
31 | /** Base class for BitSequence builders, it defines the build function
32 | * that takes only a bitmap. The parameters for construction are can
33 | * be set in any way by the builder, but none are received when
34 | * the actual building takes place.
35 | *
36 | * @author Rodrigo Canovas
37 | */
38 | class BitSequenceBuilderDArray : public BitSequenceBuilder
39 | {
40 | public:
41 | BitSequenceBuilderDArray();
42 | virtual ~BitSequenceBuilderDArray();
43 | virtual BitSequence * build(uint * bitseq, size_t len) const;
44 | virtual BitSequence * build(const BitString & bs) const;
45 | };
46 | };
47 | #endif
48 |
--------------------------------------------------------------------------------
/libcds/include/BitSequenceBuilderRG.h:
--------------------------------------------------------------------------------
1 | /* BitSequenceBuilderRG.h
2 | * Copyright (C) 2008, Francisco Claude, all rights reserved.
3 | *
4 | * Francisco Claude
5 | *
6 | * This library is free software; you can redistribute it and/or
7 | * modify it under the terms of the GNU Lesser General Public
8 | * License as published by the Free Software Foundation; either
9 | * version 2.1 of the License, or (at your option) any later version.
10 | *
11 | * This library is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 | * Lesser General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU Lesser General Public
17 | * License along with this library; if not, write to the Free Software
18 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
19 | *
20 | */
21 |
22 | #ifndef BITSEQUENCEBUILDERRG_H
23 | #define BITSEQUENCEBUILDERRG_H
24 |
25 | #include
26 | #include
27 | #include
28 |
29 | namespace cds_static
30 | {
31 | /** BitSequence builder for BitSequenceRG
32 | *
33 | * @author Francisco Claude
34 | */
35 | class BitSequenceBuilderRG : public BitSequenceBuilder
36 | {
37 | public:
38 | BitSequenceBuilderRG(uint factor);
39 | virtual ~BitSequenceBuilderRG() {}
40 | virtual BitSequence * build(uint * bitseq, size_t len) const;
41 | virtual BitSequence * build(const BitString & bs) const;
42 | protected:
43 | uint factor;
44 | };
45 | };
46 | #endif
47 |
--------------------------------------------------------------------------------
/libcds/include/BitSequenceBuilderRRR.h:
--------------------------------------------------------------------------------
1 | /* BitSequenceBuilderRRR.h
2 | * Copyright (C) 2008, Francisco Claude, all rights reserved.
3 | *
4 | * Francisco Claude
5 | *
6 | * This library is free software; you can redistribute it and/or
7 | * modify it under the terms of the GNU Lesser General Public
8 | * License as published by the Free Software Foundation; either
9 | * version 2.1 of the License, or (at your option) any later version.
10 | *
11 | * This library is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 | * Lesser General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU Lesser General Public
17 | * License along with this library; if not, write to the Free Software
18 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
19 | *
20 | */
21 |
22 | #ifndef BITSEQUENCEBUILDERRRR_H
23 | #define BITSEQUENCEBUILDERRRR_H
24 |
25 | #include
26 | #include
27 | #include
28 |
29 | using namespace cds_utils;
30 |
31 | namespace cds_static
32 | {
33 | /** BitSequence builder for RRR BitSequences.
34 | *
35 | * @author Francisco Claude
36 | */
37 | class BitSequenceBuilderRRR : public BitSequenceBuilder
38 | {
39 | public:
40 | BitSequenceBuilderRRR(uint sample_rate);
41 | virtual ~BitSequenceBuilderRRR() {}
42 | virtual BitSequence * build(uint * bitseq, size_t len) const;
43 | virtual BitSequence * build(const BitString & bs) const;
44 | protected:
45 | uint sample_rate;
46 | };
47 | };
48 | #endif
49 |
--------------------------------------------------------------------------------
/libcds/include/BitSequenceBuilderSDArray.h:
--------------------------------------------------------------------------------
1 | /* BitSequenceBuilderSDArray.h
2 | * Copyright (C) 2008, Francisco Claude, all rights reserved.
3 | *
4 | * Francisco Claude
5 | *
6 | * This library is free software; you can redistribute it and/or
7 | * modify it under the terms of the GNU Lesser General Public
8 | * License as published by the Free Software Foundation; either
9 | * version 2.1 of the License, or (at your option) any later version.
10 | *
11 | * This library is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 | * Lesser General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU Lesser General Public
17 | * License along with this library; if not, write to the Free Software
18 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
19 | *
20 | */
21 |
22 | #ifndef BITSEQUENCEBUILDERSDARRAY_H
23 | #define BITSEQUENCEBUILDERSDARRAY_H
24 |
25 | #include
26 | #include
27 | #include
28 |
29 | namespace cds_static
30 | {
31 | /** Base class for BitSequence builders, it defines the build function
32 | * that takes only a bitmap. The parameters for construction are can
33 | * be set in any way by the builder, but none are received when
34 | * the actual building takes place.
35 | *
36 | * @author Francisco Claude
37 | */
38 | class BitSequenceBuilderSDArray : public BitSequenceBuilder
39 | {
40 | public:
41 | BitSequenceBuilderSDArray();
42 | virtual ~BitSequenceBuilderSDArray();
43 | virtual BitSequence * build(uint * bitseq, size_t len) const;
44 | virtual BitSequence * build(const BitString & bs) const;
45 | };
46 | };
47 | #endif
48 |
--------------------------------------------------------------------------------
/libcds/include/Coder.h:
--------------------------------------------------------------------------------
1 | /* Coder.h
2 | * Copyright (C) 2010, Francisco Claude, all rights reserved.
3 | *
4 | * Francisco Claude
5 | *
6 | * This library is free software; you can redistribute it and/or
7 | * modify it under the terms of the GNU Lesser General Public
8 | * License as published by the Free Software Foundation; either
9 | * version 2.1 of the License, or (at your option) any later version.
10 | *
11 | * This library is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 | * Lesser General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU Lesser General Public
17 | * License along with this library; if not, write to the Free Software
18 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
19 | *
20 | */
21 |
22 | #ifndef CODER_H
23 | #define CODER_H
24 |
25 | #include
26 | #include
27 | namespace cds_static
28 | {
29 |
30 | class Coder
31 | {
32 | public:
33 | virtual size_t encode(uint symb, uint * stream, size_t pos) const = 0;
34 | virtual size_t decode(uint * symb, uint *stream, size_t pos) const = 0;
35 | virtual size_t maxLength() const = 0;
36 | virtual size_t getSize() const = 0;
37 | virtual void save(ostream & fp) const = 0;
38 | static Coder * load(istream & fp);
39 | };
40 |
41 | };
42 |
43 | #include
44 | #endif
45 |
--------------------------------------------------------------------------------
/libcds/include/LCP_DAC.h:
--------------------------------------------------------------------------------
1 | /* Copyright (C) 2010, Rodrigo Cnovas, all rights reserved.
2 | *
3 | *This library is free software; you can redistribute it and/or
4 | * modify it under the terms of the GNU Lesser General Public
5 | * License as published by the Free Software Foundation; either
6 | * version 2.1 of the License, or (at your option) any later version.
7 | *
8 | * This library is distributed in the hope that it will be useful,
9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 | * Lesser General Public License for more details.
12 | *
13 | * You should have received a copy of the GNU Lesser General Public
14 | * License along with this library; if not, write to the Free Software
15 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
16 | *
17 | */
18 |
19 | #ifndef LCP_DAC_H
20 | #define LCP_DAC_H
21 |
22 | #include
23 | #include
24 |
25 | namespace cds_static
26 | {
27 |
28 | class LCP_DAC: public LCP
29 | {
30 |
31 | private:
32 | size_t *next_p; //usefull for get_seq_LCP
33 | factorization *rep;
34 | LCP_DAC();
35 |
36 | public:
37 | size_t n;
38 |
39 | /* LCP encoding using Susana's static factorization,
40 | * @param csa The compressed suffix array of the text
41 | * @param text The text
42 | * @param n The length of the text
43 | * */
44 | LCP_DAC(TextIndex *csa, char *text, size_t n);
45 | virtual size_t get_LCP(size_t i, TextIndex *csa) const;
46 | virtual size_t get_seq_LCP(size_t i, TextIndex *csa, size_t **next_pos, size_t *n_next, bool dir) const;
47 | virtual size_t getSize() const;
48 | virtual void save(ostream & fp) const;
49 | static LCP_DAC * load(istream & fp);
50 | virtual ~LCP_DAC();
51 | };
52 | };
53 | #endif
54 |
--------------------------------------------------------------------------------
/libcds/include/LCP_PhiSpare.h:
--------------------------------------------------------------------------------
1 | /* Copyright (C) 2010, Rodrigo Cnovas, all rights reserved.
2 | *
3 | *This library is free software; you can redistribute it and/or
4 | * modify it under the terms of the GNU Lesser General Public
5 | * License as published by the Free Software Foundation; either
6 | * version 2.1 of the License, or (at your option) any later version.
7 | *
8 | * This library is distributed in the hope that it will be useful,
9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 | * Lesser General Public License for more details.
12 | *
13 | * You should have received a copy of the GNU Lesser General Public
14 | * License along with this library; if not, write to the Free Software
15 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
16 | *
17 | */
18 |
19 | #ifndef LCP_PHISPARE_H
20 | #define LCP_PHISPARE_H
21 |
22 | #include
23 |
24 | namespace cds_static
25 | {
26 |
27 | class LCP_PhiSpare: public LCP
28 | {
29 | private:
30 | int q;
31 | size_t n; //length of LCP
32 | int *plcp; //psi lcp
33 |
34 | LCP_PhiSpare();
35 |
36 | public:
37 | /*Karkkainen, Manzini, and Puglisi encoding of the LCP,
38 | * @param csa The compressed suffix array of the text
39 | * @param text The text
40 | * @param n The length of the text
41 | * @param _q The sample period to use (if q = -1 its mean that we will not use any sample)
42 | * */
43 | LCP_PhiSpare(TextIndex *csa, char *text, size_t _n, int _q = 32);
44 | virtual size_t get_LCP(size_t i, TextIndex *csa) const;
45 | virtual size_t get_seq_LCP(size_t i, TextIndex *csa, size_t **next_pos, size_t *n_next, bool dir) const;
46 | virtual size_t getSize() const;
47 | virtual void save(ostream & fp) const;
48 | static LCP_PhiSpare * load(istream & fp);
49 | virtual ~LCP_PhiSpare();
50 | };
51 | };
52 | #endif
53 |
--------------------------------------------------------------------------------
/libcds/include/LCP_naive.h:
--------------------------------------------------------------------------------
1 | /* Copyright (C) 2010, Rodrigo Cnovas, all rights reserved.
2 | *
3 | *This library is free software; you can redistribute it and/or
4 | * modify it under the terms of the GNU Lesser General Public
5 | * License as published by the Free Software Foundation; either
6 | * version 2.1 of the License, or (at your option) any later version.
7 | *
8 | * This library is distributed in the hope that it will be useful,
9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 | * Lesser General Public License for more details.
12 | *
13 | * You should have received a copy of the GNU Lesser General Public
14 | * License along with this library; if not, write to the Free Software
15 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
16 | *
17 | */
18 |
19 | #ifndef LCP_NAIVE_H
20 | #define LCP_NAIVE_H
21 |
22 | #include
23 |
24 | namespace cds_static
25 | {
26 |
27 | class LCP_naive: public LCP
28 | {
29 | private:
30 | LCP_naive();
31 | uint *lcp_array;
32 | size_t b;
33 | size_t length;
34 |
35 | public:
36 |
37 | LCP_naive(TextIndex *csa, char *text, size_t n);
38 |
39 | /**Return LCP[i]*/
40 | virtual size_t get_LCP(size_t i, TextIndex *csa) const;
41 |
42 | /**Return LCP[i], being faster if sequential acceses to the LCP had been done*/
43 | virtual size_t get_seq_LCP(size_t i, TextIndex *csa, size_t **next_pos, size_t *n_next, bool dir) const;
44 |
45 | /** Returns the size of the structure in bytes */
46 | virtual size_t getSize() const;
47 |
48 | /** Stores the structure given a file pointer, return 0 in case of success */
49 | virtual void save(ostream & fp) const;
50 |
51 | /** Reads a LCP determining the type */
52 | static LCP_naive * load(istream & fp);
53 |
54 | virtual ~LCP_naive();
55 | };
56 | };
57 | #endif
58 |
--------------------------------------------------------------------------------
/libcds/include/MapperCont.h:
--------------------------------------------------------------------------------
1 | /* mapper_cont.h
2 | * Copyright (C) 2008, Francisco Claude, all rights reserved.
3 | *
4 | * mapper_cont definition
5 | *
6 | * This library is free software; you can redistribute it and/or
7 | * modify it under the terms of the GNU Lesser General Public
8 | * License as published by the Free Software Foundation; either
9 | * version 2.1 of the License, or (at your option) any later version.
10 | *
11 | * This library is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 | * Lesser General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU Lesser General Public
17 | * License along with this library; if not, write to the Free Software
18 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
19 | *
20 | */
21 |
22 | #ifndef _MAPPERCONT_H
23 | #define _MAPPERCONT_H
24 |
25 | #include
26 | #include
27 |
28 | #include
29 | #include
30 | #include
31 | #include
32 |
33 | using namespace std;
34 | using namespace cds_utils;
35 |
36 | namespace cds_static
37 | {
38 |
39 | /** Mapper that makes the values in the set contiguous
40 | *
41 | * @author Francisco Claude
42 | */
43 | class MapperCont : public Mapper
44 | {
45 | public:
46 | MapperCont(const Array & seq, const BitSequenceBuilder & bsb);
47 | MapperCont(const uint * A, const size_t len, const BitSequenceBuilder & bsb);
48 |
49 | virtual ~MapperCont();
50 |
51 | virtual uint map(uint s) const;
52 | virtual uint unmap(uint s) const;
53 | virtual size_t getSize() const;
54 |
55 | virtual void save(ostream & out) const;
56 | static MapperCont * load(istream & input);
57 |
58 | protected:
59 | MapperCont();
60 | BitSequence * m;
61 | };
62 |
63 | };
64 | #endif /* _MAPPERCONT_H */
65 |
--------------------------------------------------------------------------------
/libcds/include/MapperNone.h:
--------------------------------------------------------------------------------
1 | /* MapperNone.h
2 | * Copyright (C) 2008, Francisco Claude, all rights reserved.
3 | *
4 | * MapperNone definition
5 | *
6 | * This library is free software; you can redistribute it and/or
7 | * modify it under the terms of the GNU Lesser General Public
8 | * License as published by the Free Software Foundation; either
9 | * version 2.1 of the License, or (at your option) any later version.
10 | *
11 | * This library is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 | * Lesser General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU Lesser General Public
17 | * License along with this library; if not, write to the Free Software
18 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
19 | *
20 | */
21 |
22 | #ifndef _MAPPERNONE_H
23 | #define _MAPPERNONE_H
24 |
25 | #include
26 |
27 | #include
28 | #include
29 |
30 | using namespace std;
31 |
32 | namespace cds_static
33 | {
34 |
35 | /** Mapper that doesn't change the value (identity)
36 | *
37 | * @author Francisco Claude
38 | */
39 | class MapperNone : public Mapper
40 | {
41 | public:
42 | MapperNone();
43 | virtual ~MapperNone() {}
44 | virtual uint map(uint s) const;
45 | virtual uint unmap(uint s) const;
46 | virtual size_t getSize() const;
47 | virtual void save(ostream & out) const;
48 | static MapperNone * load(istream & input);
49 | };
50 | };
51 | #endif /* __MAPPER_NONE_H */
52 |
--------------------------------------------------------------------------------
/libcds/include/MapperRev.h:
--------------------------------------------------------------------------------
1 | /* MapperRev.h
2 | * Copyright (C) 2012, Francisco Claude, all rights reserved.
3 | *
4 | * MapperRev definition
5 | *
6 | * This library is free software; you can redistribute it and/or
7 | * modify it under the terms of the GNU Lesser General Public
8 | * License as published by the Free Software Foundation; either
9 | * version 2.1 of the License, or (at your option) any later version.
10 | *
11 | * This library is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 | * Lesser General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU Lesser General Public
17 | * License along with this library; if not, write to the Free Software
18 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
19 | *
20 | */
21 |
22 | #ifndef _MAPPERREV_H
23 | #define _MAPPERREV_H
24 |
25 | #include
26 | #include
27 |
28 | #include
29 | #include
30 | #include
31 | #include
32 |
33 | using namespace std;
34 | using namespace cds_utils;
35 |
36 | namespace cds_static
37 | {
38 |
39 | /** Mapper that reverses the bits (considering how many bits are required
40 | * to represent the maximum value in the sequence)
41 | *
42 | * @author Francisco Claude
43 | */
44 | class MapperRev : public Mapper
45 | {
46 | public:
47 | MapperRev(const Array &a);
48 | MapperRev(const uint *A, const size_t len);
49 | virtual ~MapperRev() {}
50 | virtual uint map(const uint s) const;
51 | virtual uint unmap(const uint s) const;
52 | virtual size_t getSize() const;
53 | virtual void save(ostream & out) const;
54 | static MapperRev * load(istream & input);
55 |
56 | protected:
57 | MapperRev();
58 | uint bits;
59 | };
60 | };
61 | #endif /* __MAPPER_REV_H */
62 |
--------------------------------------------------------------------------------
/libcds/include/PermutationBuilder.h:
--------------------------------------------------------------------------------
1 | /* PermutationBuilder.h
2 | * Copyright (C) 2010, Francisco Claude, all rights reserved.
3 | *
4 | * Francisco Claude
5 | *
6 | * This program is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * This program is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU General Public License
17 | * along with this program. If not, see .
18 | *
19 | */
20 |
21 | #ifndef PERMUTATIONBUILDER_H
22 | #define PERMUTATIONBUILDER_H
23 |
24 | #include
25 | #include
26 |
27 | namespace cds_static
28 | {
29 |
30 | class PermutationBuilder
31 | {
32 | public:
33 | PermutationBuilder() { userCount=0; }
34 | virtual ~PermutationBuilder() {}
35 | virtual Permutation * build(uint * perm, uint n) const = 0;
36 | virtual void use() { userCount++; }
37 | virtual void unuse() { userCount--; assert(userCount>=0); if(userCount==0) delete this; }
38 |
39 | protected:
40 | int userCount;
41 | };
42 | };
43 |
44 | #include
45 | #include
46 | #endif
47 |
--------------------------------------------------------------------------------
/libcds/include/PermutationBuilderMRRR.h:
--------------------------------------------------------------------------------
1 | /* PermutationBuilderMRRR.h
2 | * Copyright (C) 2010, Francisco Claude, all rights reserved.
3 | *
4 | * Francisco Claude
5 | *
6 | * This program is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * This program is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU General Public License
17 | * along with this program. If not, see .
18 | *
19 | */
20 |
21 | #ifndef PERMUTATIONBUILDERMRRR_H
22 | #define PERMUTATIONBUILDERMRRR_H
23 |
24 | #include
25 | #include
26 | #include
27 |
28 | namespace cds_static
29 | {
30 |
31 | class PermutationBuilderMRRR : public PermutationBuilder
32 | {
33 | public:
34 | PermutationBuilderMRRR(uint sample, BitSequenceBuilder * bmb);
35 | virtual ~PermutationBuilderMRRR();
36 | virtual Permutation * build(uint * perm, uint len) const;
37 | protected:
38 | uint sample;
39 | BitSequenceBuilder * bmb;
40 | };
41 | };
42 | #endif
43 |
--------------------------------------------------------------------------------
/libcds/include/PermutationBuilderWT.h:
--------------------------------------------------------------------------------
1 | /* PermutationBuilderWT.h
2 | * Copyright (C) 2011, Francisco Claude, all rights reserved.
3 | *
4 | * Francisco Claude
5 | *
6 | * This program is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * This program is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU General Public License
17 | * along with this program. If not, see .
18 | *
19 | */
20 |
21 | #ifndef PERMUTATIONBUILDERWT_H
22 | #define PERMUTATIONBUILDERWT_H
23 |
24 | #include
25 | #include
26 | #include
27 |
28 | namespace cds_static
29 | {
30 |
31 | class PermutationBuilderWT : public PermutationBuilder
32 | {
33 | public:
34 | PermutationBuilderWT() {}
35 | virtual ~PermutationBuilderWT() {}
36 | virtual Permutation * build(uint * perm, uint len) const;
37 | };
38 | };
39 | #endif
40 |
--------------------------------------------------------------------------------
/libcds/include/PermutationWT.h:
--------------------------------------------------------------------------------
1 | /* Permutation.h
2 | * Copyright (C) 2010, Francisco Claude, all rights reserved.
3 | *
4 | * Francisco Claude
5 | *
6 | * This program is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * This program is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU General Public License
17 | * along with this program. If not, see .
18 | *
19 | */
20 |
21 | #ifndef __PERMUTATIONWT_H
22 | #define __PERMUTATIONWT_H
23 |
24 | #include
25 |
26 | #include
27 | #include
28 | #include
29 |
30 | using namespace cds_utils;
31 |
32 | namespace cds_static
33 | {
34 | class WaveletTree;
35 |
36 | class PermutationWT:public Permutation
37 | {
38 | public:
39 | PermutationWT(uint * perm, size_t len);
40 | virtual ~PermutationWT();
41 |
42 | /** Compute the value at position i
43 | */
44 | virtual uint pi(uint i) const;
45 |
46 | /** Compute the position where i appears */
47 | virtual uint revpi(uint i) const;
48 |
49 | /** Size in bytes
50 | */
51 | virtual size_t getSize() const;
52 |
53 | /** Saves permutation to stream */
54 | virtual void save(ostream & fp) const;
55 |
56 | /** Loads the permutation */
57 | static PermutationWT * load(istream & fp);
58 |
59 | protected:
60 | PermutationWT() {}
61 | BitSequence * marks;
62 | Sequence * wt;
63 | uint runs;
64 | };
65 | };
66 | #endif
67 |
--------------------------------------------------------------------------------
/libcds/include/SequenceBuilder.h:
--------------------------------------------------------------------------------
1 | /* SequenceBuilder.h
2 | * Copyright (C) 2010, Francisco Claude, all rights reserved.
3 | *
4 | * Francisco Claude
5 | *
6 | * This program is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * This program is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU General Public License
17 | * along with this program. If not, see .
18 | *
19 | */
20 |
21 | #include
22 |
23 | #include
24 |
25 | #ifndef SEQUENCEBUILDER_H
26 | #define SEQUENCEBUILDER_H
27 |
28 | namespace cds_static
29 | {
30 |
31 | class SequenceBuilder
32 | {
33 | public:
34 | SequenceBuilder() { userCount=0; }
35 | virtual ~SequenceBuilder() {}
36 | virtual Sequence * build(uint * seq, size_t len)=0;
37 | virtual Sequence * build(const Array & seq)=0;
38 | virtual void use() { userCount++; }
39 | virtual void unuse() { userCount--; assert(userCount>=0); if(userCount==0) delete this; }
40 |
41 | protected:
42 | int userCount;
43 | };
44 | };
45 |
46 | #include
47 | #include
48 | #include
49 | #include
50 | #include
51 | #include
52 | #include
53 | #endif
54 |
--------------------------------------------------------------------------------
/libcds/include/SequenceBuilderAlphPart.h:
--------------------------------------------------------------------------------
1 | /* SequenceBuilderAlphPart.h
2 | * Copyright (C) 2010, Francisco Claude, all rights reserved.
3 | *
4 | * Francisco Claude
5 | *
6 | * This program is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * This program is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU General Public License
17 | * along with this program. If not, see .
18 | *
19 | */
20 |
21 | #include
22 |
23 | #include
24 | #include
25 |
26 | #ifndef SequenceBuilderAlphPart_H
27 | #define SequenceBuilderAlphPart_H
28 |
29 | namespace cds_static
30 | {
31 | class SequenceBuilderAlphPart : public SequenceBuilder
32 | {
33 | public:
34 | SequenceBuilderAlphPart(SequenceBuilder * groupIndexBuilder, SequenceBuilder * indexBuilder, uint cut);
35 | virtual ~SequenceBuilderAlphPart();
36 | virtual Sequence * build(uint * seq, size_t len);
37 | virtual Sequence * build(const Array & seq);
38 |
39 | protected:
40 | SequenceBuilder * groupIndexBuilder;
41 | SequenceBuilder * indexBuilder;
42 | uint cut;
43 | };
44 | };
45 | #endif
46 |
--------------------------------------------------------------------------------
/libcds/include/SequenceBuilderGMR.h:
--------------------------------------------------------------------------------
1 | /* SequenceBuilderGMR.h
2 | * Copyright (C) 2010, Francisco Claude, all rights reserved.
3 | *
4 | * Francisco Claude
5 | *
6 | * This program is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * This program is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU General Public License
17 | * along with this program. If not, see .
18 | *
19 | */
20 |
21 | #include
22 |
23 | #include
24 | #include
25 |
26 | #ifndef SequenceBuilderGMR_H
27 | #define SequenceBuilderGMR_H
28 |
29 | namespace cds_static
30 | {
31 | class SequenceBuilderGMR : public SequenceBuilder
32 | {
33 | public:
34 | SequenceBuilderGMR(BitSequenceBuilder * bsb, SequenceBuilder * sqb, uint chunk_len=0);
35 | virtual ~SequenceBuilderGMR();
36 | virtual Sequence * build(uint * seq, size_t len);
37 | virtual Sequence * build(const Array & seq);
38 |
39 | protected:
40 | BitSequenceBuilder * bsb;
41 | SequenceBuilder * sqb;
42 | uint chunk_len;
43 | };
44 | };
45 | #endif
46 |
--------------------------------------------------------------------------------
/libcds/include/SequenceBuilderGMRChunk.h:
--------------------------------------------------------------------------------
1 | /* SequenceBuilderGMRChunk.h
2 | * Copyright (C) 2010, Francisco Claude, all rights reserved.
3 | *
4 | * Francisco Claude
5 | *
6 | * This program is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * This program is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU General Public License
17 | * along with this program. If not, see .
18 | *
19 | */
20 |
21 | #include
22 |
23 | #include
24 | #include
25 | #include
26 |
27 | #ifndef SequenceBuilderGMRChunk_H
28 | #define SequenceBuilderGMRChunk_H
29 |
30 | namespace cds_static
31 | {
32 | class SequenceBuilderGMRChunk : public SequenceBuilder
33 | {
34 | public:
35 | SequenceBuilderGMRChunk(BitSequenceBuilder * bsb, PermutationBuilder * pmb);
36 | virtual ~SequenceBuilderGMRChunk();
37 | virtual Sequence * build(uint * seq, size_t len);
38 | virtual Sequence * build(const Array & seq);
39 |
40 | protected:
41 | BitSequenceBuilder * bsb;
42 | PermutationBuilder * pmb;
43 | };
44 | };
45 | #endif
46 |
--------------------------------------------------------------------------------
/libcds/include/SequenceBuilderStr.h:
--------------------------------------------------------------------------------
1 | /* SequenceBuilderStr.h
2 | * Copyright (C) 2010, Francisco Claude, all rights reserved.
3 | *
4 | * Francisco Claude
5 | *
6 | * This program is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * This program is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU General Public License
17 | * along with this program. If not, see .
18 | *
19 | */
20 |
21 | #include
22 |
23 | #include
24 | #include
25 | #include
26 |
27 | #ifndef SequenceBuilderStr_H
28 | #define SequenceBuilderStr_H
29 |
30 | namespace cds_static
31 | {
32 | class SequenceBuilderStr : public SequenceBuilder
33 | {
34 | public:
35 | SequenceBuilderStr(const string & options);
36 | virtual ~SequenceBuilderStr();
37 | virtual Sequence * build(uint * seq, size_t len);
38 | virtual Sequence * build(const Array & seq);
39 |
40 | protected:
41 | virtual SequenceBuilder * getBuilder(const Array & seq);
42 |
43 | string str;
44 | };
45 | };
46 | #endif
47 |
--------------------------------------------------------------------------------
/libcds/include/SequenceBuilderWaveletMatrix.h:
--------------------------------------------------------------------------------
1 | /* SequenceBuilderWaveletTreeNoptrs.h
2 | * Copyright (C) 2010, Francisco Claude, all rights reserved.
3 | *
4 | * Francisco Claude
5 | *
6 | * This program is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * This program is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU General Public License
17 | * along with this program. If not, see .
18 | *
19 | */
20 |
21 | #include
22 |
23 | #include
24 | #include
25 | #include
26 |
27 | #ifndef SEQUENCEBUILDERWAVELETMATRIX_H
28 | #define SEQUENCEBUILDERWAVELETMATRIX_H
29 |
30 | namespace cds_static
31 | {
32 | class SequenceBuilderWaveletMatrix : public SequenceBuilder
33 | {
34 | public:
35 | SequenceBuilderWaveletMatrix(BitSequenceBuilder * bsb, Mapper * am);
36 | virtual ~SequenceBuilderWaveletMatrix();
37 | virtual Sequence * build(uint * seq, size_t len);
38 | virtual Sequence * build(const Array & seq);
39 |
40 | protected:
41 | BitSequenceBuilder * bsb;
42 | Mapper * am;
43 | };
44 | };
45 | #endif
46 |
--------------------------------------------------------------------------------
/libcds/include/SequenceBuilderWaveletTree.h:
--------------------------------------------------------------------------------
1 | /* SequenceBuilderWaveletTree.h
2 | * Copyright (C) 2010, Francisco Claude, all rights reserved.
3 | *
4 | * Francisco Claude
5 | *
6 | * This program is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * This program is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU General Public License
17 | * along with this program. If not, see .
18 | *
19 | */
20 |
21 | #include
22 |
23 | #include
24 | #include
25 | #include
26 |
27 | #ifndef SEQUENCEBUILDERWAVELETTREE_H
28 | #define SEQUENCEBUILDERWAVELETTREE_H
29 |
30 | namespace cds_static
31 | {
32 | class SequenceBuilderWaveletTree : public SequenceBuilder
33 | {
34 | public:
35 | SequenceBuilderWaveletTree(BitSequenceBuilder * bsb, Mapper * am, wt_coder * wc=NULL);
36 | virtual ~SequenceBuilderWaveletTree();
37 | virtual Sequence * build(uint * seq, size_t len);
38 | virtual Sequence * build(const Array & seq);
39 |
40 | protected:
41 | BitSequenceBuilder * bsb;
42 | Mapper * am;
43 | wt_coder * wc;
44 | };
45 | };
46 | #endif
47 |
--------------------------------------------------------------------------------
/libcds/include/SequenceBuilderWaveletTreeNoptrs.h:
--------------------------------------------------------------------------------
1 | /* SequenceBuilderWaveletTreeNoptrs.h
2 | * Copyright (C) 2010, Francisco Claude, all rights reserved.
3 | *
4 | * Francisco Claude
5 | *
6 | * This program is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * This program is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU General Public License
17 | * along with this program. If not, see .
18 | *
19 | */
20 |
21 | #include
22 |
23 | #include
24 | #include
25 | #include
26 |
27 | #ifndef SEQUENCEBUILDERWAVELETTREENOPTRS_H
28 | #define SEQUENCEBUILDERWAVELETTREENOPTRS_H
29 |
30 | namespace cds_static
31 | {
32 | class SequenceBuilderWaveletTreeNoptrs : public SequenceBuilder
33 | {
34 | public:
35 | SequenceBuilderWaveletTreeNoptrs(BitSequenceBuilder * bsb, Mapper * am);
36 | virtual ~SequenceBuilderWaveletTreeNoptrs();
37 | virtual Sequence * build(uint * seq, size_t len);
38 | virtual Sequence * build(const Array & seq);
39 |
40 | protected:
41 | BitSequenceBuilder * bsb;
42 | Mapper * am;
43 | };
44 | };
45 | #endif
46 |
--------------------------------------------------------------------------------
/libcds/include/SequenceBuilderWaveletTreeNoptrsS.h:
--------------------------------------------------------------------------------
1 | /* SequenceBuilderWaveletTreeNoptrsS.h
2 | * Copyright (C) 2012, Francisco Claude, all rights reserved.
3 | *
4 | * Francisco Claude
5 | *
6 | * This program is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * This program is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU General Public License
17 | * along with this program. If not, see .
18 | *
19 | */
20 |
21 | #include
22 |
23 | #include
24 | #include
25 | #include
26 |
27 | #ifndef SEQUENCEBUILDERWAVELETTREENOPTRSS_H
28 | #define SEQUENCEBUILDERWAVELETTREENOPTRSS_H
29 |
30 | namespace cds_static {
31 | class SequenceBuilderWaveletTreeNoptrsS : public SequenceBuilder {
32 | public:
33 | SequenceBuilderWaveletTreeNoptrsS(BitSequenceBuilder * bsb, Mapper * am);
34 | virtual ~SequenceBuilderWaveletTreeNoptrsS();
35 | virtual Sequence * build(uint * seq, size_t len);
36 | virtual Sequence * build(const Array & seq);
37 |
38 | protected:
39 | BitSequenceBuilder * bsb;
40 | Mapper * am;
41 | };
42 | };
43 |
44 | #endif
45 |
46 |
--------------------------------------------------------------------------------
/libcds/include/mmap.h:
--------------------------------------------------------------------------------
1 |
2 | /* mman.h
3 | Copyright (C) 2005, K. Sadakane, all rights reserved.
4 |
5 | This file contains an implementation of memory manager
6 |
7 | This library is free software; you can redistribute it and/or
8 | modify it under the terms of the GNU Lesser General Public
9 | License as published by the Free Software Foundation; either
10 | version 2.1 of the License, or (at your option) any later version.
11 |
12 | This library is distributed in the hope that it will be useful,
13 | but WITHOUT ANY WARRANTY; without even the implied warranty of
14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 | Lesser General Public License for more details.
16 |
17 | You should have received a copy of the GNU Lesser General Public
18 | License along with this library; if not, write to the Free Software
19 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
20 |
21 | */
22 |
23 | #ifndef _MYMMAP_H_
24 | #define _MYMMAP_H_
25 |
26 | #ifdef WIN32
27 | #include
28 | #else
29 | #include
30 | #include
31 | #include
32 | #include
33 | #include
34 | #include
35 | #include
36 | #endif
37 |
38 | #ifdef WIN32
39 | #define PAGE_READONLY 0x02
40 | #define SECTION_MAP_READ 0x0004
41 | #define FILE_MAP_READ SECTION_MAP_READ
42 | #endif
43 |
44 | namespace cds_static
45 | {
46 |
47 | typedef struct
48 | {
49 | void *addr;
50 | int len;
51 | #ifdef WIN32
52 | HANDLE h1,h2;
53 | #else
54 | int fd;
55 | #endif
56 | } MMAP;
57 |
58 | MMAP *mymmap (char *fname);
59 | int mymunmap (MMAP *m);
60 |
61 | };
62 | #endif
63 |
--------------------------------------------------------------------------------
/libcds/include/timing.h:
--------------------------------------------------------------------------------
1 | /* timing.h
2 | * Copyright (C) 2010, Francisco Claude, all rights reserved.
3 | *
4 | * Francisco Claude
5 | *
6 | * This program is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * This program is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU General Public License
17 | * along with this program. If not, see .
18 | *
19 | */
20 |
21 | #include
22 | #include
23 | #include
24 | #include
25 | #include
26 | #include