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


C++ DataContainer类代码示例

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


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

示例1: while

int AIMNetManager::GrabCapabilityStuff( DataContainer block ) {

	int ret = 0;
	int offset = 0;

	while( offset < block.length() ) {
		for( int32 i = 0; i < (int32)(sizeof(AIMCaps)/16); ++i ) {
			if( DataContainer(AIMCaps[i],16) == block.getrange(offset,16) ) {
				switch(i) {
					case 0: ret |= CAPS_BUDDYICON;
						break;
					case 1: ret |= CAPS_VOICE;
						break;
					case 2: ret |= CAPS_IMIMAGE;
						break;
					case 3: ret |= CAPS_CHAT;
						break;
					case 4: ret |= CAPS_GETFILE;
						break;
					case 5: ret |= CAPS_SENDFILE;
						break;
					default: ret |= 0xff00;
						break;
				}
			}
		}
		offset += 16;
	}
	return ret;
}
开发者ID:HaikuArchives,项目名称:BeAIM,代码行数:30,代码来源:AIMInfoFunctions.cpp

示例2: operator

    void operator()(ThreadParams& params,
                const std::string& name, T_Scalar* value,
                const std::string& attrName = "", T_Attribute* attribute = nullptr)
    {
        log<picLog::INPUT_OUTPUT>("HDF5: read %1%D scalars: %2%") % simDim % name;

        Dimensions domain_offset(0, 0, 0);
        for (uint32_t d = 0; d < simDim; ++d)
            domain_offset[d] = Environment<simDim>::get().GridController().getPosition()[d];

        // avoid deadlock between not finished pmacc tasks and mpi calls in adios
        __getTransactionEvent().waitForFinished();

        DomainCollector::DomDataClass data_class;
        DataContainer *dataContainer =
            params.dataCollector->readDomain(params.currentStep,
                                               name.c_str(),
                                               Domain(domain_offset, Dimensions(1, 1, 1)),
                                               &data_class);

        typename traits::PICToSplash<T_Scalar>::type splashType;
        *value = *static_cast<T_Scalar*>(dataContainer->getIndex(0)->getData());
        __delete(dataContainer);

        if(!attrName.empty())
        {
            log<picLog::INPUT_OUTPUT>("HDF5: read attribute %1% for scalars: %2%") % attrName % name;
            params.dataCollector->readAttributeInfo(params.currentStep, name.c_str(), attrName.c_str()).read(attribute, sizeof(T_Attribute));
            log<picLog::INPUT_OUTPUT>("HDF5: attribute %1% = %2%") % attrName % *attribute;
        }
    }
开发者ID:ALaDyn,项目名称:picongpu,代码行数:31,代码来源:NDScalars.hpp

示例3: setLinkLossAlertLevel

void setLinkLossAlertLevel()
{

    if (!link_loss_connected) {
        qDebug() << "XXXX not yet connected to the link loss service so ignoring alert request from user";
        return;
    }

    qDebug() << "XXXX BluetoothHandler::setLinkLossAlertLevel()";

    uint8_t level[] = { 0 };
    // we set the level to HIGH
    level[0] = 2;

    errno= 0;

    DataContainer* dc = DataContainer::getInstance();

    int link_loss_service_instance = dc->getLinkLossServiceInstance();
    uint16_t alert_level_value_handle = dc->getLinkLossAlertLevelValueHandle();

    qDebug() << "XXXX setting link loss service alert level with bt_gatt_write_value_noresp. alert_service_instance=" << link_loss_service_instance;

    if (bt_gatt_write_value_noresp(link_loss_service_instance, alert_level_value_handle, 0, level, sizeof(level)) == EOK) {
        qDebug() << "XXXX BluetoothHandler::setLinkLossAlertLevel() - value written successfully";
    } else {
        qDebug() << "XXXX BluetoothHandler::setLinkLossAlertLevel() - errno=(" << errno<< ") :" << strerror(errno);
    }
}
开发者ID:rascyber,项目名称:Cascades-Community-Samples,代码行数:29,代码来源:BluetoothHandler.cpp

示例4: btEvent

