当前位置: 首页>>代码示例>>C++>>正文


C++ CallbackInfo类代码示例

本文整理汇总了C++中CallbackInfo的典型用法代码示例。如果您正苦于以下问题:C++ CallbackInfo类的具体用法?C++ CallbackInfo怎么用?C++ CallbackInfo使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了CallbackInfo类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: destroyHashtable

/**
 * De-allocates memory of the given hashtable buffer.
 * All remaining Buckets are exported, then destroyed
 */
void destroyHashtable(Hashtable* ht)
{
	int i;

	for (i = 0; i < HASHTABLE_SIZE; i++) if (ht->bucket[i] != NULL) {
		HashBucket* bucket = ht->bucket[i];

		while (bucket != 0) {
			HashBucket* nextBucket = (HashBucket*)bucket->next;
			exportBucket(ht, bucket);
			destroyBucket(ht, bucket);
			bucket = nextBucket;
		}
	}

	/* Inform Exporter of Data Template destruction */
	for (i = 0; i < ht->callbackCount; i++) {
		CallbackInfo* ci = &ht->callbackInfo[i];

		if (ci->dataTemplateDestructionCallbackFunction) {
			ci->dataTemplateDestructionCallbackFunction(ci->handle, 0, ht->dataTemplate);
		}
	}

	free(ht->dataTemplate->fieldInfo);
	free(ht->fieldModifier);
	free(ht->dataTemplate->dataInfo);
	free(ht->dataTemplate->data);
	free(ht->dataTemplate);
	free(ht);
}
开发者ID:BackupTheBerlios,项目名称:vermont-svn,代码行数:35,代码来源:hashing.c

示例2: callCallbackFunctions

 void DisplayDeviceManager::callCallbackFunctions(DisplayDeviceDescriptor &descriptor, bool wasAdded)
 {
     for (CallbackInfoIterator it = callbackInfos.begin(); it != callbackInfos.end(); it++)
     {
         CallbackInfo callbackInfo = *it;
         callbackInfo.callbackFunc(callbackInfo.context, descriptor, wasAdded);
     }
 }
开发者ID:Rylith,项目名称:TouchpadTestV2,代码行数:8,代码来源:DisplayDeviceManager.cpp

示例3: exportBucket

/**
 * Exports the given @c bucket
 */
static void exportBucket(Hashtable* ht, HashBucket* bucket)
{
	/* Pass Data Record to exporter interface */
	int n;
	for (n = 0; n < ht->callbackCount; n++) {
		CallbackInfo* ci = &ht->callbackInfo[n];
		if (ci->dataDataRecordCallbackFunction) {
			ci->dataDataRecordCallbackFunction(ci->handle, 0, ht->dataTemplate, ht->fieldLength, bucket->data);
		}
	}
}
开发者ID:BackupTheBerlios,项目名称:vermont-svn,代码行数:14,代码来源:hashing.c

示例4: getNamedItems

static v8::Handle<v8::Value> getNamedItems(HTMLFormControlsCollection* collection, const AtomicString& name, const CallbackInfo& callbackInfo)
{
    Vector<RefPtr<Node> > namedItems;
    collection->namedItems(name, namedItems);

    if (!namedItems.size())
        return v8Undefined();

    if (namedItems.size() == 1)
        return toV8(namedItems.at(0).release(), callbackInfo.Holder(), callbackInfo.GetIsolate());

    return toV8(collection->ownerNode()->radioNodeList(name).get(), callbackInfo.Holder(), callbackInfo.GetIsolate());
}
开发者ID:halton,项目名称:blink-crosswalk,代码行数:13,代码来源:V8HTMLFormControlsCollectionCustom.cpp

示例5: getNamedItems

