Orbiter 2022
Combinatorial Objects
vector_builder_description.cpp
Go to the documentation of this file.
1/*
2 * vector_builder_description.cpp
3 *
4 * Created on: Nov 1, 2021
5 * Author: betten
6 */
7
8
9
10#include "foundations.h"
11
12using namespace std;
13
14
15
16namespace orbiter {
17namespace layer1_foundations {
18namespace data_structures {
19
20
22{
23 f_field = FALSE;
24 //std::string field_label;
25
26 f_dense = FALSE;
27 //std::string dense_text;
28
30 //std::string compact_text;
31
33 //std::string repeat_text;
34 repeat_length = 0;
35
37 format_k = 0;
38
39 f_file = FALSE;
40 //std::string file_name;
41
43 sparse_len = 0;
44 //std::string sparse_pairs;
45
47 //std::vector<std::string> concatenate_list;
48
49 f_loop = FALSE;
50 loop_start = 0;
53}
54
56{
57}
58
59
61 int argc, std::string *argv,
62 int verbose_level)
63{
64 int f_v = (verbose_level >= 1);
65 int i = 0;
66 string_tools ST;
67
68 if (f_v) {
69 cout << "vector_builder_description::read_arguments" << endl;
70 cout << "vector_builder_description::read_arguments i = " << i << endl;
71 cout << "vector_builder_description::read_arguments argc = " << argc << endl;
72 }
73 for (i = 0; i < argc; i++) {
74 if (ST.stringcmp(argv[i], "-field") == 0) {
75 f_field = TRUE;
76 field_label.assign(argv[++i]);
77 if (f_v) {
78 cout << "-field " << field_label << endl;
79 }
80 }
81 else if (ST.stringcmp(argv[i], "-dense") == 0) {
82 f_dense = TRUE;
83 dense_text.assign(argv[++i]);
84 if (f_v) {
85 cout << "-dense " << dense_text << endl;
86 }
87 }
88 else if (ST.stringcmp(argv[i], "-compact") == 0) {
90 compact_text.assign(argv[++i]);
91 if (f_v) {
92 cout << "-compact " << compact_text << endl;
93 }
94 }
95 else if (ST.stringcmp(argv[i], "-repeat") == 0) {
96 f_repeat = TRUE;
97 repeat_text.assign(argv[++i]);
98 repeat_length = ST.strtoi(argv[++i]);
99 if (f_v) {
100 cout << "-repeat " << repeat_text << " " << repeat_length << endl;
101 }
102 }
103 else if (ST.stringcmp(argv[i], "-format") == 0) {
104 f_format = TRUE;
105 format_k = ST.strtoi(argv[++i]);
106 if (f_v) {
107 cout << "-format " << format_k << endl;
108 }
109 }
110 else if (ST.stringcmp(argv[i], "-file") == 0) {
111 f_file = TRUE;
112 file_name.assign(argv[++i]);
113 if (f_v) {
114 cout << "-file " << file_name << endl;
115 }
116 }
117 else if (ST.stringcmp(argv[i], "-sparse") == 0) {
118 f_sparse = TRUE;
119 sparse_len = ST.strtoi(argv[++i]);
120 sparse_pairs.assign(argv[++i]);
121 if (f_v) {
122 cout << "-sparse " << sparse_len << " " << sparse_pairs << endl;
123 }
124 }
125 else if (ST.stringcmp(argv[i], "-concatenate") == 0) {
126 string label;
127
128 label.assign(argv[++i]);
129 concatenate_list.push_back(label);
130 if (f_v) {
131 cout << "-concatenate " << label << endl;
132 }
133 }
134 else if (ST.stringcmp(argv[i], "-loop") == 0) {
135 f_loop = TRUE;
136 loop_start = ST.strtoi(argv[++i]);
137 loop_upper_bound = ST.strtoi(argv[++i]);
138 loop_increment = ST.strtoi(argv[++i]);
139 cout << "-loop "
140 << loop_start << " "
141 << loop_upper_bound << " "
142 << loop_increment << endl;
143 }
144
145 else if (ST.stringcmp(argv[i], "-end") == 0) {
146 if (f_v) {
147 cout << "-end" << endl;
148 }
149 break;
150 }
151 else {
152 cout << "vector_builder_description::read_arguments "
153 "unrecognized option " << argv[i] << endl;
154 exit(1);
155 }
156 } // next i
157 if (f_v) {
158 cout << "vector_builder_description::read_arguments done" << endl;
159 }
160 return i + 1;
161}
162
164{
165 cout << "vector_builder_description:" << endl;
166 if (f_field) {
167 cout << "-field " << field_label << endl;
168 }
169 if (f_dense) {
170 cout << "-dense " << dense_text << endl;
171 }
172 if (f_compact) {
173 cout << "-compact " << compact_text << endl;
174 }
175 if (f_repeat) {
176 cout << "-repeat " << repeat_text << " " << repeat_length << endl;
177 }
178 if (f_format) {
179 cout << "-format " << format_k << endl;
180 }
181 if (f_file) {
182 cout << "-file " << file_name << endl;
183 }
184 if (f_sparse) {
185 cout << "-file " << sparse_len << " " << sparse_pairs << endl;
186 }
187 if (concatenate_list.size()) {
188 int i;
189 for (i = 0; i < concatenate_list.size(); i++) {
190 cout << "-concatenate " << concatenate_list[i] << endl;
191 }
192 }
193 if (f_loop) {
194 cout << "-loop "
195 << loop_start << " "
196 << loop_upper_bound << " "
197 << loop_increment << endl;
198 }
199
200}
201
202
203}}}
204
205
functions related to strings and character arrays
#define TRUE
Definition: foundations.h:231
#define FALSE
Definition: foundations.h:234
the orbiter library for the classification of combinatorial objects