void btEvent(const int event, const char *bt_addr, const char *event_data)
{

    Q_UNUSED(bt_addr)

    QString event_name = btEventName(event);
    qDebug() << "XXXX bluetooth event:" << event_name;

    if (event_data != NULL) {
        QString event_data_str = QString(*event_data);
        qDebug() << "XXXX BT event_data=" << event_data_str;
    } else {
        qDebug() << "XXXX BT event_data=NULL";
    }

    if (event == BT_EVT_LE_DEVICE_CONNECTED) {
        _handler->emitSignalInfoMessage("Device has connected");
        DataContainer *dc = DataContainer::getInstance();
        dc->setDeviceConnected(true);
        _handler->emitSignalLinkEstablished();
        return;
    }

    if (event == BT_EVT_LE_DEVICE_DISCONNECTED) {
        _handler->emitSignalInfoMessage("Device has disconnected");
        device_information_connected = false;
        DataContainer *dc = DataContainer::getInstance();
        dc->setDeviceConnected(false);
        dc->setDeviceInformationServiceInstance(0);
        _handler->emitSignalLostLink();
        return;
    }
}
开发者ID:26filip,项目名称:Cascades-Community-Samples,代码行数:33,代码来源:BluetoothHandler.cpp

示例5: readTxPowerLevel

void readTxPowerLevel()
{

    DataContainer* dc = DataContainer::getInstance();
    uint8_t *tx_power_level;
    tx_power_level = (uint8_t*) malloc(sizeof(uint8_t));

    // The Transmit Power Level characteristic represents the current transmit power level in dBm, and the level ranges from -100 dBm to +20 dBm to a
    // resolution of 1 dBm.
    //
    // Units of dBm are decibels relative to 1 mW of power, hence, 0 dBm 1 mW.
    // 1/100 mW is -20 dBm and 100 mW is +20 dBm. Powers less than 1 mW are always negative dBm values, and powers greater than
    // 1 mW are always positive.

    errno= 0;
    int result = bt_gatt_read_value(dc->getTxPowerServiceInstance(), dc->getTxPowerLevelValueHandle(), 0, tx_power_level, sizeof(uint8_t), 0);
    if (result < 0) {
        qDebug() << "XXXX bt_gatt_read_value - errno=(" << errno<< ") :" << strerror(errno);
    }

    int power_level_dbm = *tx_power_level;
    if (power_level_dbm > 128) {
        power_level_dbm = 255 - power_level_dbm;
    }

    dc->setTxPowerLevel(power_level_dbm);

    free(tx_power_level);

    qDebug() << "XXXX read TX power level. result=" << result << " : tx_power_level=" << *tx_power_level << " : power_level_dbm=" << power_level_dbm;
}
开发者ID:rascyber,项目名称:Cascades-Community-Samples,代码行数:31,代码来源:BluetoothHandler.cpp

示例6: BMessage

// Receive message function
void AIMNetManager::ReceiveMessage( SNAC_Object& snac ) {

	short i = 10;
	unsigned short temp, temp2;
	unsigned int languageValue;
	bool autoRespond = false;
	BMessage* incomingMsg = new BMessage(BEAIM_INCOMING_IM);
	DataContainer msg;
	
	// Grab the other person's info
	DecodeBuddyStuff( snac.data, i, incomingMsg );

	// This will be either 0x0002 or 0x0004 (autorespond mode?)
	temp = (unsigned short)GetWord( snac.data, i );
	i += 2;
	if( temp == 0x0004 ) {
		temp = (unsigned short)GetWord( snac.data, i );		// 0x0000
		temp = (unsigned short)GetWord( snac.data, i+2 );	// 0x0002
		autoRespond = true;
		i += 4;
	}

	if( autoRespond )
		printf( "AutoResponded IM...\n" );
	incomingMsg->AddBool( "autorespond", autoRespond );

	// Reality check
	if( temp != 0x0002 )
		printf( "RECV_MESSAGE ERROR: temp should be 0x0002, not 0x%X!\n", temp );
	
	// Get the message length (with 0x0D tacked on), and fixed value 0x0501
	temp = (unsigned short)GetWord( snac.data, i );
	temp = (unsigned short)GetWord( snac.data, i+2 );
	i += 4;
	
	// Another reality check
	if( temp != 0x0501 )
		printf( "RECV_MESSAGE ERROR: temp should be 0x0501, not 0x%X!\n", temp );
	
	// Grab the mysterious language value
	temp = (unsigned short)GetWord( snac.data, i );
	temp2 = (unsigned short)GetWord( snac.data, temp + i + 8 );
	languageValue = (temp2 << 16) + (unsigned short)GetWord( snac.data, temp + i + 6 );
	incomingMsg->AddInt32( "languagevalue", (int32)languageValue );
	i += 2;	
	
	printf( "Mysterious Language value: 0x%X\n", (unsigned)languageValue );
	
	// Get the message itself
	msg = snac.data.getrange( temp + i + 8 );
	msg << char(0);
	incomingMsg->AddString( "message", (char*)msg.c_ptr() );
	
	printf( "actual message: %s\n", msg.c_ptr() );
	
	// Send the message off its final resting place... the great bit-bucket in the sky
	incomingMsg->AddInt32( "wtype", (int32)USER_MESSAGE_TYPE );
	PostAppMessage( incomingMsg );
}
开发者ID:HaikuArchives,项目名称:BeAIM,代码行数:60,代码来源:AIMInfoFunctions.cpp