static v8::Local<v8::Value> getNamedItems(HTMLAllCollection* collection, AtomicString name, const CallbackInfo& info)
{
    WillBeHeapVector<RefPtrWillBeMember<Element>> namedItems;
    collection->namedItems(name, namedItems);

    if (!namedItems.size())
        return v8Undefined();

    if (namedItems.size() == 1)
        return toV8(namedItems.at(0).release(), info.Holder(), info.GetIsolate());

    // FIXME: HTML5 specification says this should be a HTMLCollection.
    // http://www.whatwg.org/specs/web-apps/current-work/multipage/common-dom-interfaces.html#htmlallcollection
    return toV8(StaticElementList::adopt(namedItems), info.Holder(), info.GetIsolate());
}
开发者ID:howardroark2018,项目名称:chromium,代码行数:15,代码来源:V8HTMLAllCollectionCustom.cpp

示例6: getItem

static v8::Handle<v8::Value> getItem(HTMLAllCollection* collection, v8::Handle<v8::Value> argument, const CallbackInfo& info)
{
    v8::Local<v8::Uint32> index = argument->ToArrayIndex();
    if (index.IsEmpty()) {
        V8TRYCATCH_FOR_V8STRINGRESOURCE_RETURN(V8StringResource<>, name, argument, v8::Undefined(info.GetIsolate()));
        v8::Handle<v8::Value> result = getNamedItems(collection, name, info);

        if (result.IsEmpty())
            return v8::Undefined(info.GetIsolate());

        return result;
    }

    RefPtr<Element> result = collection->item(index->Uint32Value());
    return toV8(result.release(), info.Holder(), info.GetIsolate());
}
开发者ID:wangshijun,项目名称:Blink,代码行数:16,代码来源:V8HTMLAllCollectionCustom.cpp

示例7: getItem

static v8::Local<v8::Value> getItem(HTMLAllCollection* collection, v8::Local<v8::Value> argument, const CallbackInfo& info)
{
    v8::Local<v8::Uint32> index;
    if (!argument->ToArrayIndex(info.GetIsolate()->GetCurrentContext()).ToLocal(&index)) {
        TOSTRING_DEFAULT(V8StringResource<>, name, argument, v8::Undefined(info.GetIsolate()));
        v8::Local<v8::Value> result = getNamedItems(collection, name, info);

        if (result.IsEmpty())
            return v8::Undefined(info.GetIsolate());

        return result;
    }

    RefPtrWillBeRawPtr<Element> result = collection->item(index->Value());
    return toV8(result.release(), info.Holder(), info.GetIsolate());
}
开发者ID:howardroark2018,项目名称:chromium,代码行数:16,代码来源:V8HTMLAllCollectionCustom.cpp

示例8: processTemplateSet

/**
 * Processes an IPFIX template set.
 * Called by processMessage
 */
static void processTemplateSet(IpfixReceiver* ipfixReceiver, SourceID sourceId, IpfixSetHeader* set) {
	IpfixTemplateHeader* th = (IpfixTemplateHeader*)&set->data;
	byte* endOfSet = (byte*)set + ntohs(set->length);
	byte* record = (byte*)&th->data;
	/* TemplateSets are >= 4 byte, so we stop processing when only 3 bytes are left */
	while (record < endOfSet - 3) {
		BufferedTemplate* bt = (BufferedTemplate*)malloc(sizeof(BufferedTemplate));
		TemplateInfo* ti = (TemplateInfo*)malloc(sizeof(TemplateInfo));
		bt->sourceID = sourceId;
		bt->templateID = ntohs(th->templateId);
		bt->recordLength = 0;
		bt->setID = ntohs(set->id);
		bt->templateInfo = ti;
		ti->userData = 0;
		ti->fieldCount = ntohs(th->fieldCount);
		ti->fieldInfo = (FieldInfo*)malloc(ti->fieldCount * sizeof(FieldInfo));
		int isLengthVarying = 0;
		uint16_t fieldNo;
		for (fieldNo = 0; fieldNo < ti->fieldCount; fieldNo++) {
			ti->fieldInfo[fieldNo].type.id = ntohs(*(uint16_t*)((byte*)record+0));
			ti->fieldInfo[fieldNo].type.length = ntohs(*(uint16_t*)((byte*)record+2));
			ti->fieldInfo[fieldNo].offset = bt->recordLength; bt->recordLength+=ti->fieldInfo[fieldNo].type.length;
			if (ti->fieldInfo[fieldNo].type.length == 65535) isLengthVarying=1;
			if (ti->fieldInfo[fieldNo].type.id & 0x80) {
				ti->fieldInfo[fieldNo].type.eid = ntohl(*(uint32_t*)((byte*)record+4));
				record = (byte*)((byte*)record+8);
				} else {
				ti->fieldInfo[fieldNo].type.eid = 0;
				record = (byte*)((byte*)record+4);
				}
			}
		if (isLengthVarying) {
  			bt->recordLength = 65535;
			for (fieldNo = 0; fieldNo < ti->fieldCount; fieldNo++) ti->fieldInfo[fieldNo].offset = 65535;
  			}
			
		bufferTemplate(ipfixReceiver->templateBuffer, bt); 
		// FIXME: Template expiration disabled for debugging
		// bt->expires = time(0) + TEMPLATE_EXPIRE_SECS;

		int n;		
		for (n = 0; n < ipfixReceiver->callbackCount; n++) {
			CallbackInfo* ci = &ipfixReceiver->callbackInfo[n];
			if (ci->templateCallbackFunction) ci->templateCallbackFunction(ci->handle, sourceId, ti);
			}
  		}
	}
