ngs_server 0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (284) hide show
  1. data/.gitignore +4 -0
  2. data/Gemfile +4 -0
  3. data/Rakefile +2 -0
  4. data/bin/ngs_server +58 -0
  5. data/data/holder.txt +0 -0
  6. data/ext/bamtools/CMakeLists.txt +49 -0
  7. data/ext/bamtools/LICENSE +22 -0
  8. data/ext/bamtools/README +60 -0
  9. data/ext/bamtools/Tutorial_Toolkit_BamTools-1.0.pdf +0 -0
  10. data/ext/bamtools/docs/Doxyfile +1601 -0
  11. data/ext/bamtools/extconf.rb +9 -0
  12. data/ext/bamtools/src/CMakeFiles/CMakeDirectoryInformation.cmake +22 -0
  13. data/ext/bamtools/src/CMakeFiles/SharedHeaders.dir/DependInfo.cmake +13 -0
  14. data/ext/bamtools/src/CMakeFiles/SharedHeaders.dir/build.make +65 -0
  15. data/ext/bamtools/src/CMakeFiles/SharedHeaders.dir/cmake_clean.cmake +8 -0
  16. data/ext/bamtools/src/CMakeFiles/SharedHeaders.dir/depend.internal +3 -0
  17. data/ext/bamtools/src/CMakeFiles/SharedHeaders.dir/depend.make +3 -0
  18. data/ext/bamtools/src/CMakeFiles/SharedHeaders.dir/progress.make +2 -0
  19. data/ext/bamtools/src/CMakeFiles/progress.marks +1 -0
  20. data/ext/bamtools/src/CMakeLists.txt +18 -0
  21. data/ext/bamtools/src/ExportHeader.cmake +31 -0
  22. data/ext/bamtools/src/Makefile +182 -0
  23. data/ext/bamtools/src/api/BamAlignment.cpp +2432 -0
  24. data/ext/bamtools/src/api/BamAlignment.h +206 -0
  25. data/ext/bamtools/src/api/BamAux.h +456 -0
  26. data/ext/bamtools/src/api/BamConstants.h +127 -0
  27. data/ext/bamtools/src/api/BamIndex.h +79 -0
  28. data/ext/bamtools/src/api/BamMultiReader.cpp +395 -0
  29. data/ext/bamtools/src/api/BamMultiReader.h +126 -0
  30. data/ext/bamtools/src/api/BamReader.cpp +369 -0
  31. data/ext/bamtools/src/api/BamReader.h +117 -0
  32. data/ext/bamtools/src/api/BamWriter.cpp +142 -0
  33. data/ext/bamtools/src/api/BamWriter.h +63 -0
  34. data/ext/bamtools/src/api/CMakeFiles/APIHeaders.dir/DependInfo.cmake +14 -0
  35. data/ext/bamtools/src/api/CMakeFiles/APIHeaders.dir/build.make +80 -0
  36. data/ext/bamtools/src/api/CMakeFiles/APIHeaders.dir/cmake_clean.cmake +8 -0
  37. data/ext/bamtools/src/api/CMakeFiles/APIHeaders.dir/depend.internal +3 -0
  38. data/ext/bamtools/src/api/CMakeFiles/APIHeaders.dir/depend.make +3 -0
  39. data/ext/bamtools/src/api/CMakeFiles/APIHeaders.dir/progress.make +2 -0
  40. data/ext/bamtools/src/api/CMakeFiles/BamTools-static.dir/BamAlignment.cpp.o +0 -0
  41. data/ext/bamtools/src/api/CMakeFiles/BamTools-static.dir/BamMultiReader.cpp.o +0 -0
  42. data/ext/bamtools/src/api/CMakeFiles/BamTools-static.dir/BamReader.cpp.o +0 -0
  43. data/ext/bamtools/src/api/CMakeFiles/BamTools-static.dir/BamWriter.cpp.o +0 -0
  44. data/ext/bamtools/src/api/CMakeFiles/BamTools-static.dir/CXX.includecache +596 -0
  45. data/ext/bamtools/src/api/CMakeFiles/BamTools-static.dir/DependInfo.cmake +41 -0
  46. data/ext/bamtools/src/api/CMakeFiles/BamTools-static.dir/SamHeader.cpp.o +0 -0
  47. data/ext/bamtools/src/api/CMakeFiles/BamTools-static.dir/SamProgram.cpp.o +0 -0
  48. data/ext/bamtools/src/api/CMakeFiles/BamTools-static.dir/SamProgramChain.cpp.o +0 -0
  49. data/ext/bamtools/src/api/CMakeFiles/BamTools-static.dir/SamReadGroup.cpp.o +0 -0
  50. data/ext/bamtools/src/api/CMakeFiles/BamTools-static.dir/SamReadGroupDictionary.cpp.o +0 -0
  51. data/ext/bamtools/src/api/CMakeFiles/BamTools-static.dir/SamSequence.cpp.o +0 -0
  52. data/ext/bamtools/src/api/CMakeFiles/BamTools-static.dir/SamSequenceDictionary.cpp.o +0 -0
  53. data/ext/bamtools/src/api/CMakeFiles/BamTools-static.dir/build.make +675 -0
  54. data/ext/bamtools/src/api/CMakeFiles/BamTools-static.dir/cmake_clean.cmake +32 -0
  55. data/ext/bamtools/src/api/CMakeFiles/BamTools-static.dir/cmake_clean_target.cmake +3 -0
  56. data/ext/bamtools/src/api/CMakeFiles/BamTools-static.dir/depend.internal +295 -0
  57. data/ext/bamtools/src/api/CMakeFiles/BamTools-static.dir/depend.make +295 -0
  58. data/ext/bamtools/src/api/CMakeFiles/BamTools-static.dir/flags.make +8 -0
  59. data/ext/bamtools/src/api/CMakeFiles/BamTools-static.dir/internal/BamHeader_p.cpp.o +0 -0
  60. data/ext/bamtools/src/api/CMakeFiles/BamTools-static.dir/internal/BamIndexFactory_p.cpp.o +0 -0
  61. data/ext/bamtools/src/api/CMakeFiles/BamTools-static.dir/internal/BamMultiReader_p.cpp.o +0 -0
  62. data/ext/bamtools/src/api/CMakeFiles/BamTools-static.dir/internal/BamRandomAccessController_p.cpp.o +0 -0
  63. data/ext/bamtools/src/api/CMakeFiles/BamTools-static.dir/internal/BamReader_p.cpp.o +0 -0
  64. data/ext/bamtools/src/api/CMakeFiles/BamTools-static.dir/internal/BamStandardIndex_p.cpp.o +0 -0
  65. data/ext/bamtools/src/api/CMakeFiles/BamTools-static.dir/internal/BamToolsIndex_p.cpp.o +0 -0
  66. data/ext/bamtools/src/api/CMakeFiles/BamTools-static.dir/internal/BamWriter_p.cpp.o +0 -0
  67. data/ext/bamtools/src/api/CMakeFiles/BamTools-static.dir/internal/BgzfStream_p.cpp.o +0 -0
  68. data/ext/bamtools/src/api/CMakeFiles/BamTools-static.dir/internal/SamFormatParser_p.cpp.o +0 -0
  69. data/ext/bamtools/src/api/CMakeFiles/BamTools-static.dir/internal/SamFormatPrinter_p.cpp.o +0 -0
  70. data/ext/bamtools/src/api/CMakeFiles/BamTools-static.dir/internal/SamHeaderValidator_p.cpp.o +0 -0
  71. data/ext/bamtools/src/api/CMakeFiles/BamTools-static.dir/link.txt +2 -0
  72. data/ext/bamtools/src/api/CMakeFiles/BamTools-static.dir/progress.make +24 -0
  73. data/ext/bamtools/src/api/CMakeFiles/BamTools.dir/BamAlignment.cpp.o +0 -0
  74. data/ext/bamtools/src/api/CMakeFiles/BamTools.dir/BamMultiReader.cpp.o +0 -0
  75. data/ext/bamtools/src/api/CMakeFiles/BamTools.dir/BamReader.cpp.o +0 -0
  76. data/ext/bamtools/src/api/CMakeFiles/BamTools.dir/BamWriter.cpp.o +0 -0
  77. data/ext/bamtools/src/api/CMakeFiles/BamTools.dir/CXX.includecache +596 -0
  78. data/ext/bamtools/src/api/CMakeFiles/BamTools.dir/DependInfo.cmake +47 -0
  79. data/ext/bamtools/src/api/CMakeFiles/BamTools.dir/SamHeader.cpp.o +0 -0
  80. data/ext/bamtools/src/api/CMakeFiles/BamTools.dir/SamProgram.cpp.o +0 -0
  81. data/ext/bamtools/src/api/CMakeFiles/BamTools.dir/SamProgramChain.cpp.o +0 -0
  82. data/ext/bamtools/src/api/CMakeFiles/BamTools.dir/SamReadGroup.cpp.o +0 -0
  83. data/ext/bamtools/src/api/CMakeFiles/BamTools.dir/SamReadGroupDictionary.cpp.o +0 -0
  84. data/ext/bamtools/src/api/CMakeFiles/BamTools.dir/SamSequence.cpp.o +0 -0
  85. data/ext/bamtools/src/api/CMakeFiles/BamTools.dir/SamSequenceDictionary.cpp.o +0 -0
  86. data/ext/bamtools/src/api/CMakeFiles/BamTools.dir/build.make +677 -0
  87. data/ext/bamtools/src/api/CMakeFiles/BamTools.dir/cmake_clean.cmake +33 -0
  88. data/ext/bamtools/src/api/CMakeFiles/BamTools.dir/depend.internal +295 -0
  89. data/ext/bamtools/src/api/CMakeFiles/BamTools.dir/depend.make +295 -0
  90. data/ext/bamtools/src/api/CMakeFiles/BamTools.dir/flags.make +8 -0
  91. data/ext/bamtools/src/api/CMakeFiles/BamTools.dir/internal/BamHeader_p.cpp.o +0 -0
  92. data/ext/bamtools/src/api/CMakeFiles/BamTools.dir/internal/BamIndexFactory_p.cpp.o +0 -0
  93. data/ext/bamtools/src/api/CMakeFiles/BamTools.dir/internal/BamMultiReader_p.cpp.o +0 -0
  94. data/ext/bamtools/src/api/CMakeFiles/BamTools.dir/internal/BamRandomAccessController_p.cpp.o +0 -0
  95. data/ext/bamtools/src/api/CMakeFiles/BamTools.dir/internal/BamReader_p.cpp.o +0 -0
  96. data/ext/bamtools/src/api/CMakeFiles/BamTools.dir/internal/BamStandardIndex_p.cpp.o +0 -0
  97. data/ext/bamtools/src/api/CMakeFiles/BamTools.dir/internal/BamToolsIndex_p.cpp.o +0 -0
  98. data/ext/bamtools/src/api/CMakeFiles/BamTools.dir/internal/BamWriter_p.cpp.o +0 -0
  99. data/ext/bamtools/src/api/CMakeFiles/BamTools.dir/internal/BgzfStream_p.cpp.o +0 -0
  100. data/ext/bamtools/src/api/CMakeFiles/BamTools.dir/internal/SamFormatParser_p.cpp.o +0 -0
  101. data/ext/bamtools/src/api/CMakeFiles/BamTools.dir/internal/SamFormatPrinter_p.cpp.o +0 -0
  102. data/ext/bamtools/src/api/CMakeFiles/BamTools.dir/internal/SamHeaderValidator_p.cpp.o +0 -0
  103. data/ext/bamtools/src/api/CMakeFiles/BamTools.dir/link.txt +1 -0
  104. data/ext/bamtools/src/api/CMakeFiles/BamTools.dir/progress.make +24 -0
  105. data/ext/bamtools/src/api/CMakeFiles/CMakeDirectoryInformation.cmake +22 -0
  106. data/ext/bamtools/src/api/CMakeFiles/progress.marks +1 -0
  107. data/ext/bamtools/src/api/CMakeLists.txt +78 -0
  108. data/ext/bamtools/src/api/Makefile +902 -0
  109. data/ext/bamtools/src/api/SamConstants.h +95 -0
  110. data/ext/bamtools/src/api/SamHeader.cpp +184 -0
  111. data/ext/bamtools/src/api/SamHeader.h +68 -0
  112. data/ext/bamtools/src/api/SamProgram.cpp +139 -0
  113. data/ext/bamtools/src/api/SamProgram.h +61 -0
  114. data/ext/bamtools/src/api/SamProgramChain.cpp +351 -0
  115. data/ext/bamtools/src/api/SamProgramChain.h +85 -0
  116. data/ext/bamtools/src/api/SamReadGroup.cpp +221 -0
  117. data/ext/bamtools/src/api/SamReadGroup.h +68 -0
  118. data/ext/bamtools/src/api/SamReadGroupDictionary.cpp +289 -0
  119. data/ext/bamtools/src/api/SamReadGroupDictionary.h +86 -0
  120. data/ext/bamtools/src/api/SamSequence.cpp +161 -0
  121. data/ext/bamtools/src/api/SamSequence.h +60 -0
  122. data/ext/bamtools/src/api/SamSequenceDictionary.cpp +292 -0
  123. data/ext/bamtools/src/api/SamSequenceDictionary.h +88 -0
  124. data/ext/bamtools/src/api/api_global.h +21 -0
  125. data/ext/bamtools/src/api/cmake_install.cmake +122 -0
  126. data/ext/bamtools/src/api/internal/BamHeader_p.cpp +132 -0
  127. data/ext/bamtools/src/api/internal/BamHeader_p.h +71 -0
  128. data/ext/bamtools/src/api/internal/BamIndexFactory_p.cpp +112 -0
  129. data/ext/bamtools/src/api/internal/BamIndexFactory_p.h +49 -0
  130. data/ext/bamtools/src/api/internal/BamMultiMerger_p.h +297 -0
  131. data/ext/bamtools/src/api/internal/BamMultiReader_p.cpp +805 -0
  132. data/ext/bamtools/src/api/internal/BamMultiReader_p.h +103 -0
  133. data/ext/bamtools/src/api/internal/BamRandomAccessController_p.cpp +272 -0
  134. data/ext/bamtools/src/api/internal/BamRandomAccessController_p.h +93 -0
  135. data/ext/bamtools/src/api/internal/BamReader_p.cpp +380 -0
  136. data/ext/bamtools/src/api/internal/BamReader_p.h +112 -0
  137. data/ext/bamtools/src/api/internal/BamStandardIndex_p.cpp +986 -0
  138. data/ext/bamtools/src/api/internal/BamStandardIndex_p.h +236 -0
  139. data/ext/bamtools/src/api/internal/BamToolsIndex_p.cpp +641 -0
  140. data/ext/bamtools/src/api/internal/BamToolsIndex_p.h +187 -0
  141. data/ext/bamtools/src/api/internal/BamWriter_p.cpp +424 -0
  142. data/ext/bamtools/src/api/internal/BamWriter_p.h +66 -0
  143. data/ext/bamtools/src/api/internal/BgzfStream_p.cpp +438 -0
  144. data/ext/bamtools/src/api/internal/BgzfStream_p.h +108 -0
  145. data/ext/bamtools/src/api/internal/SamFormatParser_p.cpp +230 -0
  146. data/ext/bamtools/src/api/internal/SamFormatParser_p.h +61 -0
  147. data/ext/bamtools/src/api/internal/SamFormatPrinter_p.cpp +210 -0
  148. data/ext/bamtools/src/api/internal/SamFormatPrinter_p.h +60 -0
  149. data/ext/bamtools/src/api/internal/SamHeaderValidator_p.cpp +510 -0
  150. data/ext/bamtools/src/api/internal/SamHeaderValidator_p.h +101 -0
  151. data/ext/bamtools/src/api/internal/SamHeaderVersion_p.h +134 -0
  152. data/ext/bamtools/src/cmake_install.cmake +42 -0
  153. data/ext/bamtools/src/shared/bamtools_global.h +78 -0
  154. data/ext/bamtools/src/third_party/CMakeFiles/CMakeDirectoryInformation.cmake +22 -0
  155. data/ext/bamtools/src/third_party/CMakeFiles/progress.marks +1 -0
  156. data/ext/bamtools/src/third_party/CMakeLists.txt +10 -0
  157. data/ext/bamtools/src/third_party/Makefile +167 -0
  158. data/ext/bamtools/src/third_party/cmake_install.cmake +35 -0
  159. data/ext/bamtools/src/third_party/jsoncpp/CMakeFiles/CMakeDirectoryInformation.cmake +22 -0
  160. data/ext/bamtools/src/third_party/jsoncpp/CMakeFiles/jsoncpp.dir/CXX.includecache +144 -0
  161. data/ext/bamtools/src/third_party/jsoncpp/CMakeFiles/jsoncpp.dir/DependInfo.cmake +27 -0
  162. data/ext/bamtools/src/third_party/jsoncpp/CMakeFiles/jsoncpp.dir/build.make +157 -0
  163. data/ext/bamtools/src/third_party/jsoncpp/CMakeFiles/jsoncpp.dir/cmake_clean.cmake +13 -0
  164. data/ext/bamtools/src/third_party/jsoncpp/CMakeFiles/jsoncpp.dir/depend.internal +31 -0
  165. data/ext/bamtools/src/third_party/jsoncpp/CMakeFiles/jsoncpp.dir/depend.make +31 -0
  166. data/ext/bamtools/src/third_party/jsoncpp/CMakeFiles/jsoncpp.dir/flags.make +8 -0
  167. data/ext/bamtools/src/third_party/jsoncpp/CMakeFiles/jsoncpp.dir/json_reader.cpp.o +0 -0
  168. data/ext/bamtools/src/third_party/jsoncpp/CMakeFiles/jsoncpp.dir/json_value.cpp.o +0 -0
  169. data/ext/bamtools/src/third_party/jsoncpp/CMakeFiles/jsoncpp.dir/json_writer.cpp.o +0 -0
  170. data/ext/bamtools/src/third_party/jsoncpp/CMakeFiles/jsoncpp.dir/link.txt +1 -0
  171. data/ext/bamtools/src/third_party/jsoncpp/CMakeFiles/jsoncpp.dir/progress.make +4 -0
  172. data/ext/bamtools/src/third_party/jsoncpp/CMakeFiles/progress.marks +1 -0
  173. data/ext/bamtools/src/third_party/jsoncpp/CMakeLists.txt +23 -0
  174. data/ext/bamtools/src/third_party/jsoncpp/LICENSE +55 -0
  175. data/ext/bamtools/src/third_party/jsoncpp/Makefile +263 -0
  176. data/ext/bamtools/src/third_party/jsoncpp/cmake_install.cmake +29 -0
  177. data/ext/bamtools/src/third_party/jsoncpp/json.h +15 -0
  178. data/ext/bamtools/src/third_party/jsoncpp/json_batchallocator.h +130 -0
  179. data/ext/bamtools/src/third_party/jsoncpp/json_config.h +42 -0
  180. data/ext/bamtools/src/third_party/jsoncpp/json_features.h +47 -0
  181. data/ext/bamtools/src/third_party/jsoncpp/json_forwards.h +42 -0
  182. data/ext/bamtools/src/third_party/jsoncpp/json_internalarray.inl +453 -0
  183. data/ext/bamtools/src/third_party/jsoncpp/json_internalmap.inl +612 -0
  184. data/ext/bamtools/src/third_party/jsoncpp/json_reader.cpp +870 -0
  185. data/ext/bamtools/src/third_party/jsoncpp/json_reader.h +201 -0
  186. data/ext/bamtools/src/third_party/jsoncpp/json_tool.h +93 -0
  187. data/ext/bamtools/src/third_party/jsoncpp/json_value.cpp +1701 -0
  188. data/ext/bamtools/src/third_party/jsoncpp/json_value.h +1059 -0
  189. data/ext/bamtools/src/third_party/jsoncpp/json_valueiterator.inl +297 -0
  190. data/ext/bamtools/src/third_party/jsoncpp/json_writer.cpp +819 -0
  191. data/ext/bamtools/src/third_party/jsoncpp/json_writer.h +179 -0
  192. data/ext/bamtools/src/toolkit/CMakeFiles/CMakeDirectoryInformation.cmake +25 -0
  193. data/ext/bamtools/src/toolkit/CMakeFiles/bamtools_cmd.dir/CXX.includecache +698 -0
  194. data/ext/bamtools/src/toolkit/CMakeFiles/bamtools_cmd.dir/DependInfo.cmake +34 -0
  195. data/ext/bamtools/src/toolkit/CMakeFiles/bamtools_cmd.dir/bamtools.cpp.o +0 -0
  196. data/ext/bamtools/src/toolkit/CMakeFiles/bamtools_cmd.dir/bamtools_convert.cpp.o +0 -0
  197. data/ext/bamtools/src/toolkit/CMakeFiles/bamtools_cmd.dir/bamtools_count.cpp.o +0 -0
  198. data/ext/bamtools/src/toolkit/CMakeFiles/bamtools_cmd.dir/bamtools_coverage.cpp.o +0 -0
  199. data/ext/bamtools/src/toolkit/CMakeFiles/bamtools_cmd.dir/bamtools_filter.cpp.o +0 -0
  200. data/ext/bamtools/src/toolkit/CMakeFiles/bamtools_cmd.dir/bamtools_header.cpp.o +0 -0
  201. data/ext/bamtools/src/toolkit/CMakeFiles/bamtools_cmd.dir/bamtools_index.cpp.o +0 -0
  202. data/ext/bamtools/src/toolkit/CMakeFiles/bamtools_cmd.dir/bamtools_merge.cpp.o +0 -0
  203. data/ext/bamtools/src/toolkit/CMakeFiles/bamtools_cmd.dir/bamtools_random.cpp.o +0 -0
  204. data/ext/bamtools/src/toolkit/CMakeFiles/bamtools_cmd.dir/bamtools_resolve.cpp.o +0 -0
  205. data/ext/bamtools/src/toolkit/CMakeFiles/bamtools_cmd.dir/bamtools_revert.cpp.o +0 -0
  206. data/ext/bamtools/src/toolkit/CMakeFiles/bamtools_cmd.dir/bamtools_sort.cpp.o +0 -0
  207. data/ext/bamtools/src/toolkit/CMakeFiles/bamtools_cmd.dir/bamtools_split.cpp.o +0 -0
  208. data/ext/bamtools/src/toolkit/CMakeFiles/bamtools_cmd.dir/bamtools_stats.cpp.o +0 -0
  209. data/ext/bamtools/src/toolkit/CMakeFiles/bamtools_cmd.dir/build.make +447 -0
  210. data/ext/bamtools/src/toolkit/CMakeFiles/bamtools_cmd.dir/cmake_clean.cmake +24 -0
  211. data/ext/bamtools/src/toolkit/CMakeFiles/bamtools_cmd.dir/depend.internal +319 -0
  212. data/ext/bamtools/src/toolkit/CMakeFiles/bamtools_cmd.dir/depend.make +319 -0
  213. data/ext/bamtools/src/toolkit/CMakeFiles/bamtools_cmd.dir/flags.make +8 -0
  214. data/ext/bamtools/src/toolkit/CMakeFiles/bamtools_cmd.dir/link.txt +1 -0
  215. data/ext/bamtools/src/toolkit/CMakeFiles/bamtools_cmd.dir/progress.make +15 -0
  216. data/ext/bamtools/src/toolkit/CMakeFiles/progress.marks +1 -0
  217. data/ext/bamtools/src/toolkit/CMakeLists.txt +44 -0
  218. data/ext/bamtools/src/toolkit/Makefile +560 -0
  219. data/ext/bamtools/src/toolkit/bamtools.cpp +163 -0
  220. data/ext/bamtools/src/toolkit/bamtools_convert.cpp +888 -0
  221. data/ext/bamtools/src/toolkit/bamtools_convert.h +37 -0
  222. data/ext/bamtools/src/toolkit/bamtools_count.cpp +187 -0
  223. data/ext/bamtools/src/toolkit/bamtools_count.h +37 -0
  224. data/ext/bamtools/src/toolkit/bamtools_coverage.cpp +196 -0
  225. data/ext/bamtools/src/toolkit/bamtools_coverage.h +37 -0
  226. data/ext/bamtools/src/toolkit/bamtools_filter.cpp +911 -0
  227. data/ext/bamtools/src/toolkit/bamtools_filter.h +37 -0
  228. data/ext/bamtools/src/toolkit/bamtools_header.cpp +122 -0
  229. data/ext/bamtools/src/toolkit/bamtools_header.h +38 -0
  230. data/ext/bamtools/src/toolkit/bamtools_index.cpp +126 -0
  231. data/ext/bamtools/src/toolkit/bamtools_index.h +37 -0
  232. data/ext/bamtools/src/toolkit/bamtools_merge.cpp +221 -0
  233. data/ext/bamtools/src/toolkit/bamtools_merge.h +37 -0
  234. data/ext/bamtools/src/toolkit/bamtools_random.cpp +255 -0
  235. data/ext/bamtools/src/toolkit/bamtools_random.h +37 -0
  236. data/ext/bamtools/src/toolkit/bamtools_resolve.cpp +1396 -0
  237. data/ext/bamtools/src/toolkit/bamtools_resolve.h +42 -0
  238. data/ext/bamtools/src/toolkit/bamtools_revert.cpp +194 -0
  239. data/ext/bamtools/src/toolkit/bamtools_revert.h +37 -0
  240. data/ext/bamtools/src/toolkit/bamtools_sort.cpp +410 -0
  241. data/ext/bamtools/src/toolkit/bamtools_sort.h +37 -0
  242. data/ext/bamtools/src/toolkit/bamtools_split.cpp +551 -0
  243. data/ext/bamtools/src/toolkit/bamtools_split.h +38 -0
  244. data/ext/bamtools/src/toolkit/bamtools_stats.cpp +286 -0
  245. data/ext/bamtools/src/toolkit/bamtools_stats.h +37 -0
  246. data/ext/bamtools/src/toolkit/bamtools_tool.h +35 -0
  247. data/ext/bamtools/src/toolkit/bamtools_version.h +20 -0
  248. data/ext/bamtools/src/toolkit/bamtools_version.h.in +20 -0
  249. data/ext/bamtools/src/toolkit/cmake_install.cmake +52 -0
  250. data/ext/bamtools/src/utils/CMakeFiles/BamTools-utils.dir/CXX.includecache +250 -0
  251. data/ext/bamtools/src/utils/CMakeFiles/BamTools-utils.dir/DependInfo.cmake +29 -0
  252. data/ext/bamtools/src/utils/CMakeFiles/BamTools-utils.dir/bamtools_fasta.cpp.o +0 -0
  253. data/ext/bamtools/src/utils/CMakeFiles/BamTools-utils.dir/bamtools_options.cpp.o +0 -0
  254. data/ext/bamtools/src/utils/CMakeFiles/BamTools-utils.dir/bamtools_pileup_engine.cpp.o +0 -0
  255. data/ext/bamtools/src/utils/CMakeFiles/BamTools-utils.dir/bamtools_utilities.cpp.o +0 -0
  256. data/ext/bamtools/src/utils/CMakeFiles/BamTools-utils.dir/build.make +184 -0
  257. data/ext/bamtools/src/utils/CMakeFiles/BamTools-utils.dir/cmake_clean.cmake +14 -0
  258. data/ext/bamtools/src/utils/CMakeFiles/BamTools-utils.dir/depend.internal +40 -0
  259. data/ext/bamtools/src/utils/CMakeFiles/BamTools-utils.dir/depend.make +40 -0
  260. data/ext/bamtools/src/utils/CMakeFiles/BamTools-utils.dir/flags.make +8 -0
  261. data/ext/bamtools/src/utils/CMakeFiles/BamTools-utils.dir/link.txt +1 -0
  262. data/ext/bamtools/src/utils/CMakeFiles/BamTools-utils.dir/progress.make +5 -0
  263. data/ext/bamtools/src/utils/CMakeFiles/CMakeDirectoryInformation.cmake +23 -0
  264. data/ext/bamtools/src/utils/CMakeFiles/progress.marks +1 -0
  265. data/ext/bamtools/src/utils/CMakeLists.txt +30 -0
  266. data/ext/bamtools/src/utils/Makefile +290 -0
  267. data/ext/bamtools/src/utils/bamtools_fasta.cpp +632 -0
  268. data/ext/bamtools/src/utils/bamtools_fasta.h +47 -0
  269. data/ext/bamtools/src/utils/bamtools_filter_engine.h +552 -0
  270. data/ext/bamtools/src/utils/bamtools_filter_properties.h +195 -0
  271. data/ext/bamtools/src/utils/bamtools_filter_ruleparser.h +319 -0
  272. data/ext/bamtools/src/utils/bamtools_options.cpp +287 -0
  273. data/ext/bamtools/src/utils/bamtools_options.h +213 -0
  274. data/ext/bamtools/src/utils/bamtools_pileup_engine.cpp +327 -0
  275. data/ext/bamtools/src/utils/bamtools_pileup_engine.h +94 -0
  276. data/ext/bamtools/src/utils/bamtools_utilities.cpp +333 -0
  277. data/ext/bamtools/src/utils/bamtools_utilities.h +67 -0
  278. data/ext/bamtools/src/utils/bamtools_variant.h +128 -0
  279. data/ext/bamtools/src/utils/cmake_install.cmake +29 -0
  280. data/ext/bamtools/src/utils/utils_global.h +21 -0
  281. data/lib/ngs_server/version.rb +3 -0
  282. data/lib/ngs_server.rb +3 -0
  283. data/ngs_server.gemspec +23 -0
  284. metadata +339 -0
