[Boost] [GSoC] Checks project - prototype hesitation

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

[Boost] [GSoC] Checks project - prototype hesitation

Pierre Talbot
Hello community.

I'm a GSoC student who is assigned to the checks library.
I currently design the prototype of a function and I would like to
have your opinions.

Description.
---------------

The function must return true or false if the number is correct (or not).
This leads me to this prototype :

template <typename mod10_iter>
bool check_mod10 ( const mod10_iter &begin, const mod10_iter &end,
unsigned int nbr_digits = 0) ;


But each digits in the functions may have a weight. So I must passed a
sequence of unsigned int to the function.

template <typename mod10_iter>
bool check_mod10 ( const mod10_iter &begin, const mod10_iter &end,
const boost::array<unsigned int> &weight, unsigned int nbr_digits = 0)
;


The parameter "weight" should be optional, if the size is equal to 0,
the algorithm will consider a weight of 1 for all the digits.

The const of weight is a problem if the size is equal to 0, we should
make a copy of this argument.

Do you have any ideas, suggestions about this prototype ?

Thank you very much.

Pierre Talbot.
_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost
Reply | Threaded
Open this post in threaded view
|

Re: [Boost] [GSoC] Checks project - prototype hesitation

Alejandro Cabrera
Pierre Talbot wrote
Hello community.

I'm a GSoC student who is assigned to the checks library.
I currently design the prototype of a function and I would like to
have your opinions.
Pierre,

Could you provide a link to some documentation or source that gives more context on your project?

I would gladly give some feedback, but I do not understand the requirements of your project.

Thanks,
-Alej
Reply | Threaded
Open this post in threaded view
|

Re: [Boost] [GSoC] Checks project - prototype hesitation

Scott McMurray-2
In reply to this post by Pierre Talbot
On Sat, Jul 16, 2011 at 08:58, Pierre Talbot
<[hidden email]> wrote:
>
> But each digits in the functions may have a weight. So I must passed a
> sequence of unsigned int to the function.
>

Why would the weights be specified at runtime?

I'd expect to see a call that looked more like this:

    typedef mod10_checksum<2, 1> card_checksum;
    bool is_valid = verify_checksum<card_checksum>(digits.begin(),
digits.end());

Why do you need the nbr_digits parameter?

~ Scott
_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost
Reply | Threaded
Open this post in threaded view
|

Re: [Boost] [GSoC] Checks project - prototype hesitation

Pierre Talbot
In reply to this post by Alejandro Cabrera
Hello Alejandro,

I'm sorry for being unclear.

You can see the forward declarations (and the doxygen doc) here :

http://svn.boost.org/svn/boost/sandbox/SOC/2011/checks/boost/checks/checks_fwd.hpp

The documentation is here (you would like to read the introduction) :

http://svn.boost.org/svn/boost/sandbox/SOC/2011/checks/libs/checks/doc/checks.pdf


As you can read in the introduction I thought it was interesting to
implement a "low check level library", more general, not designed for
a specific number or code. The reason is that I can't implement all
the different numbers existing in the world. But with this "low level
library", an user should be able to check a number I didn't implement.
 Nevertheless I'll implement the most well-known such as the isbn,
ean, upc, iban, credit card, ... in a "high check level library".

The nbr_digits parameter is optional but it is in case that the
iterators don't delimit only one number. I designed an example for
this special case (In the "Modular sum algorithm - Example - Special
case" section). My first idea was to support the check of a lot of
numbers between two iterators. But you maybe think it's a little
far-fetched ?

Any suggestions and comments are appreciated.

Thank you very much,

Pierre Talbot.

2011/7/17 Alejandro Cabrera <[hidden email]>:

>
> Pierre Talbot wrote:
>>
>> Hello community.
>>
>> I'm a GSoC student who is assigned to the checks library.
>> I currently design the prototype of a function and I would like to
>> have your opinions.
>>
>
> Pierre,
>
> Could you provide a link to some documentation or source that gives more
> context on your project?
>
> I would gladly give some feedback, but I do not understand the requirements
> of your project.
>
> Thanks,
> -Alej
>
> --
> View this message in context: http://boost.2283326.n4.nabble.com/Boost-GSoC-Checks-project-prototype-hesitation-tp3672034p3673960.html
> Sent from the Boost - Dev mailing list archive at Nabble.com.
> _______________________________________________
> Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost
>
_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost
Reply | Threaded
Open this post in threaded view
|

Re: [Boost] [GSoC] Checks project - prototype hesitation

Alejandro Cabrera
This post was updated on .
Pierre Talbot wrote
Hello Alejandro,

I'm sorry for being unclear.

You can see the forward declarations (and the doxygen doc) here :

http://svn.boost.org/svn/boost/sandbox/SOC/2011/checks/boost/checks/checks_fwd.hpp

The documentation is here (you would like to read the introduction) :

http://svn.boost.org/svn/boost/sandbox/SOC/2011/checks/libs/checks/doc/checks.pdf

...

The nbr_digits parameter is optional but it is in case that the
iterators don't delimit only one number. I designed an example for
this special case (In the "Modular sum algorithm - Example - Special
case" section). My first idea was to support the check of a lot of
numbers between two iterators. But you maybe think it's a little
far-fetched ?

Any suggestions and comments are appreciated.

Thank you very much,

Pierre Talbot.
Pierrre,

Thank you for the documentation. I've glanced through the PDF, taking into account the scope and general design of the library.

I also have concerns with regards to the nbr_digits parameter. The example has shown me a case where the user is encouraged to store all the numbers in a single container without separation. It seems like a bad idea to store the numbers in that fashion. Why wouldn't the user instead prefer to store the numbers in, say:

std::vector<string> luhn_numbers;

I'm not certain whether the weights should be a compile-time parameter or not. My recommendation here is to craft examples where the weights are compile-time parameters (using boost::tuple, perhaps?) and where the weights are run-time parameters and attempt to determine for yourself what might be easier and safer for users to use.

-Alej