示例7: LoadAction

	void ActionCode::LoadAction( size_t actIndex )
	{
		DataContainer *container = _controls->GetContainer();
		size_t locIndex = _locPage->GetLocationIndex();
		_pathPicTxtCtrl->setText(container->GetActionPicturePath(locIndex, actIndex));
        _editor->setPlainText(container->GetActionCode(locIndex, actIndex));
		setEnabled(true);
	}
开发者ID:Nex-Otaku,项目名称:QtQGen,代码行数:8,代码来源:actioncode.cpp

示例8: qDebug

void BtDeviceInfo::getInfo(QString device_addr, QString device_name) {
	qDebug() << "YYYY getting info from device " << device_addr;

	DataContainer* dc = DataContainer::getInstance();
	dc->setCurrentDeviceAddr(device_addr);
	dc->setCurrentDeviceName(device_name);

	_handler->getInfo();

}
开发者ID:26filip,项目名称:Cascades-Community-Samples,代码行数:10,代码来源:BtDeviceInfo.cpp

示例9: startedScanningForDevices

void DevicesManager::findBleDevices()
{
    emit startedScanningForDevices();

    bb::system::SystemToast toast;
    toast.setBody("Searching for Bluetooth LE devices ... please wait until search has completed ...");
    toast.setPosition(bb::system::SystemUiPosition::MiddleCenter);
    toast.show();

    if (!bt_initialised) {

        // Initialise the Bluetooth device and allocate the required resources for the library. Specify a call back function for Bluetooth events.
        bt_device_init(btEvent);
        // make sure the Bluetooth radio is switched on
        if (!bt_ldev_get_power()) {
            bt_ldev_set_power(true);
        }
        bt_initialised = true;
    }

    DataContainer *dc = DataContainer::getInstance();
    dc->clearDeviceList();
    // note that this is a blocking call. For each device discovered however, a call back is made to btEvent with event type BT_EVT_DEVICE_ADDED
    bt_disc_start_inquiry(BT_INQUIRY_GIAC);

    bt_remote_device_t **remoteDeviceArray = 0;
    bt_remote_device_t *remoteDevice = 0;

    remoteDeviceArray = bt_disc_retrieve_devices(BT_DISCOVERY_ALL, 0);

    int device_count;
    device_count=0;

    if (remoteDeviceArray) {
        for (int i = 0; (remoteDevice = remoteDeviceArray[i]); ++i) {
            const int deviceType = bt_rdev_get_type(remoteDevice);
            if ((deviceType == BT_DEVICE_TYPE_LE_PUBLIC) || (deviceType == BT_DEVICE_TYPE_LE_PRIVATE)) {
                device_count++;
                DevicesManager::getDevicesManager()->extractAndStoreBleDeviceAttributes(remoteDevice);
            }
            bt_rdev_free(remoteDevice);
        }
//        qDebug() << "YYYY DevicesManager::findBleDevices() - freeing buffer";
//        if (remoteDeviceArray) {
//            bt_rdev_free_array(remoteDeviceArray);
//        }
    }

    qDebug() << "XXXX number of devices found=" << device_count;
    dc->setDeviceCount(device_count);

    emit setDeviceCount(QVariant(device_count));
    emit finishedScanningForDevices();

}
开发者ID:26filip,项目名称:Cascades-Community-Samples,代码行数:55,代码来源:DevicesManager.cpp

示例10: rint

