本文整理汇总了C++中CheckEqual函数的典型用法代码示例。如果您正苦于以下问题:C++ CheckEqual函数的具体用法?C++ CheckEqual怎么用?C++ CheckEqual使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了CheckEqual函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: CheckEqual
bool CheckEqual( const Pair1 &pair1, const Pair2 &pair2
, typename boost::container::dtl::enable_if_c
<boost::container::dtl::is_pair<Pair1>::value &&
boost::container::dtl::is_pair<Pair2>::value
>::type* = 0)
{
return CheckEqual(pair1.first, pair2.first) && CheckEqual(pair1.second, pair2.second);
}
示例2: CheckIter
static void CheckIter(leveldb_iterator_t* iter,
const char* key, const char* val) {
size_t len;
const char* str;
str = leveldb_iter_key(iter, &len);
CheckEqual(key, str, len);
str = leveldb_iter_value(iter, &len);
CheckEqual(val, str, len);
}
示例3: ConvertPythonToValue
PyObject *CListValue::Pyindex(PyObject *value)
{
PyObject *result = NULL;
CValue* checkobj = ConvertPythonToValue(value, "val = cList[i]: CValueList, ");
if (checkobj==NULL)
return NULL; /* ConvertPythonToValue sets the error */
int numelem = GetCount();
for (int i=0;i<numelem;i++)
{
CValue* elem = GetValue(i);
if (checkobj==elem || CheckEqual(checkobj,elem))
{
result = PyLong_FromLong(i);
break;
}
}
checkobj->Release();
if (result==NULL) {
PyErr_SetString(PyExc_ValueError, "CList.index(x): x not in CListValue");
}
return result;
}
示例4: CheckDel
// Callback from leveldb_writebatch_iterate()
static void CheckDel(void* ptr, const char* k, size_t klen)
{
int* state = (int*) ptr;
CheckCondition(*state == 2);
CheckEqual("bar", k, klen);
(*state)++;
}
示例5: ehgraph_transfer_node_info
bool ehgraph_transfer_node_info(ehgraph_t* dest, enode_t n1, ehgraph_t* src, enode_t n2) {
bool bRet = false;
do {
CheckNotNULL(dest);
CheckLessThan(n1, dest->size + dest->ptrdim);
CheckNotNULL(src);
CheckLessThan(n2, src->size + src->ptrdim);
CheckEqual(src->nLinks, dest->nLinks);
size_t nL = src->nLinks;
enode_info_t* nDst = dest->info + n1;
enode_info_t* nSrc = src->info + n2;
nDst->outDoubleLink = nSrc->outDoubleLink;
nDst->inDoubleLink = nSrc->inDoubleLink;
for (size_t l = 0; l < nL; ++l) {
nDst->links[l] = nSrc->links[l];
nDst->superEdge[l] = nSrc->superEdge[l];
for (size_t ld = 0; ld < nL; ++ld) {
nDst->isPredicate[l][ld] = nSrc->isPredicate[l][ld];
nDst->predicateTarget[l][ld] = nSrc->predicateTarget[l][ld];
}
}
bRet = true;
} while(0);
return bRet;
}
示例6: ehgraph_transfer_edge
bool ehgraph_transfer_edge(ehgraph_t* dest, enode_t n1, ehgraph_t* src, enode_t n2, size_t link) {
bool bRet = false;
do {
CheckNotNULL(dest);
CheckNotNULL(src);
CheckLessThan(n1, dest->size);
CheckLessThan(n2, src->size);
CheckEqual(src->nLinks, dest->nLinks);
CheckLessThan(link, src->nLinks);
size_t nL = src->nLinks;
enode_info_t* nDst = &GET_NODE(dest, n1);
enode_info_t* nSrc = &GET_NODE(src, n2);
if (link == 0)
nDst->outDoubleLink = nSrc->outDoubleLink;
if (1 == link)
nDst->inDoubleLink = nSrc->inDoubleLink;
nDst->links[link] = nSrc->links[link];
nDst->superEdge[link] = nSrc->superEdge[link];
for (size_t ld = 0; ld < nL; ++ld) {
nDst->isPredicate[link][ld] = nSrc->isPredicate[link][ld];
nDst->predicateTarget[link][ld] = nSrc->predicateTarget[link][ld];
}
bRet = true;
} while(0);
return bRet;
}
示例7: CheckPut
// Callback from leveldb_writebatch_iterate()
static void CheckPut(void* ptr,
const char* k, size_t klen,
const char* v, size_t vlen) {
int* state = (int*) ptr;
CheckCondition(*state < 2);
switch (*state) {
case 0:
CheckEqual("bar", k, klen);
CheckEqual("b", v, vlen);
break;
case 1:
CheckEqual("box", k, klen);
CheckEqual("c", v, vlen);
break;
}
(*state)++;
}
示例8: CheckGet
static void CheckGet(
leveldb_t* db,
const leveldb_readoptions_t* options,
const char* key,
const char* expected) {
char* err = NULL;
size_t val_len;
char* val;
val = leveldb_get(db, options, key, strlen(key), &val_len, &err);
CheckNoError(err);
CheckEqual(expected, val, val_len);
Free(&val);
}
示例9: CheckGetCF
static void CheckGetCF(
rocksdb_t* db,
const rocksdb_readoptions_t* options,
rocksdb_column_family_handle_t* handle,
const char* key,
const char* expected) {
char* err = NULL;
size_t val_len;
char* val;
val = rocksdb_get_cf(db, options, handle, key, strlen(key), &val_len, &err);
CheckNoError(err);
CheckEqual(expected, val, val_len);
Free(&val);
}
示例10: CheckEqualIt
bool CheckEqualIt( const T1 &i1, const T2 &i2, const C1 &c1, const C2 &c2 )
{
bool c1end = i1 == c1.end();
bool c2end = i2 == c2.end();
if( c1end != c2end ){
return false;
}
else if(c1end){
return true;
}
else{
return CheckEqual(*i1, *i2);
}
}
示例11: CheckEqualContainers
bool CheckEqualContainers(MyShmCont *shmcont, MyStdCont *stdcont)
{
if(shmcont->size() != stdcont->size())
return false;
typename MyShmCont::iterator itshm(shmcont->begin()), itshmend(shmcont->end());
typename MyStdCont::iterator itstd(stdcont->begin());
typename MyStdCont::size_type dist = (typename MyStdCont::size_type)std::distance(itshm, itshmend);
if(dist != shmcont->size()){
return false;
}
std::size_t i = 0;
for(; itshm != itshmend; ++itshm, ++itstd, ++i){
if(!CheckEqual(*itstd, *itshm))
return false;
}
return true;
}
示例12: CheckEqualContainers
bool CheckEqualContainers(const MyBoostCont &boostcont, const MyStdCont &stdcont)
{
if(boostcont.size() != stdcont.size())
return false;
typename MyBoostCont::const_iterator itboost(boostcont.begin()), itboostend(boostcont.end());
typename MyStdCont::const_iterator itstd(stdcont.begin());
typename MyStdCont::size_type dist = (typename MyStdCont::size_type)std::distance(itboost, itboostend);
if(dist != boostcont.size()){
return false;
}
std::size_t i = 0;
for(; itboost != itboostend; ++itboost, ++itstd, ++i){
if(!CheckEqual(*itstd, *itboost))
return false;
}
return true;
}
示例13: CheckEqualContainers
bool CheckEqualContainers(const ContA &cont_a, const ContB &cont_b)
{
if(cont_a.size() != cont_b.size())
return false;
typename ContA::const_iterator itcont_a(cont_a.begin()), itcont_a_end(cont_a.end());
typename ContB::const_iterator itcont_b(cont_b.begin()), itcont_b_end(cont_b.end());;
typename ContB::size_type dist = (typename ContB::size_type)boost::container::iterator_distance(itcont_a, itcont_a_end);
if(dist != cont_a.size()){
return false;
}
typename ContA::size_type dist2 = (typename ContA::size_type)boost::container::iterator_distance(itcont_b, itcont_b_end);
if(dist2 != cont_b.size()){
return false;
}
std::size_t i = 0;
for(; itcont_a != itcont_a_end; ++itcont_a, ++itcont_b, ++i){
if(!CheckEqual(*itcont_a, *itcont_b))
return false;
}
return true;
}
示例14: Value
//__________________________________________________________________________________
_PMathObj _Constant::Raise (_PMathObj theObj)
{
if (!theObj) {
return nil;
}
_Parameter base = Value(),
expon = theObj->Value();
if (base>0.0) {
return new _Constant (exp (log(base)*(expon)));;
} else {
if (base<0.0)
if (CheckEqual (expon, (long)expon)) {
return new _Constant (((((long)expon)%2)?-1:1)*exp (log(-base)*(expon)));
} else {
_String errMsg ("An invalid base/exponent pair passed to ^");
WarnError (errMsg.sData);
}
return new _Constant (0.0);
}
}
示例15: BlockLength
//.........这里部分代码省略.........
}
else
#endif
ComputeBlock (index, buffer + (hmmCatCount?hmmCatSize:1)*blockLength, useThisPartitonIndex, branchIndex, branchValues);
if (runMode != _hyphyLFConditionMPIIterate && usedCachedResults)
{
bool saveFR = forceRecomputation;
forceRecomputation = true;
ComputeBlock (index, buffer + (hmmCatCount?hmmCatSize:1)*blockLength, useThisPartitonIndex, branchIndex, branchValues);
forceRecomputation = saveFR;
}
if (runMode == _hyphyLFConditionProbsWeightedSum || runMode == _hyphyLFConditionMPIIterate)
{
long lowerBound = hmmCatCount?blockLength*currentHMMCat:0,
upperBound = hmmCatCount?blockLength*(1+currentHMMCat):blockLength,
lowerBound2 = hmmCatCount?(hmmCatSize*blockLength):blockLength;
for (long r1 = lowerBound, r2 = lowerBound2; r1 < upperBound; r1++,r2++)
{
if (siteCorrectors)
{
long scv = *siteCorrectors;
if (scv < scalers.lData[r1]) // this class has a _smaller_ scaling factor
{
buffer[r1] = currentRateWeight * buffer[r2] + buffer[r1] * acquireScalerMultiplier (scalers.lData[r1] - scv);
scalers.lData[r1] = scv;
}
else
{
if (scv > scalers.lData[r1]) // this is a _larger_ scaling factor
buffer[r1] += currentRateWeight * buffer[r2] * acquireScalerMultiplier (scv - scalers.lData[r1]);
else // same scaling factors
buffer[r1] += currentRateWeight * buffer[r2];
}
siteCorrectors++;
}
else
buffer[r1] += currentRateWeight * buffer[r2];
}
}
else // runMode = _hyphyLFConditionProbsMaxProbClass
{
for (long r1 = blockLength*2, r2 = blockLength, r3 = 0; r3 < blockLength; r1++,r2++,r3++)
{
bool doChange = false;
if (siteCorrectors)
{
long scv = *siteCorrectors,
diff = scv - scalers.lData[r3];
if (diff<0) // this has a _smaller_ scaling factor
{
_Parameter scaled = buffer[r1]*acquireScalerMultiplier (diff);
if (buffer[r2] > scaled)
doChange = true;
else
buffer[r1] = scaled;
scalers.lData[r3] = scv;
}
else
{
if (diff>0) // this is a _larger_ scaling factor
buffer[r2] *= acquireScalerMultiplier (-diff);
doChange = buffer[r2] > buffer[r1] && ! CheckEqual (buffer[r2],buffer[r1]);
}
siteCorrectors++;
}
else
doChange = buffer[r2] > buffer[r1] && ! CheckEqual (buffer[r2],buffer[r1]);
if (doChange)
{
buffer[r1] = buffer[r2];
buffer[r3] = useThisPartitonIndex;
}
}
}
}
}
#ifdef __HYPHYMPI__
if (--mpiTasksSent == 0)
break;
#endif
}
}
#ifdef __HYPHYMPI__
DeleteObject (computedWeights);
#endif
DeleteObject (catWeigths);
}