17 #include "../../include/ecl/containers/array.hpp" 18 #include "../../include/ecl/containers/push_and_pop.hpp" 19 #include "../../include/ecl/containers/stencil.hpp" 35 int main(
int argc,
char **argv) {
37 std::cout << std::endl;
38 std::cout <<
"***********************************************************" << std::endl;
39 std::cout <<
" Arrays" << std::endl;
40 std::cout <<
"***********************************************************" << std::endl;
41 std::cout << std::endl;
46 float_array << 1,2,3.32235,-324;
50 format_array_float.precision(3);
51 std::cout << format_array(int_array) << std::endl;
52 std::cout << format_array_float(float_array) << std::endl;
54 std::cout << std::endl;
55 std::cout <<
"***********************************************************" << std::endl;
56 std::cout <<
" Dynamic Arrays" << std::endl;
57 std::cout <<
"***********************************************************" << std::endl;
58 std::cout << std::endl;
62 format_array_dynamic_float.precision(3);
63 float_array_dynamic << 1,2,3.32235,-324;
64 std::cout << format_array_dynamic_float(float_array_dynamic) << std::endl;
66 std::cout << std::endl;
67 std::cout <<
"***********************************************************" << std::endl;
68 std::cout <<
" Float Stencils" << std::endl;
69 std::cout <<
"***********************************************************" << std::endl;
70 std::cout << std::endl;
73 float_array_under << 1,2,3.32235,-324;
75 format_stencil.precision(3);
76 std::cout << format_stencil(float_array_under.
stencil(1,2)) << std::endl;
78 double_array_under << 1,2,3.32235,-324;
80 format_double_stencil.precision(3);
81 std::cout << format_double_stencil(double_array_under.stencil(1,2)) << std::endl;
83 std::cout << std::endl;
84 std::cout <<
"***********************************************************" << std::endl;
85 std::cout <<
" Byte Arrays" << std::endl;
86 std::cout <<
"***********************************************************" << std::endl;
87 std::cout << std::endl;
90 schar_array <<
'a',
'b',
'c',
'd';
92 std::cout << schar_array << std::endl;
93 std::cout << format_sbytes(schar_array) << std::endl;
94 std::cout << format_sbytes(schar_array.
stencil(0,2)) << std::endl;
96 char_array <<
'a',
'b',
'c',
'd';
99 std::cout << char_array << std::endl;
100 std::cout << format_bytes(char_array) << std::endl;
101 std::cout << format_bytes(char_array.stencil(0,2)) << std::endl;
103 uchar_array << 0x01, 0x02, 0x03, 0x04;
107 for (
unsigned int i = 0; i < uchar_array.size(); ++i ) {
108 std::cout << format_uchar(uchar_array[i]) <<
" ";
110 std::cout <<
"]" << std::endl;
111 std::cout << format_ubytes(uchar_array) << std::endl;
112 std::cout << format_ubytes(uchar_array.stencil(0,2)) << std::endl;
114 std::cout << std::endl;
115 std::cout <<
"***********************************************************" << std::endl;
116 std::cout <<
" Push and Pop Byte Arrays" << std::endl;
117 std::cout <<
"***********************************************************" << std::endl;
118 std::cout << std::endl;
120 std::cout <<
"Dynamic" << std::endl;
121 std::cout << std::endl;
127 std::cout <<
"Push 0x01: " << format_push_pop(push_and_pop) << std::endl;
129 std::cout <<
"Push 0x02: " << format_push_pop(push_and_pop) << std::endl;
131 std::cout <<
"Push 0x03: " << format_push_pop(push_and_pop) << std::endl;
133 std::cout <<
"Push 0x04: " << format_push_pop(push_and_pop) << std::endl;
135 std::cout <<
"Pop front: " << format_push_pop(push_and_pop) << std::endl;
137 std::cout <<
"Pop front: " << format_push_pop(push_and_pop) << std::endl;
139 std::cout <<
"Push 0x05: " << format_push_pop(push_and_pop) << std::endl;
141 std::cout <<
"Push 0x06: " << format_push_pop(push_and_pop) << std::endl;
143 std::cout <<
"Push 0x07: " << format_push_pop(push_and_pop) << std::endl;
145 std::cout <<
"Push 0x08: " << format_push_pop(push_and_pop) << std::endl;
147 std::cout <<
"Size: " << push_and_pop.
size() << std::endl;
149 for (
unsigned int i = 0; i < push_and_pop.
size(); ++i) {
150 std::cout << static_cast<int>(push_and_pop[i]) <<
" ";
152 std::cout <<
"]" << std::endl;
154 std::cout << std::endl;
155 std::cout <<
"Fixed" << std::endl;
156 std::cout << std::endl;
161 std::cout <<
"Push 0x01: " << format_push_pop_fixed(push_and_pop_fixed) << std::endl;
163 std::cout <<
"Push 0x02: " << format_push_pop_fixed(push_and_pop_fixed) << std::endl;
165 std::cout <<
"Push 0x03: " << format_push_pop_fixed(push_and_pop_fixed) << std::endl;
167 std::cout <<
"Push 0x04: " << format_push_pop_fixed(push_and_pop_fixed) << std::endl;
169 std::cout <<
"Pop front: " << format_push_pop_fixed(push_and_pop_fixed) << std::endl;
171 std::cout <<
"Pop front: " << format_push_pop_fixed(push_and_pop_fixed) << std::endl;
173 std::cout <<
"Push 0x05: " << format_push_pop_fixed(push_and_pop_fixed) << std::endl;
175 std::cout <<
"Push 0x06: " << format_push_pop_fixed(push_and_pop_fixed) << std::endl;
177 std::cout <<
"Push 0x07: " << format_push_pop_fixed(push_and_pop_fixed) << std::endl;
179 std::cout <<
"Push 0x08: " << format_push_pop_fixed(push_and_pop_fixed) << std::endl;
181 std::cout << std::endl;
182 std::cout <<
"***********************************************************" << std::endl;
183 std::cout <<
" Passed" << std::endl;
184 std::cout <<
"***********************************************************" << std::endl;
185 std::cout << std::endl;
Fixed size container with a few bells and whistles.
Surpport push and pack operation.
void push_back(const Type &datum)
Pushes an element onto the back of the container.
Stencil< Array< Type, Size > > stencil(const unsigned int &start_index, const unsigned int &n)
Open a window (stencil) onto the array.
A safe windowing class that opens onto array-like containers.
unsigned int size() const