本文整理汇总了C++中zxing::IllegalStateException方法的典型用法代码示例。如果您正苦于以下问题:C++ zxing::IllegalStateException方法的具体用法?C++ zxing::IllegalStateException怎么用?C++ zxing::IllegalStateException使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类zxing
的用法示例。
在下文中一共展示了zxing::IllegalStateException方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ReedSolomonException
vector<Ref<GenericGFPoly> > ReedSolomonDecoder::runEuclideanAlgorithm(Ref<GenericGFPoly> a,
Ref<GenericGFPoly> b,
int R) {
// Assume a's degree is >= b's
if (a->getDegree() < b->getDegree()) {
Ref<GenericGFPoly> tmp = a;
a = b;
b = tmp;
}
Ref<GenericGFPoly> rLast(a);
Ref<GenericGFPoly> r(b);
Ref<GenericGFPoly> tLast(field->getZero());
Ref<GenericGFPoly> t(field->getOne());
// Run Euclidean algorithm until r's degree is less than R/2
while (r->getDegree() >= R / 2) {
Ref<GenericGFPoly> rLastLast(rLast);
Ref<GenericGFPoly> tLastLast(tLast);
rLast = r;
tLast = t;
// Divide rLastLast by rLast, with quotient q and remainder r
if (rLast->isZero()) {
// Oops, Euclidean algorithm already terminated?
throw ReedSolomonException("r_{i-1} was zero");
}
r = rLastLast;
Ref<GenericGFPoly> q = field->getZero();
int denominatorLeadingTerm = rLast->getCoefficient(rLast->getDegree());
int dltInverse = field->inverse(denominatorLeadingTerm);
while (r->getDegree() >= rLast->getDegree() && !r->isZero()) {
int degreeDiff = r->getDegree() - rLast->getDegree();
int scale = field->multiply(r->getCoefficient(r->getDegree()), dltInverse);
q = q->addOrSubtract(field->buildMonomial(degreeDiff, scale));
r = r->addOrSubtract(rLast->multiplyByMonomial(degreeDiff, scale));
}
t = q->multiply(tLast)->addOrSubtract(tLastLast);
if (r->getDegree() >= rLast->getDegree()) {
throw IllegalStateException("Division algorithm failed to reduce polynomial?");
}
}
int sigmaTildeAtZero = t->getCoefficient(0);
if (sigmaTildeAtZero == 0) {
throw ReedSolomonException("sigmaTilde(0) was zero");
}
int inverse = field->inverse(sigmaTildeAtZero);
Ref<GenericGFPoly> sigma(t->multiply(inverse));
Ref<GenericGFPoly> omega(r->multiply(inverse));
vector<Ref<GenericGFPoly> > result(2);
result[0] = sigma;
result[1] = omega;
return result;
}