void AIMNetManager::ReceiveWarning( SNAC_Object& snac ) {

	BString warnMessage;
	char strNewWLevel[15];
	unsigned short wLevel, i=0;
	DataContainer screenName;
	bool anon = false;
	char snLength;

	wLevel = (unsigned short)( rint( (double)GetWord(snac.data,i) / 10.0 ) );
	i += 2;
	
	printf( "New warning level: %u%%\n", wLevel );
	printf( "... came from " );
	
	// 'twas an anonymous warning
	if( i >= snac.data.length() ) {
		anon = true;
		printf( "Anonymous\n" );
	}
	
	// grab the length, and then the screen name
	if( !anon ) {
		snLength = snac.data[i++];
		screenName = DataContainer( snac.data.getrange(i,snLength) );
		i += snLength;

		screenName << char(0);
		printf( "%s\n", screenName.c_ptr() );
	}
	
	// is our warning level going DOWN? if so, don't annoy the user by telling them about it
	if( wLevel < client->WarningLevel() ) {
		client->SetWarningLevel( wLevel );
		return;
	}

	// make the "warned" message
	client->SetWarningLevel( wLevel );
	sprintf( strNewWLevel, "%u%%", wLevel );
	warnMessage = BString( Language.get("ERR_GOT_WARNED") );
	warnMessage.ReplaceAll( "%WLEVEL", strNewWLevel );
	if( anon ) {
		BString anonLabel = "[";
		anonLabel.Append( Language.get("ANONYMOUS_LABEL") );
		anonLabel.Append( "]" );
		warnMessage.ReplaceAll( "%USER", anonLabel.String() );
	} else
		warnMessage.ReplaceAll( "%USER", screenName.c_ptr() );
	
	// now display it
	windows->ShowMessage( warnMessage, B_STOP_ALERT, Language.get("BEHAVE_LABEL"), WS_WARNED );
}
开发者ID:HaikuArchives,项目名称:BeAIM,代码行数:53,代码来源:AIMInfoFunctions.cpp

示例11: tick

	void MoveSystem::tick(DataContainer& data, float dt, FlowEvents& events) {
		PRS("MS::tick");
		SystemBits* connections = data.getConnections();		
		PRS("MS::tick::move");
		int* pos = m_Pos;
		int* vel = m_Vel;
		for (int i = 0; i < data.size(); ++i) {
			if (isConnected(connections[i])) {
				*pos += *vel * dt;
			}
			++pos;
			++vel;
		}
		PRE("MS::tick::move");
		PRE("MS::tick");
	}
开发者ID:amecky,项目名称:diesel2D,代码行数:16,代码来源:System.cpp

示例12: fill

void Reader::fill(DataContainer &container) {
    _dataFile.open(_filename.data());
    if (!_dataFile.is_open()) {
        std::cerr << "Failed to open file!" << std::endl;
        return;
    }

    time_t start, end;
    string strBuf;

    int nCounter = 0;
    int nID = 0;
    Object *pObject = 0;
    time(&start);
    while (_dataFile.good()) {
        getline(_dataFile, strBuf);
        if (strBuf.length() == 0)
            break;
        pObject = parseObject(strBuf, nID);
        container.add(nID, &pObject);
        nCounter++;
        if (nCounter % 10000 == 0)
            cout << nCounter << " lines read!" << endl;
    }
    time(&end);
    float dif = difftime(end, start);
    printf("Done! Processing %i lines took %.2lf seconds\r\n", nCounter, dif);
    _dataFile.close();
}
开发者ID:orestv,项目名称:Magister-code,代码行数:29,代码来源:Reader.cpp

示例13: renderImageImpl

    void SliceExtractor::renderImageImpl(DataContainer& dataContainer, const ImageRepresentationGL::ScopedRepresentation& img) {

        // prepare OpenGL
        _shader->activate();
        cgt::TextureUnit inputUnit, tfUnit;
        img->bind(_shader, inputUnit);
        p_transferFunction.getTF()->bind(_shader, tfUnit);

        cgt::mat4 identity = cgt::mat4::identity;

        _shader->setUniform("_texCoordsMatrix", _texCoordMatrix);
        _shader->setUniform("_modelMatrix", identity);
        _shader->setUniform("_viewMatrix", _viewMatrix);
        _shader->setUniform("_projectionMatrix", identity);
        _shader->setUniform("_useTexturing", true);
        _shader->setUniform("_useSolidColor", true);

        // render slice
        FramebufferActivationGuard fag(this);
        createAndAttachColorTexture();
        createAndAttachDepthTexture();
        glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
        QuadRdr.renderQuad();

        if (p_renderCrosshair.getValue())
            renderCrosshair(img);

        renderGeometry(dataContainer, img);

        _shader->deactivate();
        cgt::TextureUnit::setZeroUnit();

        dataContainer.addData(p_targetImageID.getValue(), new RenderData(_fbo));
    }