@@ -0,0 +1,1059 @@
1
+ // Copyright 2007-2010 Baptiste Lepilleur
2
+ // Distributed under MIT license, or public domain if desired and
3
+ // recognized in your jurisdiction.
4
+ // See file LICENSE for detail or copy at http://jsoncpp.sourceforge.net/LICENSE
5
+
6
+ #ifndef CPPTL_JSON_H_INCLUDED
7
+ # define CPPTL_JSON_H_INCLUDED
8
+
9
+ # include "json_forwards.h"
10
+ # include <string>
11
+ # include <vector>
12
+
13
+ # ifndef JSON_USE_CPPTL_SMALLMAP
14
+ # include <map>
15
+ # else
16
+ # include <cpptl/smallmap.h>
17
+ # endif
18
+ # ifdef JSON_USE_CPPTL
19
+ # include <cpptl/forwards.h>
20
+ # endif
21
+
22
+ /** \brief JSON (JavaScript Object Notation).
23
+ */
24
+ namespace Json {
25
+
26
+ /** \brief Type of the value held by a Value object.
27
+ */
28
+ enum ValueType
29
+ {
30
+ nullValue = 0, ///< 'null' value
31
+ intValue, ///< signed integer value
32
+ uintValue, ///< unsigned integer value
33
+ realValue, ///< double value
34
+ stringValue, ///< UTF-8 string value
35
+ booleanValue, ///< bool value
36
+ arrayValue, ///< array value (ordered list)
37
+ objectValue ///< object value (collection of name/value pairs).
38
+ };
39
+
40
+ enum CommentPlacement
41
+ {
42
+ commentBefore = 0, ///< a comment placed on the line before a value
43
+ commentAfterOnSameLine, ///< a comment just after a value on the same line
44
+ commentAfter, ///< a comment on the line after a value (only make sense for root value)
45
+ numberOfCommentPlacement
46
+ };
47
+
48
+ //# ifdef JSON_USE_CPPTL
49
+ // typedef CppTL::AnyEnumerator<const char *> EnumMemberNames;
50
+ // typedef CppTL::AnyEnumerator<const Value &> EnumValues;
51
+ //# endif
52
+
53
+ /** \brief Lightweight wrapper to tag static string.
54
+ *
55
+ * Value constructor and objectValue member assignement takes advantage of the
56
+ * StaticString and avoid the cost of string duplication when storing the
57
+ * string or the member name.
58
+ *
59
+ * Example of usage:
60
+ * \code
61
+ * Json::Value aValue( StaticString("some text") );
62
+ * Json::Value object;
63
+ * static const StaticString code("code");
64
+ * object[code] = 1234;
65
+ * \endcode
66
+ */
67
+ class JSON_API StaticString
68
+ {
69
+ public:
70
+ explicit StaticString( const char *czstring )
71
+ : str_( czstring )
72
+ {
73
+ }
74
+
75
+ operator const char *() const
76
+ {
77
+ return str_;
78
+ }
79
+
80
+ const char *c_str() const
81
+ {
82
+ return str_;
83
+ }
84
+
85
+ private:
86
+ const char *str_;
87
+ };
88
+
89
+ /** \brief Represents a <a HREF="http://www.json.org">JSON</a> value.
90
+ *
91
+ * This class is a discriminated union wrapper that can represents a:
92
+ * - signed integer [range: Value::minInt - Value::maxInt]
93
+ * - unsigned integer (range: 0 - Value::maxUInt)
94
+ * - double
95
+ * - UTF-8 string
96
+ * - boolean
97
+ * - 'null'
98
+ * - an ordered list of Value
99
+ * - collection of name/value pairs (javascript object)
100
+ *
101
+ * The type of the held value is represented by a #ValueType and
102
+ * can be obtained using type().
103
+ *
104
+ * values of an #objectValue or #arrayValue can be accessed using operator[]() methods.
105
+ * Non const methods will automatically create the a #nullValue element
106
+ * if it does not exist.
107
+ * The sequence of an #arrayValue will be automatically resize and initialized
108
+ * with #nullValue. resize() can be used to enlarge or truncate an #arrayValue.
109
+ *
110
+ * The get() methods can be used to obtanis default value in the case the required element
111
+ * does not exist.
112
+ *
113
+ * It is possible to iterate over the list of a #objectValue values using
114
+ * the getMemberNames() method.
115
+ */
116
+ class JSON_API Value
117
+ {
118
+ friend class ValueIteratorBase;
119
+ # ifdef JSON_VALUE_USE_INTERNAL_MAP
120
+ friend class ValueInternalLink;
121
+ friend class ValueInternalMap;
122
+ # endif
123
+ public:
124
+ typedef std::vector<std::string> Members;
125
+ typedef ValueIterator iterator;
126
+ typedef ValueConstIterator const_iterator;
127
+ typedef Json::UInt UInt;
128
+ typedef Json::Int Int;
129
+ typedef Json::ArrayIndex ArrayIndex;
130
+
131
+ static const Value null;
132
+ static const Int minInt;
133
+ static const Int maxInt;
134
+ static const UInt maxUInt;
135
+
136
+ private:
137
+ #ifndef JSONCPP_DOC_EXCLUDE_IMPLEMENTATION
138
+ # ifndef JSON_VALUE_USE_INTERNAL_MAP
139
+ class CZString
140
+ {
141
+ public:
142
+ enum DuplicationPolicy
143
+ {
144
+ noDuplication = 0,
145
+ duplicate,
146
+ duplicateOnCopy
147
+ };
148
+ CZString( ArrayIndex index );
149
+ CZString( const char *cstr, DuplicationPolicy allocate );
150
+ CZString( const CZString &other );
151
+ ~CZString();
152
+ CZString &operator =( const CZString &other );
153
+ bool operator<( const CZString &other ) const;
154
+ bool operator==( const CZString &other ) const;
155
+ ArrayIndex index() const;
156
+ const char *c_str() const;
157
+ bool isStaticString() const;
158
+ private:
159
+ void swap( CZString &other );
160
+ const char *cstr_;
161
+ ArrayIndex index_;
162
+ };
163
+
164
+ public:
165
+ # ifndef JSON_USE_CPPTL_SMALLMAP
166
+ typedef std::map<CZString, Value> ObjectValues;
167
+ # else
168
+ typedef CppTL::SmallMap<CZString, Value> ObjectValues;
169
+ # endif // ifndef JSON_USE_CPPTL_SMALLMAP
170
+ # endif // ifndef JSON_VALUE_USE_INTERNAL_MAP
171
+ #endif // ifndef JSONCPP_DOC_EXCLUDE_IMPLEMENTATION
172
+
173
+ public:
174
+ /** \brief Create a default Value of the given type.
175
+
176
+ This is a very useful constructor.
177
+ To create an empty array, pass arrayValue.
178
+ To create an empty object, pass objectValue.
179
+ Another Value can then be set to this one by assignment.
180
+ This is useful since clear() and resize() will not alter types.
181
+
182
+ Examples:
183
+ \code
184
+ Json::Value null_value; // null
185
+ Json::Value arr_value(Json::arrayValue); // []
186
+ Json::Value obj_value(Json::objectValue); // {}
187
+ \endcode
188
+ */
189
+ Value( ValueType type = nullValue );
190
+ #if !defined(JSON_NO_INT64)
191
+ Value( int value );
192
+ Value( ArrayIndex value );
193
+ #endif // if !defined(JSON_NO_INT64)
194
+ Value( Int value );
195
+ Value( UInt value );
196
+ Value( double value );
197
+ Value( const char *value );
198
+ Value( const char *beginValue, const char *endValue );
199
+ /** \brief Constructs a value from a static string.
200
+
201
+ * Like other value string constructor but do not duplicate the string for
202
+ * internal storage. The given string must remain alive after the call to this
203
+ * constructor.
204
+ * Example of usage:
205
+ * \code
206
+ * Json::Value aValue( StaticString("some text") );
207
+ * \endcode
208
+ */
209
+ Value( const StaticString &value );
210
+ Value( const std::string &value );
211
+ # ifdef JSON_USE_CPPTL
212
+ Value( const CppTL::ConstString &value );
213
+ # endif
214
+ Value( bool value );
215
+ Value( const Value &other );
216
+ ~Value();
217
+
218
+ Value &operator=( const Value &other );
219
+ /// Swap values.
220
+ /// \note Currently, comments are intentionally not swapped, for
221
+ /// both logic and efficiency.
222
+ void swap( Value &other );
223
+
224
+ ValueType type() const;
225
+
226
+ bool operator <( const Value &other ) const;
227
+ bool operator <=( const Value &other ) const;
228
+ bool operator >=( const Value &other ) const;
229
+ bool operator >( const Value &other ) const;
230
+
231
+ bool operator ==( const Value &other ) const;
232
+ bool operator !=( const Value &other ) const;
233
+
234
+ int compare( const Value &other );
235
+
236
+ const char *asCString() const;
237
+ std::string asString() const;
238
+ # ifdef JSON_USE_CPPTL
239
+ CppTL::ConstString asConstString() const;
240
+ # endif
241
+ Int asInt() const;
242
+ UInt asUInt() const;
243
+ double asDouble() const;
244
+ bool asBool() const;
245
+
246
+ bool isNull() const;
247
+ bool isBool() const;
248
+ bool isInt() const;
249
+ bool isUInt() const;
250
+ bool isIntegral() const;
251
+ bool isDouble() const;
252
+ bool isNumeric() const;
253
+ bool isString() const;
254
+ bool isArray() const;
255
+ bool isObject() const;
256
+
257
+ bool isConvertibleTo( ValueType other ) const;
258
+
259
+ /// Number of values in array or object
260
+ ArrayIndex size() const;
261
+
262
+ /// \brief Return true if empty array, empty object, or null;
263
+ /// otherwise, false.
264
+ bool empty() const;
265
+
266
+ /// Return isNull()
267
+ bool operator!() const;
268
+
269
+ /// Remove all object members and array elements.
270
+ /// \pre type() is arrayValue, objectValue, or nullValue
271
+ /// \post type() is unchanged
272
+ void clear();
273
+
274
+ /// Resize the array to size elements.
275
+ /// New elements are initialized to null.
276
+ /// May only be called on nullValue or arrayValue.
277
+ /// \pre type() is arrayValue or nullValue
278
+ /// \post type() is arrayValue
279
+ void resize( ArrayIndex size );
280
+
281
+ /// Access an array element (zero based index ).
282
+ /// If the array contains less than index element, then null value are inserted
283
+ /// in the array so that its size is index+1.
284
+ /// (You may need to say 'value[0u]' to get your compiler to distinguish
285
+ /// this from the operator[] which takes a string.)
286
+ Value &operator[]( ArrayIndex index );
287
+ /// Access an array element (zero based index )
288
+ /// (You may need to say 'value[0u]' to get your compiler to distinguish
289
+ /// this from the operator[] which takes a string.)
290
+ const Value &operator[]( ArrayIndex index ) const;
291
+ /// If the array contains at least index+1 elements, returns the element value,
292
+ /// otherwise returns defaultValue.
293
+ Value get( ArrayIndex index,
294
+ const Value &defaultValue ) const;
295
+ /// Return true if index < size().
296
+ bool isValidIndex( ArrayIndex index ) const;
297
+ /// \brief Append value to array at the end.
298
+ ///
299
+ /// Equivalent to jsonvalue[jsonvalue.size()] = value;
300
+ Value &append( const Value &value );
301
+
302
+ /// Access an object value by name, create a null member if it does not exist.
303
+ Value &operator[]( const char *key );
304
+ /// Access an object value by name, returns null if there is no member with that name.
305
+ const Value &operator[]( const char *key ) const;
306
+ /// Access an object value by name, create a null member if it does not exist.
307
+ Value &operator[]( const std::string &key );
308
+ /// Access an object value by name, returns null if there is no member with that name.
309
+ const Value &operator[]( const std::string &key ) const;
310
+ /** \brief Access an object value by name, create a null member if it does not exist.
311
+
312
+ * If the object as no entry for that name, then the member name used to store
313
+ * the new entry is not duplicated.
314
+ * Example of use:
315
+ * \code
316
+ * Json::Value object;
317
+ * static const StaticString code("code");
318
+ * object[code] = 1234;
319
+ * \endcode
320
+ */
321
+ Value &operator[]( const StaticString &key );
322
+ # ifdef JSON_USE_CPPTL
323
+ /// Access an object value by name, create a null member if it does not exist.
324
+ Value &operator[]( const CppTL::ConstString &key );
325
+ /// Access an object value by name, returns null if there is no member with that name.
326
+ const Value &operator[]( const CppTL::ConstString &key ) const;
327
+ # endif
328
+ /// Return the member named key if it exist, defaultValue otherwise.
329
+ Value get( const char *key,
330
+ const Value &defaultValue ) const;
331
+ /// Return the member named key if it exist, defaultValue otherwise.
332
+ Value get( const std::string &key,
333
+ const Value &defaultValue ) const;
334
+ # ifdef JSON_USE_CPPTL
335
+ /// Return the member named key if it exist, defaultValue otherwise.
336
+ Value get( const CppTL::ConstString &key,
337
+ const Value &defaultValue ) const;
338
+ # endif
339
+ /// \brief Remove and return the named member.
340
+ ///
341
+ /// Do nothing if it did not exist.
342
+ /// \return the removed Value, or null.
343
+ /// \pre type() is objectValue or nullValue
344
+ /// \post type() is unchanged
345
+ Value removeMember( const char* key );
346
+ /// Same as removeMember(const char*)
347
+ Value removeMember( const std::string &key );
348
+
349
+ /// Return true if the object has a member named key.
350
+ bool isMember( const char *key ) const;
351
+ /// Return true if the object has a member named key.
352
+ bool isMember( const std::string &key ) const;
353
+ # ifdef JSON_USE_CPPTL
354
+ /// Return true if the object has a member named key.
355
+ bool isMember( const CppTL::ConstString &key ) const;
356
+ # endif
357
+
358
+ /// \brief Return a list of the member names.
359
+ ///
360
+ /// If null, return an empty list.
361
+ /// \pre type() is objectValue or nullValue
362
+ /// \post if type() was nullValue, it remains nullValue
363
+ Members getMemberNames() const;
364
+
365
+ //# ifdef JSON_USE_CPPTL
366
+ // EnumMemberNames enumMemberNames() const;
367
+ // EnumValues enumValues() const;
368
+ //# endif
369
+
370
+ /// Comments must be //... or /* ... */
371
+ void setComment( const char *comment,
372
+ CommentPlacement placement );
373
+ /// Comments must be //... or /* ... */
374
+ void setComment( const std::string &comment,
375
+ CommentPlacement placement );
376
+ bool hasComment( CommentPlacement placement ) const;
377
+ /// Include delimiters and embedded newlines.
378
+ std::string getComment( CommentPlacement placement ) const;
379
+
380
+ std::string toStyledString() const;
381
+
382
+ const_iterator begin() const;
383
+ const_iterator end() const;
384
+
385
+ iterator begin();
386
+ iterator end();
387
+
388
+ private:
389
+ Value &resolveReference( const char *key,
390
+ bool isStatic );
391
+
392
+ # ifdef JSON_VALUE_USE_INTERNAL_MAP
393
+ inline bool isItemAvailable() const
394
+ {
395
+ return itemIsUsed_ == 0;
396
+ }
397
+
398
+ inline void setItemUsed( bool isUsed = true )
399
+ {
400
+ itemIsUsed_ = isUsed ? 1 : 0;
401
+ }
402
+
403
+ inline bool isMemberNameStatic() const
404
+ {
405
+ return memberNameIsStatic_ == 0;
406
+ }
407
+
408
+ inline void setMemberNameIsStatic( bool isStatic )
409
+ {
410
+ memberNameIsStatic_ = isStatic ? 1 : 0;
411
+ }
412
+ # endif // # ifdef JSON_VALUE_USE_INTERNAL_MAP
413
+
414
+ private:
415
+ struct CommentInfo
416
+ {
417
+ CommentInfo();
418
+ ~CommentInfo();
419
+
420
+ void setComment( const char *text );
421
+
422
+ char *comment_;
423
+ };
424
+
425
+ //struct MemberNamesTransform
426
+ //{
427
+ // typedef const char *result_type;
428
+ // const char *operator()( const CZString &name ) const
429
+ // {
430
+ // return name.c_str();
431
+ // }
432
+ //};
433
+
434
+ union ValueHolder
435
+ {
436
+ Int int_;
437
+ UInt uint_;
438
+ double real_;
439
+ bool bool_;
440
+ char *string_;
441
+ # ifdef JSON_VALUE_USE_INTERNAL_MAP
442
+ ValueInternalArray *array_;
443
+ ValueInternalMap *map_;
444
+ #else
445
+ ObjectValues *map_;
446
+ # endif
447
+ } value_;
448
+ ValueType type_ : 8;
449
+ int allocated_ : 1; // Notes: if declared as bool, bitfield is useless.
450
+ # ifdef JSON_VALUE_USE_INTERNAL_MAP
451
+ unsigned int itemIsUsed_ : 1; // used by the ValueInternalMap container.
452
+ int memberNameIsStatic_ : 1; // used by the ValueInternalMap container.
453
+ # endif
454
+ CommentInfo *comments_;
455
+ };
456
+
457
+
458
+ /** \brief Experimental and untested: represents an element of the "path" to access a node.
459
+ */
460
+ class PathArgument
461
+ {
462
+ public:
463
+ friend class Path;
464
+
465
+ PathArgument();
466
+ PathArgument( ArrayIndex index );
467
+ PathArgument( const char *key );
468
+ PathArgument( const std::string &key );
469
+
470
+ private:
471
+ enum Kind
472
+ {
473
+ kindNone = 0,
474
+ kindIndex,
475
+ kindKey
476
+ };
477
+ std::string key_;
478
+ ArrayIndex index_;
479
+ Kind kind_;
480
+ };
481
+
482
+ /** \brief Experimental and untested: represents a "path" to access a node.
483
+ *
484
+ * Syntax:
485
+ * - "." => root node
486
+ * - ".[n]" => elements at index 'n' of root node (an array value)
487
+ * - ".name" => member named 'name' of root node (an object value)
488
+ * - ".name1.name2.name3"
489
+ * - ".[0][1][2].name1[3]"
490
+ * - ".%" => member name is provided as parameter
491
+ * - ".[%]" => index is provied as parameter
492
+ */
493
+ class Path
494
+ {
495
+ public:
496
+ Path( const std::string &path,
497
+ const PathArgument &a1 = PathArgument(),
498
+ const PathArgument &a2 = PathArgument(),
499
+ const PathArgument &a3 = PathArgument(),
500
+ const PathArgument &a4 = PathArgument(),
501
+ const PathArgument &a5 = PathArgument() );
502
+
503
+ const Value &resolve( const Value &root ) const;
504
+ Value resolve( const Value &root,
505
+ const Value &defaultValue ) const;
506
+ /// Creates the "path" to access the specified node and returns a reference on the node.
507
+ Value &make( Value &root ) const;
508
+
509
+ private:
510
+ typedef std::vector<const PathArgument *> InArgs;
511
+ typedef std::vector<PathArgument> Args;
512
+
513
+ void makePath( const std::string &path,
514
+ const InArgs &in );
515
+ void addPathInArg( const std::string &path,
516
+ const InArgs &in,
517
+ InArgs::const_iterator &itInArg,
518
+ PathArgument::Kind kind );
519
+ void invalidPath( const std::string &path,
520
+ int location );
521
+
522
+ Args args_;
523
+ };
524
+
525
+
526
+
527
+ #ifdef JSON_VALUE_USE_INTERNAL_MAP
528
+ /** \brief Allocator to customize Value internal map.
529
+ * Below is an example of a simple implementation (default implementation actually
530
+ * use memory pool for speed).
531
+ * \code
532
+ class DefaultValueMapAllocator : public ValueMapAllocator
533
+ {
534
+ public: // overridden from ValueMapAllocator
535
+ virtual ValueInternalMap *newMap()
536
+ {
537
+ return new ValueInternalMap();
538
+ }
539
+
540
+ virtual ValueInternalMap *newMapCopy( const ValueInternalMap &other )
541
+ {
542
+ return new ValueInternalMap( other );
543
+ }
544
+
545
+ virtual void destructMap( ValueInternalMap *map )
546
+ {
547
+ delete map;
548
+ }
549
+
550
+ virtual ValueInternalLink *allocateMapBuckets( unsigned int size )
551
+ {
552
+ return new ValueInternalLink[size];
553
+ }
554
+
555
+ virtual void releaseMapBuckets( ValueInternalLink *links )
556
+ {
557
+ delete [] links;
558
+ }
559
+
560
+ virtual ValueInternalLink *allocateMapLink()
561
+ {
562
+ return new ValueInternalLink();
563
+ }
564
+
565
+ virtual void releaseMapLink( ValueInternalLink *link )
566
+ {
567
+ delete link;
568
+ }
569
+ };
570
+ * \endcode
571
+ */
572
+ class JSON_API ValueMapAllocator
573
+ {
574
+ public:
575
+ virtual ~ValueMapAllocator();
576
+ virtual ValueInternalMap *newMap() = 0;
577
+ virtual ValueInternalMap *newMapCopy( const ValueInternalMap &other ) = 0;
578
+ virtual void destructMap( ValueInternalMap *map ) = 0;
579
+ virtual ValueInternalLink *allocateMapBuckets( unsigned int size ) = 0;
580
+ virtual void releaseMapBuckets( ValueInternalLink *links ) = 0;
581
+ virtual ValueInternalLink *allocateMapLink() = 0;
582
+ virtual void releaseMapLink( ValueInternalLink *link ) = 0;
583
+ };
584
+
585
+ /** \brief ValueInternalMap hash-map bucket chain link (for internal use only).
586
+ * \internal previous_ & next_ allows for bidirectional traversal.
587
+ */
588
+ class JSON_API ValueInternalLink
589
+ {
590
+ public:
591
+ enum { itemPerLink = 6 }; // sizeof(ValueInternalLink) = 128 on 32 bits architecture.
592
+ enum InternalFlags {
593
+ flagAvailable = 0,
594
+ flagUsed = 1
595
+ };
596
+
597
+ ValueInternalLink();
598
+
599
+ ~ValueInternalLink();
600
+
601
+ Value items_[itemPerLink];
602
+ char *keys_[itemPerLink];
603
+ ValueInternalLink *previous_;
604
+ ValueInternalLink *next_;
605
+ };
606
+
607
+
608
+ /** \brief A linked page based hash-table implementation used internally by Value.
609
+ * \internal ValueInternalMap is a tradional bucket based hash-table, with a linked
610
+ * list in each bucket to handle collision. There is an addional twist in that
611
+ * each node of the collision linked list is a page containing a fixed amount of
612
+ * value. This provides a better compromise between memory usage and speed.
613
+ *
614
+ * Each bucket is made up of a chained list of ValueInternalLink. The last
615
+ * link of a given bucket can be found in the 'previous_' field of the following bucket.
616
+ * The last link of the last bucket is stored in tailLink_ as it has no following bucket.
617
+ * Only the last link of a bucket may contains 'available' item. The last link always
618
+ * contains at least one element unless is it the bucket one very first link.
619
+ */
620
+ class JSON_API ValueInternalMap
621
+ {
622
+ friend class ValueIteratorBase;
623
+ friend class Value;
624
+ public:
625
+ typedef unsigned int HashKey;
626
+ typedef unsigned int BucketIndex;
627
+
628
+ # ifndef JSONCPP_DOC_EXCLUDE_IMPLEMENTATION
629
+ struct IteratorState
630
+ {
631
+ IteratorState()
632
+ : map_(0)
633
+ , link_(0)
634
+ , itemIndex_(0)
635
+ , bucketIndex_(0)
636
+ {
637
+ }
638
+ ValueInternalMap *map_;
639
+ ValueInternalLink *link_;
640
+ BucketIndex itemIndex_;
641
+ BucketIndex bucketIndex_;
642
+ };
643
+ # endif // ifndef JSONCPP_DOC_EXCLUDE_IMPLEMENTATION
644
+
645
+ ValueInternalMap();
646
+ ValueInternalMap( const ValueInternalMap &other );
647
+ ValueInternalMap &operator =( const ValueInternalMap &other );
648
+ ~ValueInternalMap();
649
+
650
+ void swap( ValueInternalMap &other );
651
+
652
+ BucketIndex size() const;
653
+
654
+ void clear();
655
+
656
+ bool reserveDelta( BucketIndex growth );
657
+
658
+ bool reserve( BucketIndex newItemCount );
659
+
660
+ const Value *find( const char *key ) const;
661
+
662
+ Value *find( const char *key );
663
+
664
+ Value &resolveReference( const char *key,
665
+ bool isStatic );
666
+
667
+ void remove( const char *key );
668
+
669
+ void doActualRemove( ValueInternalLink *link,
670
+ BucketIndex index,
671
+ BucketIndex bucketIndex );
672
+
673
+ ValueInternalLink *&getLastLinkInBucket( BucketIndex bucketIndex );
674
+
675
+ Value &setNewItem( const char *key,
676
+ bool isStatic,
677
+ ValueInternalLink *link,
678
+ BucketIndex index );
679
+
680
+ Value &unsafeAdd( const char *key,
681
+ bool isStatic,
682
+ HashKey hashedKey );
683
+
684
+ HashKey hash( const char *key ) const;
685
+
686
+ int compare( const ValueInternalMap &other ) const;
687
+
688
+ private:
689
+ void makeBeginIterator( IteratorState &it ) const;
690
+ void makeEndIterator( IteratorState &it ) const;
691
+ static bool equals( const IteratorState &x, const IteratorState &other );
692
+ static void increment( IteratorState &iterator );
693
+ static void incrementBucket( IteratorState &iterator );
694
+ static void decrement( IteratorState &iterator );
695
+ static const char *key( const IteratorState &iterator );
696
+ static const char *key( const IteratorState &iterator, bool &isStatic );
697
+ static Value &value( const IteratorState &iterator );
698
+ static int distance( const IteratorState &x, const IteratorState &y );
699
+
700
+ private:
701
+ ValueInternalLink *buckets_;
702
+ ValueInternalLink *tailLink_;
703
+ BucketIndex bucketsSize_;
704
+ BucketIndex itemCount_;
705
+ };
706
+
707
+ /** \brief A simplified deque implementation used internally by Value.
708
+ * \internal
709
+ * It is based on a list of fixed "page", each page contains a fixed number of items.
710
+ * Instead of using a linked-list, a array of pointer is used for fast item look-up.
711
+ * Look-up for an element is as follow:
712
+ * - compute page index: pageIndex = itemIndex / itemsPerPage
713
+ * - look-up item in page: pages_[pageIndex][itemIndex % itemsPerPage]
714
+ *
715
+ * Insertion is amortized constant time (only the array containing the index of pointers
716
+ * need to be reallocated when items are appended).
717
+ */
718
+ class JSON_API ValueInternalArray
719
+ {
720
+ friend class Value;
721
+ friend class ValueIteratorBase;
722
+ public:
723
+ enum { itemsPerPage = 8 }; // should be a power of 2 for fast divide and modulo.
724
+ typedef Value::ArrayIndex ArrayIndex;
725
+ typedef unsigned int PageIndex;
726
+
727
+ # ifndef JSONCPP_DOC_EXCLUDE_IMPLEMENTATION
728
+ struct IteratorState // Must be a POD
729
+ {
730
+ IteratorState()
731
+ : array_(0)
732
+ , currentPageIndex_(0)
733
+ , currentItemIndex_(0)
734
+ {
735
+ }
736
+ ValueInternalArray *array_;
737
+ Value **currentPageIndex_;
738
+ unsigned int currentItemIndex_;
739
+ };
740
+ # endif // ifndef JSONCPP_DOC_EXCLUDE_IMPLEMENTATION
741
+
742
+ ValueInternalArray();
743
+ ValueInternalArray( const ValueInternalArray &other );
744
+ ValueInternalArray &operator =( const ValueInternalArray &other );
745
+ ~ValueInternalArray();
746
+ void swap( ValueInternalArray &other );
747
+
748
+ void clear();
749
+ void resize( ArrayIndex newSize );
750
+
751
+ Value &resolveReference( ArrayIndex index );
752
+
753
+ Value *find( ArrayIndex index ) const;
754
+
755
+ ArrayIndex size() const;
756
+
757
+ int compare( const ValueInternalArray &other ) const;
758
+
759
+ private:
760
+ static bool equals( const IteratorState &x, const IteratorState &other );
761
+ static void increment( IteratorState &iterator );
762
+ static void decrement( IteratorState &iterator );
763
+ static Value &dereference( const IteratorState &iterator );
764
+ static Value &unsafeDereference( const IteratorState &iterator );
765
+ static int distance( const IteratorState &x, const IteratorState &y );
766
+ static ArrayIndex indexOf( const IteratorState &iterator );
767
+ void makeBeginIterator( IteratorState &it ) const;
768
+ void makeEndIterator( IteratorState &it ) const;
769
+ void makeIterator( IteratorState &it, ArrayIndex index ) const;
770
+
771
+ void makeIndexValid( ArrayIndex index );
772
+
773
+ Value **pages_;
774
+ ArrayIndex size_;
775
+ PageIndex pageCount_;
776
+ };
777
+
778
+ /** \brief Experimental: do not use. Allocator to customize Value internal array.
779
+ * Below is an example of a simple implementation (actual implementation use
780
+ * memory pool).
781
+ \code
782
+ class DefaultValueArrayAllocator : public ValueArrayAllocator
783
+ {
784
+ public: // overridden from ValueArrayAllocator
785
+ virtual ~DefaultValueArrayAllocator()
786
+ {
787
+ }
788
+
789
+ virtual ValueInternalArray *newArray()
790
+ {
791
+ return new ValueInternalArray();
792
+ }
793
+
794
+ virtual ValueInternalArray *newArrayCopy( const ValueInternalArray &other )
795
+ {
796
+ return new ValueInternalArray( other );
797
+ }
798
+
799
+ virtual void destruct( ValueInternalArray *array )
800
+ {
801
+ delete array;
802
+ }
803
+
804
+ virtual void reallocateArrayPageIndex( Value **&indexes,
805
+ ValueInternalArray::PageIndex &indexCount,
806
+ ValueInternalArray::PageIndex minNewIndexCount )
807
+ {
808
+ ValueInternalArray::PageIndex newIndexCount = (indexCount*3)/2 + 1;
809
+ if ( minNewIndexCount > newIndexCount )
810
+ newIndexCount = minNewIndexCount;
811
+ void *newIndexes = realloc( indexes, sizeof(Value*) * newIndexCount );
812
+ if ( !newIndexes )
813
+ throw std::bad_alloc();
814
+ indexCount = newIndexCount;
815
+ indexes = static_cast<Value **>( newIndexes );
816
+ }
817
+ virtual void releaseArrayPageIndex( Value **indexes,
818
+ ValueInternalArray::PageIndex indexCount )
819
+ {
820
+ if ( indexes )
821
+ free( indexes );
822
+ }
823
+
824
+ virtual Value *allocateArrayPage()
825
+ {
826
+ return static_cast<Value *>( malloc( sizeof(Value) * ValueInternalArray::itemsPerPage ) );
827
+ }
828
+
829
+ virtual void releaseArrayPage( Value *value )
830
+ {
831
+ if ( value )
832
+ free( value );
833
+ }
834
+ };
835
+ \endcode
836
+ */
837
+ class JSON_API ValueArrayAllocator
838
+ {
839
+ public:
840
+ virtual ~ValueArrayAllocator();
841
+ virtual ValueInternalArray *newArray() = 0;
842
+ virtual ValueInternalArray *newArrayCopy( const ValueInternalArray &other ) = 0;
843
+ virtual void destructArray( ValueInternalArray *array ) = 0;
844
+ /** \brief Reallocate array page index.
845
+ * Reallocates an array of pointer on each page.
846
+ * \param indexes [input] pointer on the current index. May be \c NULL.
847
+ * [output] pointer on the new index of at least
848
+ * \a minNewIndexCount pages.
849
+ * \param indexCount [input] current number of pages in the index.
850
+ * [output] number of page the reallocated index can handle.
851
+ * \b MUST be >= \a minNewIndexCount.
852
+ * \param minNewIndexCount Minimum number of page the new index must be able to
853
+ * handle.
854
+ */
855
+ virtual void reallocateArrayPageIndex( Value **&indexes,
856
+ ValueInternalArray::PageIndex &indexCount,
857
+ ValueInternalArray::PageIndex minNewIndexCount ) = 0;
858
+ virtual void releaseArrayPageIndex( Value **indexes,
859
+ ValueInternalArray::PageIndex indexCount ) = 0;
860
+ virtual Value *allocateArrayPage() = 0;
861
+ virtual void releaseArrayPage( Value *value ) = 0;
862
+ };
863
+ #endif // #ifdef JSON_VALUE_USE_INTERNAL_MAP
864
+
865
+
866
+ /** \brief base class for Value iterators.
867
+ *
868
+ */
869
+ class ValueIteratorBase
870
+ {
871
+ public:
872
+ typedef unsigned int size_t;
873
+ typedef int difference_type;
874
+ typedef ValueIteratorBase SelfType;
875
+
876
+ ValueIteratorBase();
877
+ #ifndef JSON_VALUE_USE_INTERNAL_MAP
878
+ explicit ValueIteratorBase( const Value::ObjectValues::iterator &current );
879
+ #else
880
+ ValueIteratorBase( const ValueInternalArray::IteratorState &state );
881
+ ValueIteratorBase( const ValueInternalMap::IteratorState &state );
882
+ #endif
883
+
884
+ bool operator ==( const SelfType &other ) const
885
+ {
886
+ return isEqual( other );
887
+ }
888
+
889
+ bool operator !=( const SelfType &other ) const
890
+ {
891
+ return !isEqual( other );
892
+ }
893
+
894
+ difference_type operator -( const SelfType &other ) const
895
+ {
896
+ return computeDistance( other );
897
+ }
898
+
899
+ /// Return either the index or the member name of the referenced value as a Value.
900
+ Value key() const;
901
+
902
+ /// Return the index of the referenced Value. -1 if it is not an arrayValue.
903
+ UInt index() const;
904
+
905
+ /// Return the member name of the referenced Value. "" if it is not an objectValue.
906
+ const char *memberName() const;
907
+
908
+ protected:
909
+ Value &deref() const;
910
+
911
+ void increment();
912
+
913
+ void decrement();
914
+
915
+ difference_type computeDistance( const SelfType &other ) const;
916
+
917
+ bool isEqual( const SelfType &other ) const;
918
+
919
+ void copy( const SelfType &other );
920
+
921
+ private:
922
+ #ifndef JSON_VALUE_USE_INTERNAL_MAP
923
+ Value::ObjectValues::iterator current_;
924
+ // Indicates that iterator is for a null value.
925
+ bool isNull_;
926
+ #else
927
+ union
928
+ {
929
+ ValueInternalArray::IteratorState array_;
930
+ ValueInternalMap::IteratorState map_;
931
+ } iterator_;
932
+ bool isArray_;
933
+ #endif
934
+ };
935
+
936
+ /** \brief const iterator for object and array value.
937
+ *
938
+ */
939
+ class ValueConstIterator : public ValueIteratorBase
940
+ {
941
+ friend class Value;
942
+ public:
943
+ typedef unsigned int size_t;
944
+ typedef int difference_type;
945
+ typedef const Value &reference;
946
+ typedef const Value *pointer;
947
+ typedef ValueConstIterator SelfType;
948
+
949
+ ValueConstIterator();
950
+ private:
951
+ /*! \internal Use by Value to create an iterator.
952
+ */
953
+ #ifndef JSON_VALUE_USE_INTERNAL_MAP
954
+ explicit ValueConstIterator( const Value::ObjectValues::iterator &current );
955
+ #else
956
+ ValueConstIterator( const ValueInternalArray::IteratorState &state );
957
+ ValueConstIterator( const ValueInternalMap::IteratorState &state );
958
+ #endif
959
+ public:
960
+ SelfType &operator =( const ValueIteratorBase &other );
961
+
962
+ SelfType operator++( int )
963
+ {
964
+ SelfType temp( *this );
965
+ ++*this;
966
+ return temp;
967
+ }
968
+
969
+ SelfType operator--( int )
970
+ {
971
+ SelfType temp( *this );
972
+ --*this;
973
+ return temp;
974
+ }
975
+
976
+ SelfType &operator--()
977
+ {
978
+ decrement();
979
+ return *this;
980
+ }
981
+
982
+ SelfType &operator++()
983
+ {
984
+ increment();
985
+ return *this;
986
+ }
987
+
988
+ reference operator *() const
989
+ {
990
+ return deref();
991
+ }
992
+ };
993
+
994
+
995
+ /** \brief Iterator for object and array value.
996
+ */
997
+ class ValueIterator : public ValueIteratorBase
998
+ {
999
+ friend class Value;
1000
+ public:
1001
+ typedef unsigned int size_t;
1002
+ typedef int difference_type;
1003
+ typedef Value &reference;
1004
+ typedef Value *pointer;
1005
+ typedef ValueIterator SelfType;
1006
+
1007
+ ValueIterator();
1008
+ ValueIterator( const ValueConstIterator &other );
1009
+ ValueIterator( const ValueIterator &other );
1010
+ private:
1011
+ /*! \internal Use by Value to create an iterator.
1012
+ */
1013
+ #ifndef JSON_VALUE_USE_INTERNAL_MAP
1014
+ explicit ValueIterator( const Value::ObjectValues::iterator &current );
1015
+ #else
1016
+ ValueIterator( const ValueInternalArray::IteratorState &state );
1017
+ ValueIterator( const ValueInternalMap::IteratorState &state );
1018
+ #endif
1019
+ public:
1020
+
1021
+ SelfType &operator =( const SelfType &other );
1022
+
1023
+ SelfType operator++( int )
1024
+ {
1025
+ SelfType temp( *this );
1026
+ ++*this;
1027
+ return temp;
1028
+ }
1029
+
1030
+ SelfType operator--( int )
1031
+ {
1032
+ SelfType temp( *this );
1033
+ --*this;
1034
+ return temp;
1035
+ }
1036
+
1037
+ SelfType &operator--()
1038
+ {
1039
+ decrement();
1040
+ return *this;
1041
+ }
1042
+
1043
+ SelfType &operator++()
1044
+ {
1045
+ increment();
1046
+ return *this;
1047
+ }
1048
+
1049
+ reference operator *() const
1050
+ {
1051
+ return deref();
1052
+ }
1053
+ };
1054
+
1055
+
1056
+ } // namespace Json
1057
+
1058
+
1059
+ #endif // CPPTL_JSON_H_INCLUDED