1/*
2 Qalculate
3
4 Copyright (C) 2003-2007 Niklas Knutsson (nq@altern.org)
5
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2 of the License, or
9 (at your option) any later version.
10*/
11
12#ifndef CALCULATOR_H
13#define CALCULATOR_H
14
15#include <libqalculate/includes.h>
16#include <libqalculate/util.h>
17#include <pthread.h>
18
19/** @file */
20
21/** \mainpage Index
22*
23* \section intro_sec Introduction
24*
25* libqalculate is math libary for expression evaluation with units, variables and functions support and CAS functionality.
26*
27* The main parts of the library is the almighty Calculator class, the MathStructure class for mathematical expressions and classes for objects in an epxression,
28* mostly of the class Numbers and sub classes of ExpressionItem.
29*
30* A simple application using libqalculate need only create a calculator object, perhaps load definitions (functions, variables, units, etc.) and use the calculate function as follows:
31* \code new Calculator();
32* CALCULATOR->loadGlobalDefinitions();
33* CALCULATOR->loadLocalDefinitions();
34* EvaluationOptions eo;
35* MathStructure result = CALCULATOR->calculate("1 + 1", eo);\endcode
36*
37* More complex usage mainly involves manipulating objects of the MathStructure class directly.
38*
39* To display the resulting expression you will normally use MathStructure::format() followed by MathStructure::print() as follows:
40* \code PrintOptions po;
41* result.format(po);
42* string result_str = result.print(po); \endcode
43*
44* Central to the flexiblity of libqalculate is the many options passed to evaluating and display functions with EvaluationOptions and PrintOptions.
45*
46* \section usage_sec Using the library
47*
48* libqalculate uses pkg-config.
49*
50* For a simple program use pkg-config on the command line:
51* \code c++ `pkg-config --cflags --libs libqalculate` hello.c -o hello \endcode
52*
53* If the program uses autoconf, put the following in configure.in:
54* \code PKG_CHECK_MODULES(QALCULATE, [
55* libqalculate >= 0.9.7
56* ])
57* AC_SUBST(QALCULATE_CFLAGS)
58* AC_SUBST(QALCULATE_LIBS) \endcode
59*/
60
61typedef vector<Prefix*> p_type;
62
63/// Parameters passed to plotting functions.
64struct PlotParameters {
65 /// Title label.
66 string title;
67 /// Y-axis label.
68 string y_label;
69 /// X-axis label.
70 string x_label;
71 /// Image to save plot to. If empty shows plot in a window on the screen.
72 string filename;
73 /// The image type to save as. Set to PLOT_FILETYPE_AUTO to guess from file extension.
74 PlotFileType filetype;
75 /// Font used for text
76 string font;
77 /// Set to true for colored plot, false for monochrome. Default: true
78 bool color;
79 /// If the minimum y-axis value shall be set automatically (otherwise uses y_min). Default: true
80 bool auto_y_min;
81 /// If the minimum x-axis value shall be set automatically (otherwise uses x_min). Default: true
82 bool auto_x_min;
83 /// If the maximum y-axis value shall be set automatically (otherwise uses y_max). Default: true
84 bool auto_y_max;
85 /// If the maximum x-axis value shall be set automatically (otherwise uses x_max). Default: true
86 bool auto_x_max;
87 /// Minimum y-axis value.
88 float y_min;
89 /// Minimum x-axis value.
90 float x_min;
91 /// Maximum y-axis value.
92 float y_max;
93 /// Maximum x-axis value.
94 float x_max;
95 /// If a logarithimic scale shall be used for the y-axis. Default: false
96 bool y_log;
97 /// If a logarithimic scale shall be used for the x-axis. Default: false
98 bool x_log;
99 /// Logarithimic base for the y-axis. Default: 10
100 int y_log_base;
101 /// Logarithimic base for the x-axis. Default: 10
102 int x_log_base;
103 /// If a grid shall be shown in the plot. Default: false
104 bool grid;
105 /// Width of lines. Default: 2
106 int linewidth;
107 /// If the plot shall be surrounded by borders on all sides (not just axis). Default: false
108 bool show_all_borders;
109 /// Where the plot legend shall be placed. Default: PLOT_LEGEND_TOP_RIGHT
110 PlotLegendPlacement legend_placement;
111 PlotParameters();
112};
113
114/// Parameters for plot data series.
115struct PlotDataParameters {
116 /// Title label.
117 string title;
118 /// Plot smoothing.
119 PlotSmoothing smoothing;
120 /// Plot style
121 PlotStyle style;
122 /// Use scale on second y-axis
123 bool yaxis2;
124 /// Use scale on second x-axis
125 bool xaxis2;
126 PlotDataParameters();
127};
128
129///Message types
130typedef enum {
131 MESSAGE_INFORMATION,
132 MESSAGE_WARNING,
133 MESSAGE_ERROR
134} MessageType;
135
136/// A message with information to the user. Primarily used for errors and warnings.
137class CalculatorMessage {
138 protected:
139 string smessage;
140 MessageType mtype;
141 public:
142 CalculatorMessage(string message_, MessageType type_ = MESSAGE_WARNING);
143 CalculatorMessage(const CalculatorMessage &e);
144 string message() const;
145 const char* c_message() const;
146 MessageType type() const;
147};
148
149#include <libqalculate/MathStructure.h>
150
151enum {
152 ELEMENT_CLASS_NOT_DEFINED,
153 ALKALI_METALS,
154 ALKALI_EARTH_METALS,
155 LANTHANIDES,
156 ACTINIDES,
157 TRANSITION_METALS,
158 METALS,
159 METALLOIDS,
160 NONMETALS,
161 HALOGENS,
162 NOBLE_GASES,
163 TRANSACTINIDES
164};
165
166struct Element {
167 string symbol, name;
168 int number, group;
169 string weight;
170 int x_pos, y_pos;
171};
172
173#define UFV_LENGTHS 20
174
175/// The almighty calculator class.
176/** The calculator class is responsible for loading functions, variables and units, and keeping track of them, as well as parsing expressions and much more. A calculator object must be created before any other Qalculate! class is used. There should never be more than one calculator object, accessed with CALCULATOR.
177*
178* A simple application using libqalculate need only create a calculator object, perhaps load definitions (functions, variables, units, etc.) and use the calculate function as follows:
179* \code new Calculator();
180* CALCULATOR->loadGlobalDefinitions();
181* CALCULATOR->loadLocalDefinitions();
182* MathStructure result = CALCULATOR->calculate("1 + 1");\endcode
183*/
184class Calculator {
185
186 protected:
187
188 vector<CalculatorMessage> messages;
189
190 int ianglemode;
191 int i_precision;
192 char vbuffer[200];
193 vector<void*> ufvl;
194 vector<char> ufvl_t;
195 vector<size_t> ufvl_i;
196 vector<void*> ufv[4][UFV_LENGTHS];
197 vector<size_t> ufv_i[4][UFV_LENGTHS];
198
199 vector<DataSet*> data_sets;
200
201 Sgi::hash_map<size_t, MathStructure*> id_structs;
202 Sgi::hash_map<size_t, bool> ids_p;
203 vector<size_t> freed_ids;
204 size_t ids_i;
205
206 vector<string> signs;
207 vector<string> real_signs;
208 vector<string> default_signs;
209 vector<string> default_real_signs;
210 char *saved_locale;
211 int disable_errors_ref;
212 vector<int> stopped_errors_count;
213 vector<int> stopped_warnings_count;
214 vector<int> stopped_messages_count;
215 pthread_t calculate_thread;
216 pthread_attr_t calculate_thread_attr;
217 pthread_t print_thread;
218 pthread_attr_t print_thread_attr;
219 bool b_functions_was, b_variables_was, b_units_was, b_unknown_was, b_calcvars_was, b_rpn_was;
220 string NAME_NUMBER_PRE_S, NAME_NUMBER_PRE_STR, DOT_STR, DOT_S, COMMA_S, COMMA_STR, ILLEGAL_IN_NAMES, ILLEGAL_IN_UNITNAMES, ILLEGAL_IN_NAMES_MINUS_SPACE_STR;
221
222 bool b_argument_errors;
223 bool exchange_rates_warning_issued;
224
225 int has_gnomevfs;
226
227 bool b_gnuplot_open;
228 string gnuplot_cmdline;
229 FILE *gnuplot_pipe, *calculate_pipe_r, *calculate_pipe_w, *print_pipe_r, *print_pipe_w;
230
231 bool local_to;
232
233 Assumptions *default_assumptions;
234
235 vector<Variable*> deleted_variables;
236 vector<MathFunction*> deleted_functions;
237 vector<Unit*> deleted_units;
238
239 bool b_save_called;
240
241 string per_str, times_str, plus_str, minus_str, and_str, AND_str, or_str, OR_str, XOR_str;
242 size_t per_str_len, times_str_len, plus_str_len, minus_str_len, and_str_len, AND_str_len, or_str_len, OR_str_len, XOR_str_len;
243
244 vector<MathStructure*> rpn_stack;
245
246 bool calculateRPN(MathStructure *mstruct, int command, size_t index, int msecs, const EvaluationOptions &eo);
247 bool calculateRPN(string str, int command, size_t index, int msecs, const EvaluationOptions &eo, MathStructure *parsed_struct, MathStructure *to_struct, bool make_to_division);
248
249 public:
250
251 KnownVariable *v_pi, *v_e, *v_i, *v_inf, *v_pinf, *v_minf, *v_undef;
252 UnknownVariable *v_x, *v_y, *v_z;
253 MathFunction *f_vector, *f_sort, *f_rank, *f_limits, *f_component, *f_dimension, *f_merge_vectors;
254 MathFunction *f_matrix, *f_matrix_to_vector, *f_area, *f_rows, *f_columns, *f_row, *f_column, *f_elements, *f_element, *f_transpose, *f_identity, *f_determinant, *f_permanent, *f_adjoint, *f_cofactor, *f_inverse;
255 MathFunction *f_factorial, *f_factorial2, *f_multifactorial, *f_binomial;
256 MathFunction *f_xor, *f_bitxor, *f_even, *f_odd, *f_shift;
257 MathFunction *f_abs, *f_gcd, *f_lcm, *f_signum, *f_round, *f_floor, *f_ceil, *f_trunc, *f_int, *f_frac, *f_rem, *f_mod;
258 MathFunction *f_polynomial_unit, *f_polynomial_primpart, *f_polynomial_content, *f_coeff, *f_lcoeff, *f_tcoeff, *f_degree, *f_ldegree;
259 MathFunction *f_re, *f_im, *f_arg, *f_numerator, *f_denominator;
260 MathFunction *f_sqrt, *f_sq;
261 MathFunction *f_exp;
262 MathFunction *f_ln, *f_logn;
263 MathFunction *f_lambert_w;
264 MathFunction *f_sin, *f_cos, *f_tan, *f_asin, *f_acos, *f_atan, *f_sinh, *f_cosh, *f_tanh, *f_asinh, *f_acosh, *f_atanh, *f_radians_to_default_angle_unit;
265 MathFunction *f_zeta, *f_gamma, *f_beta;
266 MathFunction *f_total, *f_percentile, *f_min, *f_max, *f_mode, *f_rand;
267 MathFunction *f_isodate, *f_localdate, *f_timestamp, *f_stamptodate, *f_days, *f_yearfrac, *f_week, *f_weekday, *f_month, *f_day, *f_year, *f_yearday, *f_time, *f_add_days, *f_add_months, *f_add_years;
268 MathFunction *f_bin, *f_oct, *f_hex, *f_base, *f_roman;
269 MathFunction *f_ascii, *f_char;
270 MathFunction *f_length, *f_concatenate;
271 MathFunction *f_replace, *f_stripunits;
272 MathFunction *f_genvector, *f_for, *f_sum, *f_product, *f_process, *f_process_matrix, *f_csum, *f_if, *f_is_number, *f_is_real, *f_is_rational, *f_is_integer, *f_represents_number, *f_represents_real, *f_represents_rational, *f_represents_integer, *f_function, *f_select;
273 MathFunction *f_diff, *f_integrate, *f_solve, *f_multisolve;
274 MathFunction *f_error, *f_warning, *f_message, *f_save, *f_load, *f_export, *f_title;
275 MathFunction *f_register, *f_stack;
276 MathFunction *f_uncertainty;
277
278 Unit *u_rad, *u_gra, *u_deg, *u_euro;
279 DecimalPrefix *decimal_null_prefix;
280 BinaryPrefix *binary_null_prefix;
281
282 bool place_currency_code_before, place_currency_sign_before;
283 bool place_currency_code_before_negative, place_currency_sign_before_negative;
284 bool default_dot_as_separator;
285
286 bool b_busy, calculate_thread_stopped, print_thread_stopped;
287 string expression_to_calculate, tmp_print_result;
288 PrintOptions tmp_printoptions;
289 EvaluationOptions tmp_evaluationoptions;
290 MathStructure *tmp_parsedstruct;
291 MathStructure *tmp_tostruct;
292 MathStructure *tmp_rpn_mstruct;
293 bool tmp_maketodivision;
294 int tmp_proc_command;
295 size_t tmp_rpnindex;
296
297 PrintOptions save_printoptions;
298
299 vector<Variable*> variables;
300 vector<MathFunction*> functions;
301 vector<Unit*> units;
302 vector<Prefix*> prefixes;
303 vector<DecimalPrefix*> decimal_prefixes;
304 vector<BinaryPrefix*> binary_prefixes;
305
306 /** @name Constructor */
307 //@{
308 Calculator();
309 virtual ~Calculator();
310 //@}
311
312 /** @name Functions for calculating expressions. */
313 //@{
314 /** Calculates an expression. The expression should be unlocalized first with unlocalizeExpression().
315 * This function starts the calculation in a separate thread and will return when the calculation has started unless a maximum time has been specified.
316 * The calculation can then be stopped with abort().
317 *
318 * @param[out] mstruct Math structure to fill with the result.
319 * @param str Expression.
320 * @param msecs The maximum time for the calculation in milliseconds. If msecs <= 0 the time will be unlimited.
321 * @param eo Options for the evaluation and parsing of the expression.
322 * @param[out] parsed_struct NULL or a math structure to fill with the result of the parsing of the expression.
323 * @param[out] to_struct NULL or a math structure to fill with unit expression parsed after "to".
324 * @param make_to_division If true, the expression after "to" will be interpreted as a unit epxression to convert the result to.
325 * @returns true if the calculation was successfully started (and finished if msecs > 0).
326 */
327 bool calculate(MathStructure *mstruct, string str, int msecs, const EvaluationOptions &eo = default_evaluation_options, MathStructure *parsed_struct = NULL, MathStructure *to_struct = NULL, bool make_to_division = true);
328 /** Calculates an expression. The expression should be unlocalized first with unlocalizeExpression().
329 *
330 * @param str Expression.
331 * @param eo Options for the evaluation and parsing of the expression.
332 * @param[out] parsed_struct NULL or a math structure to fill with the result of the parsing of the expression.
333 * @param[out] to_struct NULL or a math structure to fill with unit expression parsed after "to".
334 * @param make_to_division If true, the expression after "to" will be interpreted as a unit epxression to convert the result to.
335 * @returns The result of the calculation.
336 */
337 MathStructure calculate(string str, const EvaluationOptions &eo = default_evaluation_options, MathStructure *parsed_struct = NULL, MathStructure *to_struct = NULL, bool make_to_division = true);
338 string printMathStructureTimeOut(const MathStructure &mstruct, int msecs = 100000, const PrintOptions &op = default_print_options);
339 int testCondition(string expression);
340 //@}
341
342 /** @name Functions for handling of threaded calculations */
343 //@{
344 /** Aborts the current calculation. */
345 void abort();
346 /** Aborts the current calculation. Used from within the calculation thread. */
347 void abort_this();
348 /** Returns true if the calculate or print thread is busy. */
349 bool busy();
350 /** Saves the state of the calculator. Used internally to be able to restore the state after aborted calculation. */
351 void saveState();
352 /** Restores the saved state of the calculator. Used internally to restore the state after aborted calculation. */
353 void restoreState();
354 /** Clears all stored values. Used internally after aborted calculation. */
355 void clearBuffers();
356 /** Terminate calculation and print threads if started. Do not use to terminate calculation. */
357 void terminateThreads();
358 //@}
359
360 /** @name Functions for manipulation of the RPN stack. */
361 //@{
362 /** Evaluates a value on the RPN stack.
363 * This function starts the calculation in a separate thread and will return when the calculation has started unless a maximum time has been specified.
364 * The calculation can then be stopped with abort().
365 *
366 * @param index Index, starting at 1, on the RPN stack.
367 * @param msecs The maximum time for the calculation in milliseconds. If msecs <= 0 the time will be unlimited.
368 * @param eo Options for the evaluation and parsing of the expression.
369 * @returns true if the calculation was successfully started (and finished if msecs > 0).
370 */
371 bool calculateRPNRegister(size_t index, int msecs, const EvaluationOptions &eo = default_evaluation_options);
372 /** Applies a mathematical operation to the first and second value on the RPN stack. The the second value is changed with input from the first value.
373 * For example, with OPERATION_SUBTRACT the first value is subtracted from the second. The first value on the stack is removed.
374 * If not enough registers is available, then zeros are added.
375 * This function starts the calculation in a separate thread and will return when the calculation has started unless a maximum time has been specified.
376 * The calculation can then be stopped with abort().
377 *
378 * @param op Operation.
379 * @param msecs The maximum time for the calculation in milliseconds. If msecs <= 0 the time will be unlimited.
380 * @param eo Options for the evaluation and parsing of the expression.
381 * @param[out] parsed_struct NULL or a math structure to fill with the unevaluated result.
382 * @returns true if the calculation was successfully started (and finished if msecs > 0).
383 */
384 bool calculateRPN(MathOperation op, int msecs, const EvaluationOptions &eo = default_evaluation_options, MathStructure *parsed_struct = NULL);
385 /** Applies a mathematical operation to the first value on the RPN stack. The value is set as the first argument of the function.
386 * If no register is available, then zero is added.
387 * This function starts the calculation in a separate thread and will return when the calculation has started unless a maximum time has been specified.
388 * The calculation can then be stopped with abort().
389 *
390 * @param f Mathematical function.
391 * @param msecs The maximum time for the calculation in milliseconds. If msecs <= 0 the time will be unlimited.
392 * @param eo Options for the evaluation and parsing of the expression.
393 * @param[out] parsed_struct NULL or a math structure to fill with the unevaluated result.
394 * @returns true if the calculation was successfully started (and finished if msecs > 0).
395 */
396 bool calculateRPN(MathFunction *f, int msecs, const EvaluationOptions &eo = default_evaluation_options, MathStructure *parsed_struct = NULL);
397 /** Applies bitwise not to the first value on the RPN stack.
398 * If no register is available, then zero is added.
399 * This function starts the calculation in a separate thread and will return when the calculation has started unless a maximum time has been specified.
400 * The calculation can then be stopped with abort().
401 *
402 * @param msecs The maximum time for the calculation in milliseconds. If msecs <= 0 the time will be unlimited.
403 * @param eo Options for the evaluation and parsing of the expression.
404 * @param[out] parsed_struct NULL or a math structure to fill with the unevaluated result.
405 * @returns true if the calculation was successfully started (and finished if msecs > 0).
406 */
407 bool calculateRPNBitwiseNot(int msecs, const EvaluationOptions &eo = default_evaluation_options, MathStructure *parsed_struct = NULL);
408 /** Applies logical not to the first value on the RPN stack.
409 * If no register is available, then zero is added.
410 * This function starts the calculation in a separate thread and will return when the calculation has started unless a maximum time has been specified.
411 * The calculation can then be stopped with abort().
412 *
413 * @param msecs The maximum time for the calculation in milliseconds. If msecs <= 0 the time will be unlimited.
414 * @param eo Options for the evaluation and parsing of the expression.
415 * @param[out] parsed_struct NULL or a math structure to fill with the unevaluated result.
416 * @returns true if the calculation was successfully started (and finished if msecs > 0).
417 */
418 bool calculateRPNLogicalNot(int msecs, const EvaluationOptions &eo = default_evaluation_options, MathStructure *parsed_struct = NULL);
419 /** Applies a mathematical operation to the first and second value on the RPN stack. The the second value is changed with input from the first value.
420 * For example, with OPERATION_SUBTRACT the first value is subtracted from the second. The first value on the stack is removed.
421 * If not enough registers is available, then zeros are added.
422 *
423 * @param op Operation.
424 * @param eo Options for the evaluation and parsing of the expression.
425 * @param[out] parsed_struct NULL or a math structure to fill with the unevaluated result.
426 * @returns The first value on the stack.
427 */
428 MathStructure *calculateRPN(MathOperation op, const EvaluationOptions &eo = default_evaluation_options, MathStructure *parsed_struct = NULL);
429 /** Applies a mathematical operation to the first value on the RPN stack. The value is set as the first argument of the function.
430 * If no register is available, then zero is added.
431 *
432 * @param f Mathematical function.
433 * @param eo Options for the evaluation and parsing of the expression.
434 * @param[out] parsed_struct NULL or a math structure to fill with the unevaluated result.
435 * @returns The first value on the stack.
436 */
437 MathStructure *calculateRPN(MathFunction *f, const EvaluationOptions &eo = default_evaluation_options, MathStructure *parsed_struct = NULL);
438 /** Applies bitwise not to the first value on the RPN stack.
439 * If no register is available, then zero is added.
440 *
441 * @param eo Options for the evaluation and parsing of the expression.
442 * @param[out] parsed_struct NULL or a math structure to fill with the unevaluated result.
443 * @returns The first value on the stack.
444 */
445 MathStructure *calculateRPNBitwiseNot(const EvaluationOptions &eo = default_evaluation_options, MathStructure *parsed_struct = NULL);
446 /** Applies logical not to the first value on the RPN stack.
447 * If no register is available, then zero is added.
448 *
449 * @param eo Options for the evaluation and parsing of the expression.
450 * @param[out] parsed_struct NULL or a math structure to fill with the unevaluated result.
451 * @returns The first value on the stack.
452 */
453 MathStructure *calculateRPNLogicalNot(const EvaluationOptions &eo = default_evaluation_options, MathStructure *parsed_struct = NULL);
454 /** Evaluates a value and adds the result first on the RPN stack.
455 * This function starts the calculation in a separate thread and will return when the calculation has started unless a maximum time has been specified.
456 * The calculation can then be stopped with abort().
457 *
458 * @param mstruct Value.
459 * @param msecs The maximum time for the calculation in milliseconds. If msecs <= 0 the time will be unlimited.
460 * @param eo Options for the evaluation of the expression.
461 * @returns true if the calculation was successfully started (and finished if msecs > 0).
462 */
463 bool RPNStackEnter(MathStructure *mstruct, int msecs, const EvaluationOptions &eo = default_evaluation_options);
464 /** Calculates an expression and adds the result first on the RPN stack. The expression should be unlocalized first with unlocalizeExpression().
465 * This function starts the calculation in a separate thread and will return when the calculation has started unless a maximum time has been specified.
466 * The calculation can then be stopped with abort().
467 *
468 * @param str Expression.
469 * @param msecs The maximum time for the calculation in milliseconds. If msecs <= 0 the time will be unlimited.
470 * @param eo Options for the evaluation and parsing of the expression.
471 * @param[out] parsed_struct NULL or a math structure to fill with the result of the parsing of the expression.
472 * @param[out] to_struct NULL or a math structure to fill with unit expression parsed after "to".
473 * @param make_to_division If true, the expression after "to" will be interpreted as a unit epxression to convert the result to.
474 * @returns true if the calculation was successfully started (and finished if msecs > 0).
475 */
476 bool RPNStackEnter(string str, int msecs, const EvaluationOptions &eo = default_evaluation_options, MathStructure *parsed_struct = NULL, MathStructure *to_struct = NULL, bool make_to_division = true);
477 /** Adds a value first on the RPN stack.
478 *
479 * @param mstruct Value.
480 * @param eval If true, the the mathematical structure will be evaluated first.
481 */
482 void RPNStackEnter(MathStructure *mstruct, bool eval = false, const EvaluationOptions &eo = default_evaluation_options);
483 /** Calculates an expression adds the result first on the RPN stack. The expression should be unlocalized first with unlocalizeExpression().
484 *
485 * @param str Expression.
486 * @param eo Options for the evaluation and parsing of the expression.
487 * @param[out] parsed_struct NULL or a math structure to fill with the result of the parsing of the expression.
488 * @param[out] to_struct NULL or a math structure to fill with unit expression parsed after "to".
489 * @param make_to_division If true, the expression after "to" will be interpreted as a unit epxression to convert the result to.
490 */
491 void RPNStackEnter(string str, const EvaluationOptions &eo = default_evaluation_options, MathStructure *parsed_struct = NULL, MathStructure *to_struct = NULL, bool make_to_division = true);
492 bool setRPNRegister(size_t index, MathStructure *mstruct, int msecs, const EvaluationOptions &eo = default_evaluation_options);
493 bool setRPNRegister(size_t index, string str, int msecs, const EvaluationOptions &eo = default_evaluation_options, MathStructure *parsed_struct = NULL, MathStructure *to_struct = NULL, bool make_to_division = true);
494 void setRPNRegister(size_t index, MathStructure *mstruct, bool eval = false, const EvaluationOptions &eo = default_evaluation_options);
495 void setRPNRegister(size_t index, string str, const EvaluationOptions &eo = default_evaluation_options, MathStructure *parsed_struct = NULL, MathStructure *to_struct = NULL, bool make_to_division = true);
496 void deleteRPNRegister(size_t index);
497 MathStructure *getRPNRegister(size_t index = 1) const;
498 size_t RPNStackSize() const;
499 void clearRPNStack();
500 void moveRPNRegister(size_t old_index, size_t new_index);
501 void moveRPNRegisterUp(size_t index);
502 void moveRPNRegisterDown(size_t index);
503 //@}
504
505 /** @name Functions for expression parsing. */
506 //@{
507 /** Returns a localized expressions. Affects decimal signs and argument separators.
508 *
509 * @param str The expression to localize.
510 * @returns A localized expression.
511 */
512 string localizeExpression(string str) const;
513 /** Returns an unlocalized expressions. Affects decimal signs and argument separators.
514 *
515 * @param str The expression to unlocalize.
516 * @returns An unlocalized expression.
517 */
518 string unlocalizeExpression(string str, const ParseOptions &po = default_parse_options) const;
519 /** Split an expression string after and before " to ".
520 *
521 * @param[out] str The expression. Will be set to the string before " to ".
522 * @param[out] to_str Will be set to the string after " to ".
523 * @param eo Options for the evaluation and parsing of the expression (nothing will be done if units are not enabled).
524 * @returns true if " to " was found and the expression split.
525 */
526 bool separateToExpression(string &str, string &to_str, const EvaluationOptions &eo) const;
527
528 void parseSigns(string &str) const;
529 /** Parse an expression and place in a MathStructure object.
530 *
531 * @param str Expression
532 * @param po Parse options.
533 * @returns MathStructure with result of parse.
534 */
535 MathStructure parse(string str, const ParseOptions &po = default_parse_options);
536 void parse(MathStructure *mstruct, string str, const ParseOptions &po = default_parse_options);
537 bool parseNumber(MathStructure *mstruct, string str, const ParseOptions &po = default_parse_options);
538 bool parseOperators(MathStructure *mstruct, string str, const ParseOptions &po = default_parse_options);
539 bool parseAdd(string &str, MathStructure *mstruct, const ParseOptions &po, MathOperation s);
540 bool parseAdd(string &str, MathStructure *mstruct, const ParseOptions &po);
541 //@}
542
543 /** @name Functions converting epxressions between units. */
544 //@{
545 /** Converts to a unit expression.
546 * The converted value is evaluated.
547 *
548 * @param mstruct The value to convert.
549 * @param composite_ Unit expression.
550 * @param eo Evaluation options.
551 * @returns Converted value.
552 */
553 MathStructure convert(const MathStructure &mstruct, string composite_, const EvaluationOptions &eo = default_evaluation_options);
554 /** Converts to a unit.
555 * The converted value is evaluated.
556 *
557 * @param mstruct The value to convert.
558 * @param composite_ Unit to convert to.
559 * @param eo Evaluation options.
560 * @param always_convert ...
561 * @returns Converted value.
562 */
563 MathStructure convert(const MathStructure &mstruct, Unit *to_unit, const EvaluationOptions &eo = default_evaluation_options, bool always_convert = true);
564 MathStructure convert(double value, Unit *from_unit, Unit *to_unit, const EvaluationOptions &eo = default_evaluation_options);
565 MathStructure convert(string str, Unit *from_unit, Unit *to_unit, const EvaluationOptions &eo = default_evaluation_options);
566 MathStructure convertToBaseUnits(const MathStructure &mstruct, const EvaluationOptions &eo = default_evaluation_options);
567 Unit *getBestUnit(Unit *u, bool allow_only_div = false);
568 MathStructure convertToBestUnit(const MathStructure &mstruct, const EvaluationOptions &eo = default_evaluation_options);
569 MathStructure convertToCompositeUnit(const MathStructure &mstruct, CompositeUnit *cu, const EvaluationOptions &eo = default_evaluation_options, bool always_convert = true);
570 //@}
571
572 /** @name Functions for default assumptions for unknown variables and symbols */
573 //@{
574 /** Set assumptions for objects without own assumptions (unknown variables and symbols).
575 */
576 void setDefaultAssumptions(Assumptions *ass);
577 /** Returns the default assumptions for objects without own assumptions (unknown variables and symbols).
578 */
579 Assumptions *defaultAssumptions();
580 //@}
581
582 /** @name Functions for retrieval of angle units */
583 //@{
584 /** Returns the gradians unit.
585 */
586 Unit *getGraUnit();
587 /** Returns the radians unit.
588 */
589 Unit *getRadUnit();
590 /** Returns the degrees unit.
591 */
592 Unit *getDegUnit();
593 //@}
594
595 /** @name Functions for finding a suitable prefix. */
596 //@{
597 /** Returns a decimal prefix with exactly the provided value, that fulfils the condition prefix->exponent(exp) == exp10.
598 *
599 * @param exp10 Base-10 exponent of the requested prefix.
600 * @param exp The exponent of the unit.
601 * @returns A prefix or NULL if not found.
602 */
603 DecimalPrefix *getExactDecimalPrefix(int exp10, int exp = 1) const;
604 /** Returns a binary prefix with exactly the provided value, that fulfils the condition prefix->exponent(exp) == exp2.
605 *
606 * @param exp2 Base-2 exponent of the requested prefix.
607 * @param exp The exponent of the unit.
608 * @returns A prefix or NULL if not found.
609 */
610 BinaryPrefix *getExactBinaryPrefix(int exp2, int exp = 1) const;
611 /** Returns a prefix with exactly the provided value, that fulfils the condition prefix->value(exp) == o.
612 *
613 * @param o Value of the requested prefix.
614 * @param exp The exponent of the unit.
615 * @returns A prefix or NULL if not found.
616 */
617 Prefix *getExactPrefix(const Number &o, int exp = 1) const;
618 /** Returns the nearest decimal prefix for a value.
619 *
620 * @param exp10 Base-10 exponent of the value.
621 * @param exp The exponent of the unit.
622 * @returns A prefix or NULL if no decimal prefix is available.
623 */
624 DecimalPrefix *getNearestDecimalPrefix(int exp10, int exp = 1) const;
625 /** Returns the best suited decimal prefix for a value.
626 *
627 * @param exp10 Base-10 exponent of the value.
628 * @param exp The exponent of the unit.
629 * @param all_prefixes If false, prefixes which is not a multiple of thousand (centi, deci, deka, hekto) will be skipped.
630 * @returns A prefix or NULL if the unit should be left without prefix.
631 */
632 DecimalPrefix *getBestDecimalPrefix(int exp10, int exp = 1, bool all_prefixes = true) const;
633 /** Returns the best suited decimal prefix for a value.
634 *
635 * @param exp10 Base-10 exponent of the value.
636 * @param exp The exponent of the unit.
637 * @param all_prefixes If false, prefixes which is not a multiple of thousand (centi, deci, deka, hekto) will be skipped.
638 * @returns A prefix or NULL if the unit should be left without prefix.
639 */
640 DecimalPrefix *getBestDecimalPrefix(const Number &exp10, const Number &exp, bool all_prefixes = true) const;
641 /** Returns the nearest binary prefix for a value.
642 *
643 * @param exp10 Base-2 exponent of the value.
644 * @param exp The exponent of the unit.
645 * @returns A prefix or NULL if no binary prefix is available.
646 */
647 BinaryPrefix *getNearestBinaryPrefix(int exp2, int exp = 1) const;
648 /** Returns the best suited binary prefix for a value.
649 *
650 * @param exp10 Base-2 exponent of the value.
651 * @param exp The exponent of the unit.
652 * @returns A prefix or NULL if the unit should be left without prefix.
653 */
654 BinaryPrefix *getBestBinaryPrefix(int exp2, int exp = 1) const;
655 /** Returns the best suited binary prefix for a value.
656 *
657 * @param exp10 Base-2 exponent of the value.
658 * @param exp The exponent of the unit.
659 * @returns A prefix or NULL if the unit should be left without prefix.
660 */
661 BinaryPrefix *getBestBinaryPrefix(const Number &exp2, const Number &exp) const;
662 /** Add a new prefix to the calculator. */
663 Prefix *addPrefix(Prefix *p);
664 /** Used internally. */
665 void prefixNameChanged(Prefix *p, bool new_item = false);
666 //@}
667
668 /** @name Functions for managing functions, variables, units, prefixes and data sets. */
669 //@{
670 void expressionItemActivated(ExpressionItem *item);
671 void expressionItemDeactivated(ExpressionItem *item);
672 void expressionItemDeleted(ExpressionItem *item);
673 void nameChanged(ExpressionItem *item, bool new_item = false);
674 void deleteName(string name_, ExpressionItem *object = NULL);
675 void deleteUnitName(string name_, Unit *object = NULL);
676 Unit* addUnit(Unit *u, bool force = true, bool check_names = true);
677 void delPrefixUFV(Prefix *object);
678 void delUFV(ExpressionItem *object);
679 /** Checks if a variable exists/is registered in the calculator. */
680 bool hasVariable(Variable *v);
681 /** Checks if a unit exists/is registered in the calculator. */
682 bool hasUnit(Unit *u);
683 /** Checks if a function exists/is registered in the calculator. */
684 bool hasFunction(MathFunction *f);
685 /** Checks if a pointer points to a variable that still exists in the calculator.
686 * As opposed to hasFunction(), this function only checks if the mathematical function has been deleted.
687 */
688 bool stillHasVariable(Variable *v);
689 /** Checks if a pointer points to a unit that still exists in the calculator.
690 * As opposed to hasUnit(), this function only checks if the unit has been deleted.
691 */
692 bool stillHasUnit(Unit *u);
693 /** Checks if a pointer points to a mathematical function that still exists in the calculator.
694 * As opposed to hasFunction(), this function only checks if the mathematical function has been deleted.
695 */
696 bool stillHasFunction(MathFunction *f);
697 void saveFunctionCalled();
698 bool checkSaveFunctionCalled();
699 ExpressionItem *getActiveExpressionItem(string name, ExpressionItem *item = NULL);
700 ExpressionItem *getInactiveExpressionItem(string name, ExpressionItem *item = NULL);
701 ExpressionItem *getActiveExpressionItem(ExpressionItem *item);
702 ExpressionItem *getExpressionItem(string name, ExpressionItem *item = NULL);
703 Unit* getUnit(string name_);
704 Unit* getActiveUnit(string name_);
705 Unit* getCompositeUnit(string internal_name_);
706 /** Returns prefix for an index (starting at zero). All prefixes can be traversed by starting at index zero and increasing the index until NULL is returned.
707 *
708 * @param index Index of prefix.
709 * @returns Prefix for index or NULL if not found.
710 */
711 Prefix *getPrefix(size_t index) const;
712 /** Returns prefix with provided name.
713 *
714 * @param name_ Name of prefix to retrieve.
715 * @returns Prefix with provided name or NULL if not found.
716 */
717 Prefix *getPrefix(string name_) const;
718 Variable* addVariable(Variable *v, bool force = true, bool check_names = true);
719 void variableNameChanged(Variable *v, bool new_item = false);
720 void functionNameChanged(MathFunction *f, bool new_item = false);
721 void unitNameChanged(Unit *u, bool new_item = false);
722 Variable* getVariable(string name_);
723 Variable* getActiveVariable(string name_);
724 ExpressionItem *addExpressionItem(ExpressionItem *item, bool force = true);
725 MathFunction* addFunction(MathFunction *f, bool force = true, bool check_names = true);
726 DataSet* addDataSet(DataSet *dc, bool force = true, bool check_names = true);
727 DataSet* getDataSet(size_t index);
728 DataSet* getDataSet(string name);
729 MathFunction* getFunction(string name_);
730 MathFunction* getActiveFunction(string name_);
731 /** Returns variable for an index (starting at zero). All variables can be traversed by starting at index zero and increasing the index until NULL is returned.
732 *
733 * @param index Index of variable.
734 * @returns Variable for index or NULL if not found.
735 */
736 Variable *getVariable(size_t index) const;
737 /** Returns unit for an index (starting at zero). All units can be traversed by starting at index zero and increasing the index until NULL is returned.
738 *
739 * @param index Index of unit.
740 * @returns Unit for index or NULL if not found.
741 */
742 Unit *getUnit(size_t index) const;
743 /** Returns function for an index (starting at zero). All functions can be traversed by starting at index zero and increasing the index until NULL is returned.
744 *
745 * @param index Index of function.
746 * @returns Function for index or NULL if not found.
747 */
748 MathFunction *getFunction(size_t index) const;
749 bool unitIsUsedByOtherUnits(const Unit *u) const;
750 //@}
751
752 /** @name Functions for handling of builtin expression items */
753 //@{
754 /** Unloads all non-builtin variables. */
755 void resetVariables();
756 /** Unloads all non-builtin functions. */
757 void resetFunctions();
758 /** Unloads all non-builtin units. */
759 void resetUnits();
760 /** Unloads all non-builtin variables, functions and units. */
761 void reset();
762 /** Adds builtin variables. Called automatically when the calculator is created. */
763 void addBuiltinVariables();
764 /** Adds builtin functions. Called automatically when the calculator is created. */
765 void addBuiltinFunctions();
766 /** Adds builtin units. Called automatically when the calculator is created. */
767 void addBuiltinUnits();
768 //@}
769
770 /** @name Functions for testing validity of functions, variable and unit names. */
771 //@{
772 /** Tests if a name is valid for a variable.
773 *
774 * @param name_ Variable name.
775 * @returns true if the name is valid for a variable.
776 */
777 bool variableNameIsValid(const string &name_);
778 /** Tests if a name is valid for a variable.
779 *
780 * @param name_ Variable name.
781 * @returns true if the name is valid for a variable.
782 */
783 bool variableNameIsValid(const char *name_);
784 bool variableNameIsValid(const char *name_, int version_numbers[3], bool is_user_defs);
785 bool variableNameIsValid(const string &name_, int version_numbers[3], bool is_user_defs);
786 string convertToValidVariableName(string name_);
787 bool functionNameIsValid(const string &name_);
788 bool functionNameIsValid(const char *name_);
789 bool functionNameIsValid(const char *name_, int version_numbers[3], bool is_user_defs);
790 bool functionNameIsValid(const string &name_, int version_numbers[3], bool is_user_defs);
791 string convertToValidFunctionName(string name_);
792 bool unitNameIsValid(const string &name_);
793 bool unitNameIsValid(const char *name_);
794 bool unitNameIsValid(const char *name_, int version_numbers[3], bool is_user_defs);
795 bool unitNameIsValid(const string &name_, int version_numbers[3], bool is_user_defs);
796 bool utf8_pos_is_valid_in_name(char *pos);
797 string convertToValidUnitName(string name_);
798 /** Checks if a name is used by another object which is not allowed to have the same name.
799 *
800 * @param name Name.
801 * @param object Object to exclude from check.
802 * @returns true if the name is used.
803 */
804 bool nameTaken(string name, ExpressionItem *object = NULL);
805 bool variableNameTaken(string name, Variable *object = NULL);
806 bool unitNameTaken(string name, Unit *object = NULL);
807 bool functionNameTaken(string name, MathFunction *object = NULL);
808 string getName(string name = "", ExpressionItem *object = NULL, bool force = false, bool always_append = false);
809 //@}
810
811 /** @name Functions for message handling. */
812 //@{
813 void error(bool critical, const char *TEMPLATE,...);
814 /** Put a message in the message queue.
815 */
816 void message(MessageType mtype, const char *TEMPLATE,...);
817 /** Returns the first message in queue.
818 */
819 CalculatorMessage *message();
820 /** Removes the first message in queue and returns the next.
821 */
822 CalculatorMessage *nextMessage();
823 bool showArgumentErrors() const;
824 void beginTemporaryStopMessages();
825 int endTemporaryStopMessages(int *message_count = NULL, int *warning_count = NULL);
826 //@}
827
828 /** @name Functions for loading and saving definitions (variables, functions, units, etc.). */
829 //@{
830 /** Load all standard global (system wide) definitions from the global data directory ($PREFIX/share/qalculate).
831 *
832 * @returns true if the definitions were successfully loaded.
833 */
834 bool loadGlobalDefinitions();
835 /** Load global (system wide) definitions from a file in the global data directory ($PREFIX/share/qalculate).
836 *
837 * @param filename Name of the file in the global data directory.
838 * @returns true if the definitions were successfully loaded.
839 */
840 bool loadGlobalDefinitions(string filename);
841 /** Load prefixes.
842 *
843 * @returns true if the definitions were successfully loaded.
844 */
845 bool loadGlobalPrefixes();
846 /** Load currencies.
847 *
848 * @returns true if the definitions were successfully loaded.
849 */
850 bool loadGlobalCurrencies();
851 /** Load units.
852 *
853 * @returns true if the definitions were successfully loaded.
854 */
855 bool loadGlobalUnits();
856 /** Load variables.
857 *
858 * @returns true if the definitions were successfully loaded.
859 */
860 bool loadGlobalVariables();
861 /** Load functions.
862 *
863 * @returns true if the definitions were successfully loaded.
864 */
865 bool loadGlobalFunctions();
866 /** Load data sets.
867 *
868 * @returns true if the definitions were successfully loaded.
869 */
870 bool loadGlobalDataSets();
871 /** Load local, user specific, definitions from the local definitions directory (~/.qalculate/definitions).
872 * All files in the directory and in the datasets subdirectory are loaded.
873 *
874 * @returns true if the definitions were successfully loaded.
875 */
876 bool loadLocalDefinitions();
877 /** Load definitions from a file.
878 *
879 * @param file_name The path to the file to load.
880 * @param is_user_defs true if the definitions are local, false if they are global.
881 * @returns true if the definitions were successfully loaded.
882 */
883 int loadDefinitions(const char *file_name, bool is_user_defs = true);
884 /** Save local definitions to ~/.qalculate/definitions/
885 *
886 * @returns true if definitions was successfully saved.
887 */
888 bool saveDefinitions();
889 int saveDataObjects();
890 int savePrefixes(const char *file_name, bool save_global = false);
891 int saveVariables(const char *file_name, bool save_global = false);
892 int saveUnits(const char *file_name, bool save_global = false);
893 int saveFunctions(const char *file_name, bool save_global = false);
894 int saveDataSets(const char *file_name, bool save_global = false);
895 //@}
896
897 /** @name Functions for CSV file import/export. */
898 //@{
899 bool importCSV(MathStructure &mstruct, const char *file_name, int first_row = 1, string delimiter = ",", vector<string> *headers = NULL);
900 bool importCSV(const char *file_name, int first_row = 1, bool headers = true, string delimiter = ",", bool to_matrix = false, string name = "", string title = "", string category = "");
901 bool exportCSV(const MathStructure &mstruct, const char *file_name, string delimiter = ",");
902 //@}
903
904 /** @name Functions for exchange rates. */
905 //@{
906 /** Checks if gnomevfs-copy or wget is available for downloading exchange rates from the Internet.
907 *
908 * @returns true if gnomevfs-copy or wget was found.
909 */
910 bool canFetch();
911 /** Checks if gnomevfs-copy available.
912 *
913 * @returns true if gnomevfs-copy was found.
914 */
915 bool hasGnomeVFS();
916 /** Load saved (local) currency units and exchange rates.
917 *
918 * @returns true if operation successful.
919 */
920 bool loadExchangeRates();
921 /** Name of the exchange rates file on local disc.
922 *
923 * @returns name of local exchange rates file.
924 */
925 string getExchangeRatesFileName();
926 /** Url of the exchange rates file on the Internet.
927 *
928 * @returns Url of exchange rates file.
929 */
930 string getExchangeRatesUrl();
931 /** Download current exchange rates from the Internet to local disc.
932 *
933 * @param timeout Timeout for donwload try (only used by wget)
934 * @param wget_args Extra arguments to pass to wget.
935 * @returns true if operation was successful.
936 */
937 bool fetchExchangeRates(int timeout, string wget_args);
938 /** Download current exchange rates from the Internet to local disc with default wget arguments.
939 *
940 * @param timeout Timeout for donwload try (only used by wget)
941 * @returns true if operation was successful.
942 */
943 bool fetchExchangeRates(int timeout = 15);
944 /** Returns true if the exchange rates on local disc is older than one week. */
945 bool checkExchangeRatesDate();
946 //@}
947
948 /** @name Functions for plotting */
949 //@{
950 /** Checks if gnuplot is available.
951 *
952 * @returns true if gnuplot was found.
953 */
954 bool canPlot();
955 MathStructure expressionToPlotVector(string expression, const MathStructure &min, const MathStructure &max, int steps, MathStructure *x_vector = NULL, string x_var = "\\x", const ParseOptions &po = default_parse_options);
956 MathStructure expressionToPlotVector(string expression, float min, float max, int steps, MathStructure *x_vector = NULL, string x_var = "\\x", const ParseOptions &po = default_parse_options);
957 MathStructure expressionToPlotVector(string expression, const MathStructure &min, const MathStructure &max, const MathStructure &step, MathStructure *x_vector = NULL, string x_var = "\\x", const ParseOptions &po = default_parse_options);
958 MathStructure expressionToPlotVector(string expression, float min, float max, float step, MathStructure *x_vector = NULL, string x_var = "\\x", const ParseOptions &po = default_parse_options);
959 MathStructure expressionToPlotVector(string expression, const MathStructure &x_vector, string x_var = "\\x", const ParseOptions &po = default_parse_options);
960 bool plotVectors(PlotParameters *param, const vector<MathStructure> &y_vectors, const vector<MathStructure> &x_vectors, vector<PlotDataParameters*> &pdps, bool persistent = false);
961 bool invokeGnuplot(string commands, string commandline_extra = "", bool persistent = false);
962 bool closeGnuplot();
963 bool gnuplotOpen();
964 //@}
965
966 /** @name Functions for global precision */
967 //@{
968 /** Set default precision for approximate calculations.
969 *
970 * @param precision Precision.
971 */
972 void setPrecision(int precision = DEFAULT_PRECISION);
973 /** Returns default precision for approximate calculations.
974 */
975 int getPrecision() const;
976 //@}
977
978 /** @name Functions for localization */
979 //@{
980 /** Returns the preferred decimal point character.
981 */
982 const string &getDecimalPoint() const;
983 /** Returns the preferred comma character for separating arguments.*/
984 const string &getComma() const;
985 /** Sets argument separator and decimal sign from the current locale. Mainly for internal use. */
986 void setLocale();
987 void useDecimalComma();
988 void useDecimalPoint();
989 /** Resets argument separator and decimal sign. Mainly for internal use. */
990 void unsetLocale();
991 /** Returns the translated text string used in expressions for converting to a specific unit expression (ex "5 meters to feet.*/
992 string localToString() const;
993 //@}
994
995 /** @name Functions adding alternative symbols for operators and such */
996 //@{
997 void addStringAlternative(string replacement, string standard);
998 bool delStringAlternative(string replacement, string standard);
999 void addDefaultStringAlternative(string replacement, string standard);
1000 bool delDefaultStringAlternative(string replacement, string standard);
1001 //@}
1002
1003 /** @name Functions for storing values with associated identifiers */
1004 //@{
1005 /** Stores a value with an associated id. Mainly for internal use.
1006 *
1007 * @param mstruct The value to store.
1008 * @param persistent If false the values will be removed from storage when retrieved with getId().
1009 * @returns Storage id.
1010 */
1011 size_t addId(MathStructure *mstruct, bool persistent = false);
1012 /** Stores a function value with arguments parsed from a text string using Function::parse(), with an associated id. Mainly for internal use.
1013 *
1014 * @param f Mathematical function.
1015 * @param str Arguments.
1016 * @param po Parse options.
1017 * @param persistent If false the values will be removed from storage when retrieved with getId().
1018 * @returns Storage id.
1019 */
1020 size_t parseAddId(MathFunction *f, const string &str, const ParseOptions &po, bool persistent = false);
1021 size_t parseAddIdAppend(MathFunction *f, const MathStructure &append_mstruct, const string &str, const ParseOptions &po, bool persistent = false);
1022 size_t parseAddVectorId(const string &str, const ParseOptions &po, bool persistent = false);
1023 /** Returns a stored value. Mainly for internal use.
1024 *
1025 * @param id Storage id.
1026 * @returns A stored value.
1027 */
1028 MathStructure *getId(size_t id);
1029 /** Removes and unreferences (value->unref() will be called) a value from storage. Mainly for internal use.
1030 *
1031 * @param id Storage id.
1032 */
1033 void delId(size_t id);
1034 //@}
1035
1036};
1037
1038#endif
1039