开发者ID:tusharuiit,项目名称:2014-2015_HiwiMedicalXTTVisualization,代码行数:34,代码来源:sliceextractor.cpp

示例14: updateResult

    void MultiVolumeRaycaster::updateResult(DataContainer& dataContainer) {
        ImageRepresentationGL::ScopedRepresentation image1(dataContainer, p_sourceImage1.getValue());
        ImageRepresentationGL::ScopedRepresentation image2(dataContainer, p_sourceImage2.getValue());
        ImageRepresentationGL::ScopedRepresentation image3(dataContainer, p_sourceImage3.getValue());
        ScopedTypedData<CameraData> camera(dataContainer, p_camera.getValue());
        ScopedTypedData<RenderData> geometryImage(dataContainer, p_geometryImageId.getValue(), true);
        ScopedTypedData<LightSourceData> light(dataContainer, p_lightId.getValue());

        std::vector<const ImageRepresentationGL*> images;
        if (image1) {
            images.push_back(image1);

            if (getInvalidationLevel() & INVALID_VOXEL_HIERARCHY1){
                _vhm1->createHierarchy(image1, p_transferFunction1.getTF());
                validate(INVALID_VOXEL_HIERARCHY1);
            }
        }
        if (image2) {
            images.push_back(image2);

            if (getInvalidationLevel() & INVALID_VOXEL_HIERARCHY2){
                _vhm2->createHierarchy(image2, p_transferFunction2.getTF());
                validate(INVALID_VOXEL_HIERARCHY2);
            }
        }
        if (image3) {
            images.push_back(image3);

            if (getInvalidationLevel() & INVALID_VOXEL_HIERARCHY3){
                _vhm3->createHierarchy(image3, p_transferFunction3.getTF());
                validate(INVALID_VOXEL_HIERARCHY3);
            }
        }
        

        if (images.size() >= 3 && camera != nullptr) {
            auto eepp = computeEntryExitPoints(images, camera, geometryImage);
            dataContainer.addData(p_outputImageId.getValue() + ".entrypoints", eepp.first);
            dataContainer.addData(p_outputImageId.getValue() + ".exitpoints", eepp.second);

            auto rc = performRaycasting(dataContainer, images, camera, eepp.first, eepp.second, light);
            dataContainer.addData(p_outputImageId.getValue(), rc);
        }
        else {
            LDEBUG("No suitable input data found!");
        }
    }
开发者ID:tusharuiit,项目名称:2014-2015_HiwiMedicalXTTVisualization,代码行数:47,代码来源:multivolumeraycaster.cpp

示例15: qDebug

void BluetoothHandler::getInfo()
{

    qDebug() << "YYYY getInfo()";

// connect to the device information service
// read the various characteristic values

    if (!bt_initialised) {
        qDebug() << "Bluetooth libraries are not initialised!";
        return;
    }

    bt_gatt_conn_parm_t conParm;
    conParm.minConn = 0x30;
    conParm.maxConn = 0x50;
    conParm.latency = 0;
    conParm.superTimeout = 50;

    errno= 0;

    DataContainer* dc = DataContainer::getInstance();
    QString device_addr = dc->getCurrentDeviceAddr();

// connect to the device information service

    int function_result = 0;
    int retry_count = 0;

    _handler->emitSignalInfoMessage("Connecting to Device Information Service");

    /* BEGIN WORKAROUND - Temporary fix to address race condition */
    do {
        function_result = bt_gatt_connect_service(device_addr.toAscii().constData(), DEVICE_INFORMATION_SERVICE_UUID, NULL, &conParm, this);
        retry_count++;
        delay(50);
    } while ((retry_count < 50) && (function_result == -1) && (errno== EBUSY));

    if (function_result < 0) {
        qDebug() << "YYYY GATT connect service request DEVICE_INFORMATION_SERVICE_UUID failed: " + QString::number(errno) + " (" + QString(strerror(errno)) + ")";
        Utilities::alert("GATT connect service request DEVICE_INFORMATION_SERVICE_UUID failed: " + QString::number(errno));
    } else {
        qDebug() << "YYYY requested connection to DEVICE_INFORMATION_SERVICE_UUID OK";
    }

}
开发者ID:26filip,项目名称:Cascades-Community-Samples,代码行数:46,代码来源:BluetoothHandler.cpp


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