Make db_base::_refclk_divisor pure virtual?

Hi,

This question is addressed mostly to Jason A. since I see he’s been
working on this code recently.

db_base::_refclk_divisor currently throws a runtime_error when it is
called in the base class (not overridden by the daughterboard class).
How do you feel about making this method a pure virtual method? This
is the usual C++ idiom for specifying that a method must be overridden
by the subclass, and is enforced at compile time. I’ve attached a
patch but I wanted to run it by you in case there was another reason
this was done using runtime_error.

Thanks,
Catalin

On Fri, Jul 9, 2010 at 12:05 PM, Catalin P.
[email protected] wrote:

This question is addressed mostly to Jason A. since I see he’s been
working on this code recently.

Catalin,

Unfortunately, I am not a good person to ask about this, my name
appears on that line solely because I fixed a typo in the error
message that had made tracking down a problem in my code more
difficult.

db_base::_refclk_divisor currently throws a runtime_error when it is
called in the base class (not overridden by the daughterboard class).
How do you feel about making this method a pure virtual method? This
is the usual C++ idiom for specifying that a method must be overridden
by the subclass, and is enforced at compile time. I’ve attached a
patch but I wanted to run it by you in case there was another reason
this was done using runtime_error.

I would guess that either Eric or Johnathan have more insight into the
design decisions on the USRP daughterboard api than I can offer.

Jason

On Sun, Jul 11, 2010 at 1:38 AM, Jason A. [email protected] wrote:

Unfortunately, I am not a good person to ask about this, my name
appears on that line solely because I fixed a typo in the error
message that had made tracking down a problem in my code more
difficult.
Can I ask what the problem was?

I would guess that either Eric or Johnathan have more insight into the
design decisions on the USRP daughterboard api than I can offer.
Actually, I realized that the db_base::refclk functions are only
used by some of the daughterboards, so it makes sense to only define
_refclk_divisor for some dbs. The error messages might be more helpful
as something like “Daughterboard must define _reflck_divisor() to use
db_base::refclk()”, though.