本文整理汇总了C++中checkType函数的典型用法代码示例。如果您正苦于以下问题:C++ checkType函数的具体用法?C++ checkType怎么用?C++ checkType使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了checkType函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: rpoplpushCommand
void rpoplpushCommand(redisClient *c) {
robj *sobj, *value;
if ((sobj = lookupKeyWriteOrReply(c,c->argv[1],shared.nullbulk)) == NULL ||
checkType(c,sobj,REDIS_LIST)) return;
if (listTypeLength(sobj) == 0) {
/* This may only happen after loading very old RDB files. Recent
* versions of Redis delete keys of empty lists. */
addReply(c,shared.nullbulk);
} else {
robj *dobj = lookupKeyWrite(c->db,c->argv[2]);
robj *touchedkey = c->argv[1];
if (dobj && checkType(c,dobj,REDIS_LIST)) return;
value = listTypePop(sobj,REDIS_TAIL);
/* We saved touched key, and protect it, since rpoplpushHandlePush
* may change the client command argument vector. */
incrRefCount(touchedkey);
rpoplpushHandlePush(c,c,c->argv[2],dobj,value);
/* listTypePop returns an object with its refcount incremented */
decrRefCount(value);
/* Delete the source list when it is empty */
if (listTypeLength(sobj) == 0) dbDelete(c->db,touchedkey);
signalModifiedKey(c->db,touchedkey);
decrRefCount(touchedkey);
server.dirty++;
/* Replicate this as a simple RPOP since the LPUSH side is replicated
* by rpoplpushHandlePush() call if needed (it may not be needed
* if a client is blocking wait a push against the list). */
rewriteClientCommandVector(c,2,
resetRefCount(createStringObject("RPOP",4)),
c->argv[1]);
}
}
开发者ID:CNCBASHER,项目名称:linuxcnc-1,代码行数:37,代码来源:t_list.c
示例2: incrDecrCommand
void incrDecrCommand(redisClient *c, long long init_value, long long incr) {
c->returncode = REDIS_ERR;
long long value, oldvalue;
robj *o;
o = lookupKeyWriteWithVersion(c->db,c->argv[1],&(c->version));
if (o != NULL && checkType(c,o,REDIS_STRING)) {
c->returncode = REDIS_ERR_WRONG_TYPE_ERROR;
return;
}
robj* key = c->argv[1];
if(o != NULL) {
uint16_t version = sdsversion(key->ptr);
if(c->version_care && version != 0 && version != c->version) {
c->returncode = REDIS_ERR_VERSION_ERROR;
return;
} else {
sdsversion_change(key->ptr, c->version);
}
} else {
sdsversion_change(key->ptr, 0);
}
if(c->version_care) {
sdsversion_add(key->ptr, 1);
}
if (o == NULL) {
value = init_value;
} else if (getLongLongFromObject(o,&value) != REDIS_OK) {
c->returncode = REDIS_ERR_IS_NOT_INTEGER;
return;
}
oldvalue = value;
value += incr;
value = (int32_t)value;
o = createStringObjectFromLongLong(value);
dbSuperReplace(c->db,c->argv[1],o);
c->db->dirty++;
EXPIRE_OR_NOT
c->retvalue.llnum = value;
c->returncode = REDIS_OK;
}
开发者ID:yinchunxiang,项目名称:DistributedCache,代码行数:49,代码来源:t_string.c
示例3: linsertat
/*
LINSERTAT command: insert an item at specified index
LINSERTAT KEY INDEX VALUE
1. If INDEX <0, move cursor backwards from end
2. If INDEX >= LENGTH_OF_LIST, append the value at the end of list
3. ELSE, insert val before item at INDEX
return the new length of list
*/
void linsertat(client* c){
robj *subject;
listTypeIterator *iter;
listTypeEntry entry;
int inserted = 0;
int index;
if ((subject = lookupKeyWriteOrReply(c,c->argv[1],shared.czero)) == NULL ||
checkType(c,subject,OBJ_LIST)) return;
if ((getLongFromObjectOrReply(c, c->argv[2], &index, NULL) != C_OK))
return;
robj *val = c->argv[3];
int insertWhere = LIST_HEAD;
if(index >= listTypeLength(subject)){
// insert at the end of list, after the last element
iter = listTypeInitIterator(subject,-1,LIST_HEAD);
index = 0;
insertWhere = LIST_TAIL;
} else if(index < 0) {
iter = listTypeInitIterator(subject,-1,LIST_HEAD);
index = (-index)-1;
} else {
iter = listTypeInitIterator(subject,0,LIST_TAIL);
}
while (listTypeNext(iter,&entry)) {
if (index==0) {
listTypeInsert(&entry,val,insertWhere);
inserted = 1;
break;
}
index--;
}
listTypeReleaseIterator(iter);
if (inserted) {
signalModifiedKey(c->db,c->argv[1]);
notifyKeyspaceEvent(NOTIFY_LIST,"linsertat", c->argv[1],c->db->id);
server.dirty++;
} else {
addReply(c,shared.cnegone);
return;
}
// Return the new length of list
addReplyLongLong(c,listTypeLength(subject));
}
开发者ID:RealHacker,项目名称:redis-plus,代码行数:57,代码来源:t_list.c
示例4: serveClientBlockedOnList
/* This is a helper function for handleClientsBlockedOnLists(). It's work
* is to serve a specific client (receiver) that is blocked on 'key'
* in the context of the specified 'db', doing the following:
*
* 1) Provide the client with the 'value' element.
* 2) If the dstkey is not NULL (we are serving a BRPOPLPUSH) also push the
* 'value' element on the destination list (the LPUSH side of the command).
* 3) Propagate the resulting BRPOP, BLPOP and additional LPUSH if any into
* the AOF and replication channel.
*
* The argument 'where' is REDIS_TAIL or REDIS_HEAD, and indicates if the
* 'value' element was popped fron the head (BLPOP) or tail (BRPOP) so that
* we can propagate the command properly.
*
* The function returns REDIS_OK if we are able to serve the client, otherwise
* REDIS_ERR is returned to signal the caller that the list POP operation
* should be undone as the client was not served: This only happens for
* BRPOPLPUSH that fails to push the value to the destination key as it is
* of the wrong type. */
int serveClientBlockedOnList(redisClient *receiver, robj *key, robj *dstkey, redisDb *db, robj *value, int where)
{
robj *argv[3];
if (dstkey == NULL) {
/* Propagate the [LR]POP operation. */
argv[0] = (where == REDIS_HEAD) ? shared.lpop :
shared.rpop;
argv[1] = key;
propagate((where == REDIS_HEAD) ?
server.lpopCommand : server.rpopCommand,
db->id,argv,2,REDIS_PROPAGATE_AOF|REDIS_PROPAGATE_REPL);
/* BRPOP/BLPOP */
addReplyMultiBulkLen(receiver,2);
addReplyBulk(receiver,key);
addReplyBulk(receiver,value);
} else {
/* BRPOPLPUSH */
robj *dstobj =
lookupKeyWrite(receiver->db,dstkey);
if (!(dstobj &&
checkType(receiver,dstobj,REDIS_LIST)))
{
/* Propagate the RPOP operation. */
argv[0] = shared.rpop;
argv[1] = key;
propagate(server.rpopCommand,
db->id,argv,2,
REDIS_PROPAGATE_AOF|
REDIS_PROPAGATE_REPL);
rpoplpushHandlePush(receiver,dstkey,dstobj,
value);
/* Propagate the LPUSH operation. */
argv[0] = shared.lpush;
argv[1] = dstkey;
argv[2] = value;
propagate(server.lpushCommand,
db->id,argv,3,
REDIS_PROPAGATE_AOF|
REDIS_PROPAGATE_REPL);
} else {
/* BRPOPLPUSH failed because of wrong
* destination type. */
return REDIS_ERR;
}
}
return REDIS_OK;
}
开发者ID:superlaza,项目名称:fbTesting,代码行数:68,代码来源:t_list.c
示例5: unfreeze
void pattern::loadSettings( const QDomElement & _this )
{
unfreeze();
m_patternType = static_cast<PatternTypes>( _this.attribute( "type"
).toInt() );
setName( _this.attribute( "name" ) );
if( _this.attribute( "pos" ).toInt() >= 0 )
{
movePosition( _this.attribute( "pos" ).toInt() );
}
changeLength( MidiTime( _this.attribute( "len" ).toInt() ) );
if( _this.attribute( "muted" ).toInt() != isMuted() )
{
toggleMute();
}
clearNotes();
QDomNode node = _this.firstChild();
while( !node.isNull() )
{
if( node.isElement() &&
!node.toElement().attribute( "metadata" ).toInt() )
{
note * n = new note;
n->restoreState( node.toElement() );
m_notes.push_back( n );
}
node = node.nextSibling();
}
m_steps = _this.attribute( "steps" ).toInt();
if( m_steps == 0 )
{
m_steps = MidiTime::stepsPerTact();
}
ensureBeatNotes();
checkType();
/* if( _this.attribute( "frozen" ).toInt() )
{
freeze();
}*/
emit dataChanged();
updateBBTrack();
}
开发者ID:AHudon,项目名称:SOEN6471_LMMS,代码行数:49,代码来源:pattern.cpp
示例6: readArgs
void readArgs(int* msg_type,int* msg_len,char buffer[],char* msg_to) {
char type[10];
memset(buffer,'\0',sizeof(buffer));
do {
printf("Please input the type of messge to %s(int):\n",msg_to);
scanf("%s",type);
}
while(checkType(type) == 0);
getchar();
*msg_type = transformType(type);
printf("Please input message to %s. Press 'Enter' to send.(input \"q\" or \"Q\" to quit)\n",msg_to);
fgets(buffer,BUF_SIZE,stdin);
*msg_len = strlen(buffer)-1;
buffer[*msg_len] = '\0';
}
开发者ID:FateScript,项目名称:Linux-Work,代码行数:15,代码来源:fifo_pipe.c
示例7: alphatPhaseChangeJayatillekeWallFunctionFvPatchScalarField
alphatFixedDmdtWallBoilingWallFunctionFvPatchScalarField::
alphatFixedDmdtWallBoilingWallFunctionFvPatchScalarField
(
const fvPatch& p,
const DimensionedField<scalar, volMesh>& iF
)
:
alphatPhaseChangeJayatillekeWallFunctionFvPatchScalarField(p, iF),
vaporPhaseName_("vapor"),
relax_(1.0),
fixedDmdt_(0.0),
L_(0.0)
{
checkType();
}
开发者ID:OpenFOAM,项目名称:OpenFOAM-dev,代码行数:15,代码来源:alphatFixedDmdtWallBoilingWallFunctionFvPatchScalarField.C
示例8: Cmu_
kLowReWallFunctionFvPatchScalarField::kLowReWallFunctionFvPatchScalarField
(
const kLowReWallFunctionFvPatchScalarField& kwfpsf,
const DimensionedField<scalar, volMesh>& iF
)
:
fixedValueFvPatchField<scalar>(kwfpsf, iF),
Cmu_(kwfpsf.Cmu_),
kappa_(kwfpsf.kappa_),
E_(kwfpsf.E_),
Ceps2_(kwfpsf.Ceps2_),
yPlusLam_(kwfpsf.yPlusLam_)
{
checkType();
}
开发者ID:qyzeng,项目名称:OpenFOAM-dev,代码行数:15,代码来源:kLowReWallFunctionFvPatchScalarField.C
示例9: rpoplpushCommand
void rpoplpushCommand(redisClient *c) {
robj *sobj, *value;
if ((sobj = lookupKeyWriteOrReply(c,c->argv[1],shared.nullbulk)) == NULL ||
checkType(c,sobj,REDIS_LIST)) return;
if (listTypeLength(sobj) == 0) {
/* This may only happen after loading very old RDB files. Recent
* versions of Redis delete keys of empty lists. */
addReply(c,shared.nullbulk);
} else {
robj *dobj = lookupKeyWrite(c->db,c->argv[2]);
robj *touchedkey = c->argv[1];
if (dobj && checkType(c,dobj,REDIS_LIST)) return;
value = listTypePop(sobj,REDIS_TAIL);
/* We saved touched key, and protect it, since rpoplpushHandlePush
* may change the client command argument vector (it does not
* currently). */
incrRefCount(touchedkey);
rpoplpushHandlePush(c,c->argv[2],dobj,value);
/* listTypePop returns an object with its refcount incremented */
decrRefCount(value);
/* Delete the source list when it is empty */
notifyKeyspaceEvent(REDIS_NOTIFY_LIST,"rpop",touchedkey,c->db->id);
if (listTypeLength(sobj) == 0) {
dbDelete(c->db,touchedkey);
notifyKeyspaceEvent(REDIS_NOTIFY_GENERIC,"del",
touchedkey,c->db->id);
}
signalModifiedKey(c->db,touchedkey);
decrRefCount(touchedkey);
server.dirty++;
}
}
开发者ID:superlaza,项目名称:fbTesting,代码行数:36,代码来源:t_list.c
示例10: srandmemberCommand
void srandmemberCommand(redisClient *c) {
robj *set, *ele;
int64_t llele;
int encoding;
if ((set = lookupKeyReadOrReply(c,c->argv[1],shared.nullbulk)) == NULL ||
checkType(c,set,REDIS_SET)) return;
encoding = setTypeRandomElement(set,&ele,&llele);
if (encoding == REDIS_ENCODING_INTSET) {
addReplyBulkLongLong(c,llele);
} else {
addReplyBulk(c,ele);
}
}
开发者ID:jrun,项目名称:redis,代码行数:15,代码来源:t_set.c
示例11: popGenericCommand
void popGenericCommand(redisClient *c, int where) {
robj *o = lookupKeyWriteOrReply(c,c->argv[1],shared.nullbulk);
if (o == NULL || checkType(c,o,REDIS_LIST)) return;
robj *value = listTypePop(o,where);
if (value == NULL) {
addReply(c,shared.nullbulk);
} else {
addReplyBulk(c,value);
decrRefCount(value);
if (listTypeLength(o) == 0) dbDelete(c->db,c->argv[1]);
signalModifiedKey(c->db,c->argv[1]);
server.dirty++;
}
}
开发者ID:CNCBASHER,项目名称:linuxcnc-1,代码行数:15,代码来源:t_list.c
示例12: sismemberCommand
void sismemberCommand(redisClient* c)
{
robj* set;
if ((set = lookupKeyReadOrReply(c, c->argv[1], shared.czero)) == NULL ||
checkType(c, set, REDIS_SET)) {
return;
}
c->argv[2] = tryObjectEncoding(c->argv[2]);
if (setTypeIsMember(set, c->argv[2])) {
addReply(c, shared.cone);
} else {
addReply(c, shared.czero);
}
}
开发者ID:anothersummer,项目名称:redisDB,代码行数:16,代码来源:t_set.c
示例13: exp__exp_assignop_exp
static void exp__exp_assignop_exp(Node* node){
if(node == NULL) return;
Node* exp1 = node->firstChild;
Node* exp2 = exp1->nextSibling->nextSibling;
handle(exp1);
handle(exp2);
if(exp1->type != NULL && exp2->type != NULL){
if(!checkType(exp1->type, exp2->type)){
semanticError(node->line, "Type mismatched\n", NULL);
}else if(!isLeftValue(exp1)){
semanticError(node->line, "The left-hand side of an assignment must be a variable\n", NULL);
}else{
node->type = exp1->type;
}
}
}
开发者ID:moreOver0,项目名称:c_compiler,代码行数:16,代码来源:semantic.c
示例14: checkType
void AssetManager::addAsset(int type, const String& key, Asset* asset) {
SCOPE_LOCK;
checkType(__func__, type);
asset->m_key = key;
Data* d = m_datas[type];
AssetDict::iterator it =d->assetDict.find(asset->m_key);
if ( it != d->assetDict.end()) {
Errorf("%s: duplicated asset name", __func__);
}
d->assetDict[asset->m_key] = asset;
asset->m_frameId = m_frameId;
}
开发者ID:CharlieCraft,项目名称:axonengine,代码行数:16,代码来源:assetmanager.cpp
示例15: incrDecrCommand
void incrDecrCommand(redisClient *c, long long incr) {
long long value;
robj *o;
o = lookupKeyWrite(c->db,c->argv[1]);
if (o != NULL && checkType(c,o,REDIS_STRING)) return;
if (getLongLongFromObjectOrReply(c,o,&value,NULL) != REDIS_OK) return;
value += incr;
o = createStringObjectFromLongLong(value);
dbReplace(c->db,c->argv[1],o);
server.dirty++;
addReply(c,shared.colon);
addReply(c,o);
addReply(c,shared.crlf);
}
开发者ID:chewbranca,项目名称:redis,代码行数:16,代码来源:t_string.c
示例16: typedIntItem
static status
typedIntItem(IntItem ii, EventId id)
{ CharArray save = getCopyCharArray(ii->value_text->string);
status rval = typedTextItem((TextItem)ii, id);
if ( rval &&
!checkType(ii->value_text->string, TypeInt, NIL) &&
getSizeCharArray(ii->value_text->string) != ZERO )
{ displayedValueTextItem((TextItem)ii, save);
return errorPce(ii, NAME_cannotConvertText,
ii->value_text->string, ii->type);
}
doneObject(save);
return rval;
}
开发者ID:lamby,项目名称:pkg-swi-prolog,代码行数:16,代码来源:intitem.c
示例17: sremCommand
void sremCommand(redisClient *c) {
robj *set;
if ((set = lookupKeyWriteOrReply(c,c->argv[1],shared.czero)) == NULL ||
checkType(c,set,REDIS_SET)) return;
c->argv[2] = tryObjectEncoding(c->argv[2]);
if (setTypeRemove(set,c->argv[2])) {
if (setTypeSize(set) == 0) dbDelete(c->db,c->argv[1]);
touchWatchedKey(c->db,c->argv[1]);
server.dirty++;
addReply(c,shared.cone);
} else {
addReply(c,shared.czero);
}
}
开发者ID:jrun,项目名称:redis,代码行数:16,代码来源:t_set.c
示例18: alphatPhaseChangeWallFunctionFvPatchScalarField
alphatFixedDmdtWallBoilingWallFunctionFvPatchScalarField::
alphatFixedDmdtWallBoilingWallFunctionFvPatchScalarField
(
const fvPatch& p,
const DimensionedField<scalar, volMesh>& iF
)
:
alphatPhaseChangeWallFunctionFvPatchScalarField(p, iF),
Prt_(0.85),
Cmu_(0.09),
kappa_(0.41),
E_(9.8),
fixedDmdt_(0.0)
{
checkType();
}
开发者ID:OlegSutyrin,项目名称:OpenFOAM-3.0.x,代码行数:16,代码来源:alphatFixedDmdtWallBoilingWallFunctionFvPatchScalarField.C
示例19: pushxGenericCommand
void pushxGenericCommand(redisClient *c, robj *refval, robj *val, int where) {
robj *subject;
listTypeIterator *iter;
listTypeEntry entry;
int inserted = 0;
if ((subject = lookupKeyReadOrReply(c,c->argv[1],shared.czero)) == NULL ||
checkType(c,subject,REDIS_LIST)) return;
if (refval != NULL) {
/* We're not sure if this value can be inserted yet, but we cannot
* convert the list inside the iterator. We don't want to loop over
* the list twice (once to see if the value can be inserted and once
* to do the actual insert), so we assume this value can be inserted
* and convert the ziplist to a regular list if necessary. */
listTypeTryConversion(subject,val);
/* Seek refval from head to tail */
iter = listTypeInitIterator(subject,0,REDIS_TAIL);
while (listTypeNext(iter,&entry)) {
if (listTypeEqual(&entry,refval)) {
listTypeInsert(&entry,val,where);
inserted = 1;
break;
}
}
listTypeReleaseIterator(iter);
if (inserted) {
/* Check if the length exceeds the ziplist length threshold. */
if (subject->encoding == REDIS_ENCODING_ZIPLIST &&
ziplistLen(subject->ptr) > LIST_MAX_ZIPLIST_ENTRIES)
listTypeConvert(subject,REDIS_ENCODING_LINKEDLIST);
signalModifiedKey(c->db,c->argv[1]);
} else {
/* Notify client of a failed insert */
addReply(c,shared.cnegone);
return;
}
} else {
listTypePush(subject,val,where);
signalModifiedKey(c->db,c->argv[1]);
}
addReplyLongLong(c,listTypeLength(subject));
}
开发者ID:ifzz,项目名称:cnet,代码行数:46,代码来源:t_list.c
示例20: args__exp
static void args__exp(Node* node){
if(node == NULL) return;
Node* exp = node->firstChild;
handle(exp);
Type* t = exp->type;
bool good = true;
if(node->funcArgIndex >= node->funcArgCount){
good = false;
semanticError(node->line, "Number of arguments mismatched 2\n", NULL);
}else if(!checkType(t, node->funcStdArgv[node->funcArgIndex])){
semanticError(node->line, "Type of argument mismatched\n", NULL);
}
node->funcArgIndex++;
if(good && node->funcArgCount != node->funcArgIndex){
semanticError(node->line, "Number of arguments mismatched 3 \n", NULL);
}
}
开发者ID:moreOver0,项目名称:c_compiler,代码行数:17,代码来源:semantic.c
注:本文中的checkType函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论