/
index.html
228 lines (228 loc) · 15.6 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en-US">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=11"/>
<meta name="generator" content="Doxygen 1.9.5"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>qLibc: What's qLibc?</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript" src="navtreedata.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
<tbody>
<tr id="projectrow">
<td id="projectalign">
<div id="projectname">qLibc
</div>
</td>
</tr>
</tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.9.5 -->
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&dn=expat.txt MIT */
$(function() {
initMenu('',false,false,'search.php','Search');
});
/* @license-end */
</script>
<div id="main-nav"></div>
</div><!-- top -->
<div id="side-nav" class="ui-resizable side-nav-resizable">
<div id="nav-tree">
<div id="nav-tree-contents">
<div id="nav-sync" class="sync"></div>
</div>
</div>
<div id="splitbar" style="-moz-user-select:none;"
class="ui-resizable-handle">
</div>
</div>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&dn=expat.txt MIT */
$(document).ready(function(){initNavTree('index.html',''); initResizable(); });
/* @license-end */
</script>
<div id="doc-content">
<div><div class="header">
<div class="headertitle"><div class="title">What's qLibc? </div></div>
</div><!--header-->
<div class="contents">
<div class="textblock"><p ><a class="anchor" id="md__Users_seungyou_github_qlibc_README"></a></p>
<p >qLibc is currently one of the most functionally-complete, publicly-licensed C/C++ libraries. The goal of the qLibc project is to provide a <b>simple and powerful general purpose C/C++ library</b> that includes all kinds of containers and general library routines. It provides a ready-made set of common container APIs with a consistent API look.</p>
<h1><a class="anchor" id="autotoc_md0"></a>
qLibc Copyright</h1>
<p >qLibc is published under 2-clause BSD license known as Simplified BSD License. Please refer the LICENSE document included in the package for more details.</p>
<h1><a class="anchor" id="autotoc_md1"></a>
API Reference</h1>
<ul>
<li><a href="https://wolkykim.github.io/qlibc/doc/html/files.html">qlibc Core API Reference</a><ul>
<li>Containers for Key/Value pairs<ul>
<li>Tree Table — in binary tree(left-leaning red-black tree) data structure.</li>
<li>Hash Table — in hash-based data structure.</li>
<li>Static Hash Table — in fixed size memory(array/mmapped/shared).</li>
<li>List Table — in (doubly) linked-list data structure.</li>
</ul>
</li>
<li>Containers for Objects<ul>
<li>List — Doubly Linked List.</li>
<li>Vector — implements a growable array of elements.</li>
<li>Queue — FIFO(First In First Out) implementation.</li>
<li>Stack — LIFO(Last In First Out) implementation.</li>
</ul>
</li>
<li>General utilities.<ul>
<li>String — string trimmer, modifier, replacer, case converter, pattern detectors, ...</li>
<li>I/O — non-blocking I/O, stream reader/writer, ...</li>
<li>File — file locking, file/directory hander, path correctors, ...</li>
<li>IPC, Semaphore Shared-memory</li>
<li>En/decoders — Url en/decoder, Base64 en/decoder, Hex en/decoder, ...</li>
<li>Hashes — Murmur hases, FNV hases, MD5 hashes, ...</li>
<li>Time — time diff, time format converstion, ...</li>
</ul>
</li>
</ul>
</li>
<li><a href="https://wolkykim.github.io/qlibc/doc/html/files.html">qLibc Extension API Reference</a><ul>
<li>Apache-style Configuration File Parser.</li>
<li>INI-style Configuration File Parser.</li>
<li>HTTP client.</li>
<li>Rotating File Logger.</li>
<li>Database(MySQL) interface.</li>
<li><a href="https://en.wikipedia.org/wiki/Token_bucket">Token-Bucket</a></li>
</ul>
</li>
</ul>
<h1><a class="anchor" id="autotoc_md2"></a>
qLibc Tables at a Glance</h1>
<table class="markdownTable">
<tr class="markdownTableHead">
<th class="markdownTableHeadLeft">Characteristics </th><th class="markdownTableHeadCenter">Tree Table </th><th class="markdownTableHeadCenter">Hash Table </th><th class="markdownTableHeadCenter">Static Hash Table </th><th class="markdownTableHeadCenter">List Table </th></tr>
<tr class="markdownTableRowOdd">
<td class="markdownTableBodyLeft">Data structure </td><td class="markdownTableBodyCenter">Binary Tree </td><td class="markdownTableBodyCenter">Slot Index </td><td class="markdownTableBodyCenter">Block Array </td><td class="markdownTableBodyCenter">Linked-List </td></tr>
<tr class="markdownTableRowEven">
<td class="markdownTableBodyLeft">Search complexity </td><td class="markdownTableBodyCenter">O(log n) </td><td class="markdownTableBodyCenter">O(1) / O(n) </td><td class="markdownTableBodyCenter">O(1) / O(n) </td><td class="markdownTableBodyCenter">O(n) </td></tr>
<tr class="markdownTableRowOdd">
<td class="markdownTableBodyLeft">Insert complexity </td><td class="markdownTableBodyCenter">O(log n) </td><td class="markdownTableBodyCenter">O(1) / O(n) </td><td class="markdownTableBodyCenter">O(1) / O(n) </td><td class="markdownTableBodyCenter">O(1) </td></tr>
<tr class="markdownTableRowEven">
<td class="markdownTableBodyLeft">Delete complexity </td><td class="markdownTableBodyCenter">O(log n) </td><td class="markdownTableBodyCenter">O(1) / O(n) </td><td class="markdownTableBodyCenter">O(1) / O(n) </td><td class="markdownTableBodyCenter">O(n) </td></tr>
<tr class="markdownTableRowOdd">
<td class="markdownTableBodyLeft">Space complexity </td><td class="markdownTableBodyCenter">O(n) </td><td class="markdownTableBodyCenter">O(n) </td><td class="markdownTableBodyCenter">- </td><td class="markdownTableBodyCenter">O(n) </td></tr>
<tr class="markdownTableRowEven">
<td class="markdownTableBodyLeft">Space allocation </td><td class="markdownTableBodyCenter">Dynamic </td><td class="markdownTableBodyCenter">Dynamic </td><td class="markdownTableBodyCenter">Pre-allocation </td><td class="markdownTableBodyCenter">Dynamic </td></tr>
<tr class="markdownTableRowOdd">
<td class="markdownTableBodyLeft">Key Stored Sorted </td><td class="markdownTableBodyCenter">Yes </td><td class="markdownTableBodyCenter">No </td><td class="markdownTableBodyCenter">No </td><td class="markdownTableBodyCenter">Yes (option) </td></tr>
<tr class="markdownTableRowEven">
<td class="markdownTableBodyLeft">User comparator </td><td class="markdownTableBodyCenter">Supported </td><td class="markdownTableBodyCenter">- </td><td class="markdownTableBodyCenter">- </td><td class="markdownTableBodyCenter">Supported </td></tr>
<tr class="markdownTableRowOdd">
<td class="markdownTableBodyLeft">Duplicated keys </td><td class="markdownTableBodyCenter">No </td><td class="markdownTableBodyCenter">No </td><td class="markdownTableBodyCenter">No </td><td class="markdownTableBodyCenter">Yes (option) </td></tr>
<tr class="markdownTableRowEven">
<td class="markdownTableBodyLeft">Key stored digested </td><td class="markdownTableBodyCenter">No </td><td class="markdownTableBodyCenter">No </td><td class="markdownTableBodyCenter">Yes </td><td class="markdownTableBodyCenter">No </td></tr>
<tr class="markdownTableRowOdd">
<td class="markdownTableBodyLeft">Search Nearest Key </td><td class="markdownTableBodyCenter">Yes </td><td class="markdownTableBodyCenter">No </td><td class="markdownTableBodyCenter">No </td><td class="markdownTableBodyCenter">No </td></tr>
<tr class="markdownTableRowEven">
<td class="markdownTableBodyLeft">Iterator support </td><td class="markdownTableBodyCenter">Yes </td><td class="markdownTableBodyCenter">Yes </td><td class="markdownTableBodyCenter">Yes </td><td class="markdownTableBodyCenter">Yes </td></tr>
<tr class="markdownTableRowOdd">
<td class="markdownTableBodyLeft">Iterator visit order </td><td class="markdownTableBodyCenter">min -> max </td><td class="markdownTableBodyCenter">random </td><td class="markdownTableBodyCenter">random </td><td class="markdownTableBodyCenter">insert order </td></tr>
<tr class="markdownTableRowEven">
<td class="markdownTableBodyLeft">Thread-safe option </td><td class="markdownTableBodyCenter">Supported </td><td class="markdownTableBodyCenter">Suported </td><td class="markdownTableBodyCenter">User </td><td class="markdownTableBodyCenter">Supported </td></tr>
<tr class="markdownTableRowOdd">
<td class="markdownTableBodyLeft">Can use shared mem </td><td class="markdownTableBodyCenter">No </td><td class="markdownTableBodyCenter">No </td><td class="markdownTableBodyCenter">Yes </td><td class="markdownTableBodyCenter">No </td></tr>
</table>
<h1><a class="anchor" id="autotoc_md3"></a>
Consistent API Look</h1>
<p >All container APIs have a consistent look and feel. It basically provides a creator function which usually returns a pointer to a container structure. Also, <b>all functions related to the container can be accessed through function pointers inside of the container</b> or traditional style direct access APIs. For an example,</p>
<p >So, regardless of which container you use, you can simply put elements into a list with <code>container->put(container, ...)</code> or you can call them using direct API like qtreetbl_pub(container, ...).</p>
<p >An examples below illustrates how it looks like.</p>
<div class="fragment"><div class="line"><span class="comment">// create a hash-table.</span></div>
<div class="line">qhashtbl_t *tbl = <a class="code hl_function" href="qhashtbl_8c.html#a7a2314dcb8381b4599e8050becad2268">qhashtbl</a>(0, QHASHTBL_OPT_THREADSAFE);</div>
<div class="line"> </div>
<div class="line"><span class="comment">// add an element which key name is "score".</span></div>
<div class="line"><span class="keywordtype">int</span> x = 12345;</div>
<div class="line">tbl->put(tbl, <span class="stringliteral">"score"</span>, &x, <span class="keyword">sizeof</span>(<span class="keywordtype">int</span>));</div>
<div class="line"> </div>
<div class="line"><span class="comment">// get the value of the element.</span></div>
<div class="line"><span class="keywordtype">int</span> *px = tbl->get(tbl, <span class="stringliteral">"score"</span>);</div>
<div class="line"><span class="keywordflow">if</span>(px != NULL) {</div>
<div class="line"> printf(<span class="stringliteral">"%d\n"</span>, *px);</div>
<div class="line"> free(px);</div>
<div class="line">}</div>
<div class="line"> </div>
<div class="line"><span class="comment">// release table</span></div>
<div class="line">tbl->free(tbl);</div>
<div class="ttc" id="aqhashtbl_8c_html_a7a2314dcb8381b4599e8050becad2268"><div class="ttname"><a href="qhashtbl_8c.html#a7a2314dcb8381b4599e8050becad2268">qhashtbl</a></div><div class="ttdeci">qhashtbl_t * qhashtbl(size_t range, int options)</div><div class="ttdoc">Initialize hash table.</div><div class="ttdef"><b>Definition:</b> <a href="qhashtbl_8c_source.html#l00127">qhashtbl.c:127</a></div></div>
</div><!-- fragment --><p >Here is an identical implementation with a Linked-List-Table container. You may notice that there aren't any code changes at all, except for 1 line in the table creation. This is why qLibc encapsulates corresponding function pointers inside of the container object.</p>
<div class="fragment"><div class="line"><span class="comment">// create a linked-list-table. THE ONLY LINE YOU NEED TO CHANGE.</span></div>
<div class="line">qlisttbl_t *tbl = <a class="code hl_function" href="qlisttbl_8c.html#a0df1c9358a8712794a8a0030a1687f62">qlisttbl</a>(QLISTTBL_OPT_THREADSAFE);</div>
<div class="line"> </div>
<div class="line"><span class="comment">// add an element which key name is "score".</span></div>
<div class="line"><span class="keywordtype">int</span> x = 12345;</div>
<div class="line">tbl->put(tbl, <span class="stringliteral">"score"</span>, &x, <span class="keyword">sizeof</span>(<span class="keywordtype">int</span>));</div>
<div class="line"> </div>
<div class="line"><span class="comment">// get the value of the element.</span></div>
<div class="line"><span class="keywordtype">int</span> *px = tbl->get(tbl, <span class="stringliteral">"score"</span>);</div>
<div class="line"><span class="keywordflow">if</span>(px != NULL) {</div>
<div class="line"> printf(<span class="stringliteral">"%d\n"</span>, *px); </div>
<div class="line"> free(px);</div>
<div class="line">}</div>
<div class="line"> </div>
<div class="line"><span class="comment">// release table</span></div>
<div class="line">tbl->free(tbl);</div>
<div class="ttc" id="aqlisttbl_8c_html_a0df1c9358a8712794a8a0030a1687f62"><div class="ttname"><a href="qlisttbl_8c.html#a0df1c9358a8712794a8a0030a1687f62">qlisttbl</a></div><div class="ttdeci">qlisttbl_t * qlisttbl(int options)</div><div class="ttdoc">Create a new Q_LIST linked-list container.</div><div class="ttdef"><b>Definition:</b> <a href="qlisttbl_8c_source.html#l00150">qlisttbl.c:150</a></div></div>
</div><!-- fragment --><h1><a class="anchor" id="autotoc_md4"></a>
Looking for people to work with.</h1>
<p >We're looking for people who want to work together to develop and improve qLibc. Currently, we have high demands on following areas.</p>
<ul>
<li>Automated testing</li>
<li>Documentation.</li>
<li>New feature implementation.</li>
</ul>
<h1><a class="anchor" id="autotoc_md5"></a>
Contributors</h1>
<p >The following people have helped with suggestions, ideas, code or fixing bugs: (in alphabetical order by first name)</p>
<ul>
<li><a href="https://github.com/wolkykim">Seungyoung "Steve" Kim</a> - Project Lead</li>
<li><a href="https://github.com/alexandrelucchesi">Alexandre Lucchesi</a></li>
<li><a href="https://github.com/darkdh">Anthony Tseng</a></li>
<li><a href="https://github.com/kakwa">Carpentier Pierre-Francois</a></li>
<li>Cesar</li>
<li><a href="https://github.com/colintd">Colin</a></li>
<li><a href="https://github.com/Charles0429">Charles</a></li>
<li><a href="https://github.com/demitsuri">Dmitry Vorobiev</a></li>
<li><a href="https://github.com/ffontaine">Fabrice Fontaine</a></li>
<li>HyoSup Woo</li>
<li><a href="https://github.com/netpoetica">Keith Rosenberg</a></li>
<li>Krishna</li>
<li><a href="https://github.com/haveTryTwo">Liu Zhongchao</a></li>
<li>Luis Jimenez</li>
<li>Maik Beckmann</li>
<li>RQ</li>
<li><a href="https://github.com/kirbyfan64">Ryan Gonzalez</a></li>
<li>Umesh</li>
</ul>
<p >If we have forgotten or misspelled your name, please let us know. </p>
</div></div><!-- PageDoc -->
</div><!-- contents -->
</div><!-- doc-content -->
<!-- start footer part -->
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
<ul>
<li class="footer">Generated by <a href="https://www.doxygen.org/index.html"><img class="footer" src="doxygen.svg" width="104" height="31" alt="doxygen"/></a> 1.9.5 </li>
</ul>
</div>
</body>
</html>