开发者ID:BackupTheBerlios,项目名称:vermont-svn,代码行数:51,代码来源:rcvIpfix.c

示例9: dbReaderDestroyTemplate

/**
 * get all tableNames in database that matches with the wildcard "h%"
 **/
int dbReaderDestroyTemplate(IpfixDbReader* ipfixDbReader, DataTemplateInfo* dataTemplateInfo)
{
	int n;
	DbReader* dbReader = ipfixDbReader->dbReader;

	for (n = 0; n != dbReader->callbackCount; n++) {
		CallbackInfo* ci = &dbReader->callbackInfo[n];
		if (ci->dataTemplateDestructionCallbackFunction) {
			ci->dataTemplateDestructionCallbackFunction(ci->handle, &ipfixDbReader->srcId,
							 dataTemplateInfo);
			msg(MSG_DEBUG,"IpfixDbReader destroyed template");
		}
	}

	free(dataTemplateInfo->fieldInfo);
	return 0;
}
开发者ID:BackupTheBerlios,项目名称:vermont-svn,代码行数:20,代码来源:IpfixDbReader.c

示例10: dbReaderSendNewTemplate

/**
 * Constructs a template from the table data and sends it to all connected
 * modules.
 */
int dbReaderSendNewTemplate(IpfixDbReader* ipfixDbReader,DataTemplateInfo* dataTemplateInfo, int table_index)
{
	int i,n;
	int fieldLength  = 0;

	DbReader* dbReader = ipfixDbReader->dbReader;
	DbData* dbData = dbReader->dbData;
	
	dataTemplateInfo->id =0;
	dataTemplateInfo->preceding= 0;	
	dataTemplateInfo->fieldCount = 0;
	dataTemplateInfo->fieldInfo = NULL;
	dataTemplateInfo->dataCount = 0;
	dataTemplateInfo->dataInfo = NULL;
	dataTemplateInfo->data = NULL;
	dataTemplateInfo->userData = NULL;
		
	/**get columnsname of the table*/
	if(getColumns(ipfixDbReader, table_index) != 0) {
		msg(MSG_ERROR,"IpfixDbReader: Could not get columns for template");
		return 1;
	}

	for(i = 0; i < dbData->colCount; i++) {			
		dataTemplateInfo->fieldCount++;
		dataTemplateInfo->fieldInfo = realloc(dataTemplateInfo->fieldInfo,
						      sizeof(FieldInfo)*dataTemplateInfo->fieldCount);
		FieldInfo* fi = &dataTemplateInfo->fieldInfo[dataTemplateInfo->fieldCount - 1];	
		fi->type.id = dbData->columns[i]->ipfixId;
		fi->type.length = dbData->columns[i]->length;
		fi->type.eid = 0;
		fi->offset = fieldLength;
		fieldLength = fieldLength + fi->type.length; 
	}

	for (n = 0; n != dbReader->callbackCount; n++) {
		CallbackInfo* ci = &dbReader->callbackInfo[n];
		if (ci->dataTemplateCallbackFunction) {
			ci->dataTemplateCallbackFunction(ci->handle, &ipfixDbReader->srcId,
							 dataTemplateInfo);
			msg(MSG_DEBUG,"IpfixDbReader sent template for table %s", dbData->tableNames[table_index]);
		}
	}
	return 0;
}
开发者ID:BackupTheBerlios,项目名称:vermont-svn,代码行数:49,代码来源:IpfixDbReader.c

