Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve projections' parameters handling. #468

Merged
merged 2 commits into from
May 10, 2018

Conversation

awulkiew
Copy link
Member

@awulkiew awulkiew commented Apr 7, 2018

This PR makes the same changes as closed #461 but it's implemented on top of #465.

In short it allows to replace this:

pj_param(pvalues, "sdatum").s; //old

with this:

pj_get_param_s(pvalues, "datum"); //new

and this:

//old
if (pj_param(parameters, "tR").i)
    a = pj_param(parameters, "dR").f;

with this:

//new
pj_param_f(parameters, "R", a);

So the information about the parameter type is expressed in compile-time as function name instead of passed as character in cstring. But most importantly the function doesn't have to be called twice to check if the parameter is set and then get it.

Replace pj_param() taking type of parameter in a string with a set of
functions:
- pj_param_exist() - check if a parameter exists,
- pj_param_X() - check if a parameter exists and assign it to variable,
- pj_get_param_X() - return parameter if it exists or default value,
may be:
- s (returning std::string),
- i (int),
- f (floating point or user-defined numeric type),
- r (angle defined in DMS format as radians in FP or UD type),
- b (bool)

Use the above e.g. to avoid traversing parameters list twice per
parameter in some cases.

Add pj_mkparam() overload taking name and value as separate arguments to
avoid parsing of string in 'param=value' format.
@vissarion
Copy link
Member

Looks ok to me, thanks!

@awulkiew awulkiew merged commit 002f1e0 into boostorg:develop May 10, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants