-
Notifications
You must be signed in to change notification settings - Fork 0
/
blAlgorithmsLIB.hpp
195 lines (139 loc) · 5.07 KB
/
blAlgorithmsLIB.hpp
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
#ifndef BL_ALGORITHMSLIB_HPP
#define BL_ALGORITHMSLIB_HPP
//-------------------------------------------------------------------
// FILE: blAlgorithmsLIB.hpp
//
//
//
// PURPOSE: A collection of buffer parsing algorithms useful
// in extracting information from strings or generic
// data-streams / data-buffers
//
// -- All functions/algorithms are defined within
// the "blAlgorithmsLIB" namespace
//
//
//
// AUTHOR: Vincenzo Barbato
// http://www.barbatolabs.com
//
//
//
// LISENSE: MIT-LICENCE
// http://www.opensource.org/licenses/mit-license.php
//
//
//
// DEPENDENCIES: c++98
//-------------------------------------------------------------------
//-------------------------------------------------------------------
// Constants and Enums needed throughout the blAlgorithmsLIB library
#include "blEnumsAndConstants.hpp"
// Algorithms useful for dealing
// handling bytes, for example
// swapping endianess of variables
#include "blBytesManipulation.hpp"
// Generic function that simplify reading from a stream
// into a variable or a contiguous buffer and writing to
// a stream from a variable or a contiguous buffer
#include "blStreamReadWrite.hpp"
// Cyclic versions of common stl-algorithms such
// as std::copy and std::find but with a parameter
// that allows a user to specify the maximum
// number of cycles when using cyclic iterators
#include "blCyclicStlAlgorithms.hpp"
// Counting algorithms useful that count "rows" and/or
// "columns" of data in generic data streams/buffers,
// as well as finding algorithms that find the beginning
// and/or end of a specified "row" and/or "column", that
// find the beginning and/or end of the "Nth" row and
// "Mth" column and more.
#include "blCountAndFind.hpp"
// Function used to convert a sequence of characters
// into a floating point number.
// The function accepts "begin" and "end" iterators
// and allows the user to specify the decimal point
// delimiter/token
// The function also return an iterator pointing to the
// place right after the last character used to convert
// to a number
#include "blConvertToNumber.hpp"
// Functions useful in manipulating strings
#include "blStringsManipulation.hpp"
// Custom iterator useful in parsing data from csv files
// and making it addressable like a numeric matrix
#include "blCSVMatrixIterator.hpp"
// Custom iterator useful in parsing serialized data
// from generic text-data streams (for ex. files) and
// turn it into a numeric matrix
//
// NOTE: The iterator assumes that the text data is
// formatted as a single column vector so that
// it only contains one number per row, where
// each row is separated by the '\n' newline
// token
#include "blTextColumnVectorIterator.hpp"
// Another Custom iterator useful in parsing serialized
// data from generic text-data streams
//
// This iterator assumes the string is an (n x 1) column vector
// of values, representing data points, where each data point
// is a matrix of data of size (rows x cols), the string is assumed
// to be formatted as follows:
//
// Line 0 -- Serial number (a number representing a signature/type)
// Line 1 -- rows
// Line 2 -- cols
// Line 3 - Line n-1 -- The data points one matrix at a time
//
// NOTE: If the matrix is a 2d matrix then the cols = 1, for 3d matrices
// the cols > 1
//
// For example a (2xN) matrix would look like the following:
//
// 123454321 (some serial number)
// 2 (the rows in each data point)
// 1 (the columns in each data point, so this means each data point
// is a single column vector of size (2x1)
// 0,0
// 1,0
// 2,0
// 0,1
// 1,1
// 2,1
// 0,2
// 1,2
// 2,2
// 0,3
// ...
// 2,N
// End of file
#include "blTextMatrixIterator.hpp"
// A custom iterator same as the above one
// but that works with binary data instead
// of text data
// During iteration the user can specify
// how this iterator advances through the
// user supplied binary data stream
// The user can specify the iterator to
// advance in the following ways:
// - column-major format (default)
// - row-major format
// - column-page-major format
// - row-page-major format
#include "blBinaryMatrixIterator.hpp"
// Functions that calculate the page number of a string
// and the corresponding string from a given page number
//
// -- The page number would correspond to the string's
// position in a theoretical library big enough to hold
// all the knowledge that could ever be expressed
// using the number of characters in the string
//
// -- This is like an example of a "Library of Babel"
// -- Each string has a unique page number
// -- The functions are NOT case sensitive
#include "blLibraryOfBabel.hpp"
//-------------------------------------------------------------------
#endif // BL_ALGORITHMSLIB_HPP