示例11: getNamedItems

static v8::Handle<v8::Value> getNamedItems(HTMLAllCollection* collection, AtomicString name, const CallbackInfo& info)
{
    WillBeHeapVector<RefPtrWillBeMember<Element>> namedItems;
    collection->namedItems(name, namedItems);

    if (!namedItems.size())
        return v8Undefined();

    if (namedItems.size() == 1)
        return toV8(namedItems.at(0).release(), info.Holder(), info.GetIsolate());

    // FIXME: HTML5 specification says this should be a HTMLCollection.
    // http://www.whatwg.org/specs/web-apps/current-work/multipage/common-dom-interfaces.html#htmlallcollection
    //
    // FIXME: Oilpan: explicitly convert adopt()'s result so as to
    // disambiguate the (implicit) conversion of its
    // PassRefPtrWillBeRawPtr<StaticElementList> result -- the
    // other toV8() overload that introduces the ambiguity is
    // toV8(NodeList*, ...).
    //
    // When adopt() no longer uses transition types, the conversion
    // can be removed.
    return toV8(PassRefPtrWillBeRawPtr<NodeList>(StaticElementList::adopt(namedItems)), info.Holder(), info.GetIsolate());
}
开发者ID:kingysu,项目名称:blink-crosswalk,代码行数:24,代码来源:V8HTMLAllCollectionCustom.cpp

示例12: intCallbackC

	void intCallbackC(char *c1, char *c2, int i1, void *ciPtr, bool b, int i2, char *c3, int i3)
	{
		CallbackInfo *ci = (CallbackInfo *)ciPtr;
		ci->callback(c1, c2, i1, ci->callbackArg, b, i2, c3, i3);
	}
开发者ID:LucyScott,项目名称:mdsplus,代码行数:5,代码来源:Event.cpp

示例13: TestInterfaceNamedConstructorCreateDataProperty

static bool TestInterfaceNamedConstructorCreateDataProperty(v8::Local<v8::Name> name, v8::Local<v8::Value> v8Value, const CallbackInfo& info)
{
    ASSERT(info.This()->IsObject());
    return v8CallBoolean(v8::Local<v8::Object>::Cast(info.This())->CreateDataProperty(info.GetIsolate()->GetCurrentContext(), name, v8Value));
}
开发者ID:astojilj,项目名称:chromium-crosswalk,代码行数:5,代码来源:V8TestInterfaceNamedConstructor.cpp

示例14: processDataSet

/**
 * Processes an IPFIX data set.
 * Called by processMessage
 */
