[Boost] [GSoC] Checks project - prototype hesitation

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.

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-hesit... Sent from the Boost - Dev mailing list archive at Nabble.com.

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_f... The documentation is here (you would like to read the introduction) : http://svn.boost.org/svn/boost/sandbox/SOC/2011/checks/libs/checks/doc/check... 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 <cpp.cabrera@gmail.com>:
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-hesit... Sent from the Boost - Dev mailing list archive at Nabble.com. _______________________________________________ Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost

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 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_f...
The documentation is here (you would like to read the introduction) :
http://svn.boost.org/svn/boost/sandbox/SOC/2011/checks/libs/checks/doc/check...
...
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.
-- View this message in context: http://boost.2283326.n4.nabble.com/Boost-GSoC-Checks-project-prototype-hesit... Sent from the Boost - Dev mailing list archive at Nabble.com.

On Sat, Jul 16, 2011 at 08:58, Pierre Talbot <pierre.talbot.6114@herslibramont.be> 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
participants (3)
-
Alejandro Cabrera
-
Pierre Talbot
-
Scott McMurray