static void processDataSet(IpfixReceiver* ipfixReceiver, SourceID sourceId, IpfixSetHeader* set) {
	BufferedTemplate* bt = getBufferedTemplate(ipfixReceiver->templateBuffer, sourceId, ntohs(set->id));

	if(bt == 0) {
                /* this error may come in rapid succession; I hope I don't regret it */
		msg(MSG_INFO, "Template %d unknown to collecting process", ntohs(set->id));
		return;
	}
	
	#ifdef SUPPORT_NETFLOWV9
	if ((bt->setID == IPFIX_SetId_Template) || (bt->setID == NetflowV9_SetId_Template)) {
	#else
	if (bt->setID == IPFIX_SetId_Template) {
	#endif

		TemplateInfo* ti = bt->templateInfo;

		uint16_t length = ntohs(set->length)-((byte*)(&set->data)-(byte*)set);

		byte* record = &set->data;
	
		if (bt->recordLength < 65535) {
			byte* recordX = record+length;

			if (record >= recordX - (bt->recordLength - 1)) {
				DPRINTF("Got a Data Set that contained not a single full record\n");
			}

			/* We stop processing when no full record is left */
			while (record < recordX - (bt->recordLength - 1)) {
				int n;		
				for (n = 0; n < ipfixReceiver->callbackCount; n++) {
					CallbackInfo* ci = &ipfixReceiver->callbackInfo[n];
					if (ci->dataRecordCallbackFunction) ci->dataRecordCallbackFunction(ci->handle, sourceId, ti, bt->recordLength, record);
					}
				record = record + bt->recordLength;
				}
			} else {
			byte* recordX = record+length;

			if (record >= recordX - 3) {
				DPRINTF("Got a Data Set that contained not a single full record");
			}

			/* We assume that all variable-length records are >= 4 byte, so we stop processing when only 3 bytes are left */
			while (record < recordX - 3) {
				int recordLength=0;
				int i;
				for (i = 0; i < ti->fieldCount; i++) {
					int fieldLength = 0;
					if (ti->fieldInfo[i].type.length < 65535) {
						fieldLength = ti->fieldInfo[i].type.length;
						} else {
						if (*(byte*)record < 255) {
							fieldLength = *(byte*)record;
							} else {
							fieldLength = *(uint16_t*)(record+1);
							}
						}
					ti->fieldInfo[i].type.length = fieldLength;
					ti->fieldInfo[i].offset = recordLength;
					recordLength += fieldLength;
					}
				int n;		
				for (n = 0; n < ipfixReceiver->callbackCount; n++) {
					CallbackInfo* ci = &ipfixReceiver->callbackInfo[n];
					if (ci->dataRecordCallbackFunction) ci->dataRecordCallbackFunction(ci->handle, sourceId, ti, recordLength, record);
					}
				record = record + recordLength;
				}
			}
		} else 
	if (bt->setID == IPFIX_SetId_OptionsTemplate) {
  	
		OptionsTemplateInfo* ti = bt->optionsTemplateInfo;

		uint16_t length = ntohs(set->length)-((byte*)(&set->data)-(byte*)set);
		byte* record = &set->data;
	
		if (bt->recordLength < 65535) {
			byte* recordX = record+length;
			while (record < recordX) {
				int n;		
				for (n = 0; n < ipfixReceiver->callbackCount; n++) {
					CallbackInfo* ci = &ipfixReceiver->callbackInfo[n];
					if (ci->optionsRecordCallbackFunction) ci->optionsRecordCallbackFunction(ci->handle, sourceId, ti, bt->recordLength, record);
					}
				record = record + bt->recordLength;
				}
			} else {
			byte* recordX = record+length;
			while (record < recordX) {
				int recordLength=0;
				int i;
				for (i = 0; i < ti->scopeCount; i++) {
					int fieldLength = 0;
//.........这里部分代码省略.........
开发者ID:BackupTheBerlios,项目名称:vermont-svn,代码行数:101,代码来源:rcvIpfix.c

示例15: processDataTemplateSet

/**
 * Processes an IPFIX DataTemplate set.
 * Called by processMessage
 */
static void processDataTemplateSet(IpfixReceiver* ipfixReceiver, SourceID sourceId, IpfixSetHeader* set) {
	IpfixDataTemplateHeader* th = (IpfixDataTemplateHeader*)&set->data;
	byte* endOfSet = (byte*)set + ntohs(set->length);
	byte* record = (byte*)&th->data;

	/* DataTemplateSets are >= 4 byte, so we stop processing when only 3 bytes are left */
	while (record < endOfSet - 3) {
		BufferedTemplate* bt = (BufferedTemplate*)malloc(sizeof(BufferedTemplate));
		DataTemplateInfo* ti = (DataTemplateInfo*)malloc(sizeof(DataTemplateInfo));
		bt->sourceID = sourceId;
		bt->templateID = ntohs(th->templateId);
		bt->recordLength = 0;
		bt->setID = ntohs(set->id);
		bt->dataTemplateInfo = ti;
		ti->userData = 0;
		ti->fieldCount = ntohs(th->fieldCount);
		ti->dataCount = ntohs(th->dataCount);
		ti->fieldInfo = (FieldInfo*)malloc(ti->fieldCount * sizeof(FieldInfo));
		int isLengthVarying = 0;
		uint16_t fieldNo;
		for (fieldNo = 0; fieldNo < ti->fieldCount; fieldNo++) {
			ti->fieldInfo[fieldNo].type.id = ntohs(*(uint16_t*)((byte*)record+0));
			ti->fieldInfo[fieldNo].type.length = ntohs(*(uint16_t*)((byte*)record+2));
			ti->fieldInfo[fieldNo].offset = bt->recordLength; bt->recordLength+=ti->fieldInfo[fieldNo].type.length;
			if (ti->fieldInfo[fieldNo].type.length == 65535) isLengthVarying=1;
			if (ti->fieldInfo[fieldNo].type.id & 0x80) {
				ti->fieldInfo[fieldNo].type.eid = ntohl(*(uint32_t*)((byte*)record+4));
				record = (byte*)((byte*)record+8);
				} else {
				ti->fieldInfo[fieldNo].type.eid = 0;
				record = (byte*)((byte*)record+4);
				}
			}
		if (isLengthVarying) {
			bt->recordLength = 65535;
			for (fieldNo = 0; fieldNo < ti->fieldCount; fieldNo++) ti->fieldInfo[fieldNo].offset = 65535;
			}

		ti->dataInfo = (FieldInfo*)malloc(ti->fieldCount * sizeof(FieldInfo));
		for (fieldNo = 0; fieldNo < ti->dataCount; fieldNo++) {
			ti->dataInfo[fieldNo].type.id = ntohs(*(uint16_t*)((byte*)record+0));
			ti->dataInfo[fieldNo].type.length = ntohs(*(uint16_t*)((byte*)record+2));
			if (ti->dataInfo[fieldNo].type.id & 0x80) {
				ti->dataInfo[fieldNo].type.eid = ntohl(*(uint32_t*)((byte*)record+4));
				record = (byte*)((byte*)record+8);
				} else {
				ti->dataInfo[fieldNo].type.eid = 0;
				record = (byte*)((byte*)record+4);
				}
			}
		
		/* done with reading dataInfo, @c record now points to the fixed data block */
		byte* dataStart = record;
		
		int dataLength = 0;
		for (fieldNo = 0; fieldNo < ti->dataCount; fieldNo++) {
			ti->dataInfo[fieldNo].offset = dataLength;
			if (ti->dataInfo[fieldNo].type.length == 65535) {
				/* This is a variable-length field, get length from first byte and advance offset */
				ti->dataInfo[fieldNo].type.length = *(uint8_t*)(dataStart + ti->dataInfo[fieldNo].offset);
				ti->dataInfo[fieldNo].offset += 1;
				if (ti->dataInfo[fieldNo].type.length == 255) {
					/* First byte did not suffice, length is stored in next two bytes. Advance offset */
					ti->dataInfo[fieldNo].type.length = *(uint16_t*)(dataStart + ti->dataInfo[fieldNo].offset);
					ti->dataInfo[fieldNo].offset += 2;
					}
				}
			dataLength += ti->dataInfo[fieldNo].type.length;
			}
			
		/* Copy fixed data block */
		ti->data = (byte*)malloc(dataLength);
		memcpy(ti->data,dataStart,dataLength);

		/* Advance record to end of fixed data block, i.e. start of next template*/
		record += dataLength;
		
		bufferTemplate(ipfixReceiver->templateBuffer, bt); 
		// FIXME: Template expiration disabled for debugging
		// bt->expires = time(0) + TEMPLATE_EXPIRE_SECS;

		int n;		
		for (n = 0; n < ipfixReceiver->callbackCount; n++) {
			CallbackInfo* ci = &ipfixReceiver->callbackInfo[n];
			if (ci->dataTemplateCallbackFunction) ci->dataTemplateCallbackFunction(ci->handle, sourceId, ti);
			}
  		}
	}
开发者ID:BackupTheBerlios,项目名称:vermont-svn,代码行数:92,代码来源:rcvIpfix.c


注:本文中的CallbackInfo类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。