本文整理汇总了C++中destination函数的典型用法代码示例。如果您正苦于以下问题:C++ destination函数的具体用法?C++ destination怎么用?C++ destination使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了destination函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: LOG_DEBUG
void UdpSearcher::search() {
try{
LOG_DEBUG("UdpSearcher::search start search");
//¹ã²¥µØÖ·
//LOG_DEBUG("UdpSearcher::search send msg to %s", addr_broadcast.to_string().c_str());
udp::endpoint destination(address::from_string("255.255.255.255"), NET_BROADCAST_PORT);
boost::array<char, 1> send_buf = { 0 };
socket_.send_to(boost::asio::buffer(send_buf), destination);
socket_.async_receive_from(boost::asio::buffer(recvBuf),senderEndpoint,0 ,boost::bind(&UdpSearcher::reciveHandle, this,
boost::asio::placeholders::error, boost::asio::placeholders::bytes_transferred));
timer_.expires_from_now(boost::posix_time::seconds(5));
timer_.async_wait(boost::bind(&UdpSearcher::timeoutHandle, this, boost::asio::placeholders::error));
ioServicePool_.start();
}
catch(std::exception& e) {
LOG_ERROR("UdpSearcher::search error : %s ", e.what());
}
}
示例2: source
void QUtilityData::saveColorImage(const std::string& fileName, const glm::uvec2& scale)
{
QImage source(fileName.c_str());
source = source.scaled(source.width() / scale.x, source.height() / scale.y);
int width = source.width();
int height = source.height();
std::vector<cl_uchar4> destination(width * height);
cl_uchar4* ptrDestination = destination.data();
for (int y = 0; y < height; y++)
for (int x = 0; x < width; x++)
{
QRgb label = source.pixel(x, y);
ptrDestination->s[0] = qRed(label);
ptrDestination->s[1] = qGreen(label);
ptrDestination->s[2] = qBlue(label);
ptrDestination->s[3] = qAlpha(label);
ptrDestination++;
};
QIO::saveFileData(fileName + QGCSetting::extColor, destination.data(), destination.size() * sizeof(cl_uchar4));
}
示例3: qCDebug
bool SharePlugin::receivePackage(const NetworkPackage& np)
{
/*
//TODO: Write a test like this
if (np.type() == PACKAGE_TYPE_PING) {
qCDebug(KDECONNECT_PLUGIN_SHARE) << "sending file" << (QDesktopServices::storageLocation(QDesktopServices::HomeLocation) + "/.bashrc");
NetworkPackage out(PACKAGE_TYPE_SHARE);
out.set("filename", mDestinationDir + "itworks.txt");
AutoClosingQFile* file = new AutoClosingQFile(QDesktopServices::storageLocation(QDesktopServices::HomeLocation) + "/.bashrc"); //Test file to transfer
out.setPayload(file, file->size());
device()->sendPackage(out);
return true;
}
*/
qCDebug(KDECONNECT_PLUGIN_SHARE) << "File transfer";
if (np.hasPayload()) {
//qCDebug(KDECONNECT_PLUGIN_SHARE) << "receiving file";
const QString filename = np.get<QString>("filename", QString::number(QDateTime::currentMSecsSinceEpoch()));
const QUrl dir = destinationDir().adjusted(QUrl::StripTrailingSlash);
QUrl destination(dir.toString() + '/' + filename);
if (destination.isLocalFile() && QFile::exists(destination.toLocalFile())) {
destination = QUrl(dir.toString() + '/' + KIO::suggestName(dir, filename));
}
FileTransferJob* job = np.createPayloadTransferJob(destination);
job->setDeviceName(device()->name());
connect(job, SIGNAL(result(KJob*)), this, SLOT(finished(KJob*)));
KIO::getJobTracker()->registerJob(job);
job->start();
} else if (np.has("text")) {
示例4: ASSERT
ScriptPromise AudioContext::suspendContext(ScriptState* scriptState)
{
ASSERT(isMainThread());
AutoLocker locker(this);
ScriptPromiseResolver* resolver = ScriptPromiseResolver::create(scriptState);
ScriptPromise promise = resolver->promise();
if (contextState() == Closed) {
resolver->reject(
DOMException::create(InvalidStateError, "Cannot suspend a context that has been closed"));
} else {
// Stop rendering now.
if (destination())
stopRendering();
// Since we don't have any way of knowing when the hardware actually stops, we'll just
// resolve the promise now.
resolver->resolve();
}
return promise;
}
示例5: sizeof
void BlendBench::unalignedBlendArgb32()
{
const int dimension = 1024;
uchar *dstMemory = static_cast<uchar*>(::malloc(dimension * dimension * sizeof(quint32)));
QImage destination(dstMemory, dimension, dimension, QImage::Format_ARGB32_Premultiplied);
destination.fill(0x12345678); // avoid special cases of alpha
uchar *srcMemory = static_cast<uchar*>(::malloc((dimension * dimension * sizeof(quint32)) + 16));
QFETCH(int, offset);
uchar *imageSrcMemory = srcMemory + (offset * sizeof(quint32));
QImage src(imageSrcMemory, dimension, dimension, QImage::Format_ARGB32_Premultiplied);
src.fill(0x87654321);
QPainter painter(&destination);
QBENCHMARK {
painter.drawImage(QPoint(), src);
}
::free(srcMemory);
::free(dstMemory);
}
示例6: destination
// ---------------------------------------------------------------------------
// CStunTurnTests::TestSetSendingStatusUDPL
// ---------------------------------------------------------------------------
//
void CStunTurnTests::TestSetSendingStatusUDPL()
{
TInetAddr inetAddr;
iWrapper->OutgoingAddr( inetAddr );
iWrapper->SetIncomingAddrL( inetAddr );
TInetAddr destination( KTestAddress, KTestServerPort );
RDebug::Print( _L( "\nTEST CASE: Set Sending Status Active" ) );
iNat.SetSendingStateL( iIfStub.LocalCandidateL(), EStreamingStateActive,
destination );
iIfStub.StartActiveSchedulerL( KRunningTime );
RDebug::Print( _L( "\nTEST CASE: Set Sending Status Passive" ) );
iNat.SetSendingStateL( iIfStub.LocalCandidateL(), EStreamingStatePassive,
destination );
iIfStub.StartActiveSchedulerL( KRunningTime );
}
示例7: source
void CCell::UpdateView()
{
Helper * help = Helper::Instance();
if( isVisible && unit != s_original )
{
QImage source( ":/" + help->GetItemNameByState( hextype ) );
QImage destination( ":/" + help->GetItemNameByState( unit ) );
//destination = destination.scaled( button->width(), button->height() );
QPainter resultPainter(&source);
resultPainter.setCompositionMode( QPainter::CompositionMode_SourceOver );
resultPainter.drawImage( 0, 0, destination );
resultPainter.end();
button->setIcon( QIcon( QPixmap::fromImage( source ) ) );
}
else
{
button->setIcon( QIcon(":/" + help->GetItemNameByVisible( isVisible, hextype ) ) );
//button->setText( "1" );
}
}
示例8: destination
void jumpTableEntry::print() {
if (is_unused()) {
std->print_cr("Unused {next = %d}", (int) destination());
return;
}
if (is_nmethod_stub()) {
std->print("Nmethod stub ");
Disassembler::decode(jump_inst_addr(), state_addr());
nmethod* nm = method();
if (nm) {
nm->key.print();
} else {
std->print_cr("{not pointing to nmethod}");
}
return;
}
if (is_block_closure_stub()) {
std->print("Block closure stub");
Disassembler::decode(jump_inst_addr(), state_addr());
nmethod* nm = block_nmethod();
if (nm) {
nm->key.print();
} else {
std->print_cr("{not compiled yet}");
}
return;
}
if (is_link()) {
std->print_cr("Link for:");
jumpTable::jump_entry_for_at(link(), 0)->print();
return;
}
fatal("unknown jump table entry");
}
示例9: TEST_F
/// Graphical validations for Exponential variate generator.
/// @note Important! For this to work and files to be generated, this test must be run *outside* of VS 2013 Gtest plugin. This plugin redirects outputs.
TEST_F(ExponentialTrafficGeneratorTest, ExponentialGraphsGenerators) {
std::shared_ptr<Message> source(new Message("This is a dummy entity for source."));
std::shared_ptr<Message> destination(new Message("This is a dummy entity for destination."));
std::shared_ptr<Message> tokenContents(new Message("This is a dummy Token contents."));
unsigned int seed = 1;
std::shared_ptr<Token> token(nullptr);
std::ofstream outputFile; // Output file handle.
int numberOfSamples = 300000; // Number of samples to generate for variate. Generate about 300,000 here such that the lambda = 0.5 approximates better the pdf equation.
std::map<std::string, ExponentialTrafficGenerator> exponentialGeneratorMap; // Map to control exponential generator instances and their output filenames. (String comes first because the key must be constant.)
// Set the fixed seed.
simulatorGlobals.seedRandomNumberGenerator(seed);
// Create exponential generators and populate maps with their references and output files.
exponentialGeneratorMap.insert(std::pair<std::string, ExponentialTrafficGenerator>("exponential_Lambda0.5.csv",
ExponentialTrafficGenerator(simulatorGlobals, scheduler, EventType::TRAFFIC_GENERATOR_ARRIVAL, tokenContents, source, destination, 1, 1.0/0.5)));
exponentialGeneratorMap.insert(std::pair<std::string, ExponentialTrafficGenerator>("exponential_Lambda1.0.csv",
ExponentialTrafficGenerator(simulatorGlobals, scheduler, EventType::TRAFFIC_GENERATOR_ARRIVAL, tokenContents, source, destination, 1, 1.0)));
exponentialGeneratorMap.insert(std::pair<std::string, ExponentialTrafficGenerator>("exponential_Lambda1.5.csv",
ExponentialTrafficGenerator(simulatorGlobals, scheduler, EventType::TRAFFIC_GENERATOR_ARRIVAL, tokenContents, source, destination, 1, 1/1.5)));
exponentialGeneratorMap.insert(std::pair<std::string, ExponentialTrafficGenerator>("exponential_Lambda3.0.csv",
ExponentialTrafficGenerator(simulatorGlobals, scheduler, EventType::TRAFFIC_GENERATOR_ARRIVAL, tokenContents, source, destination, 1, 1/3.0)));
// Now generate all exponential samples for each generator.
for (auto &exponentialGeneratorMapIterator : exponentialGeneratorMap) {
// Turn on generator.
exponentialGeneratorMapIterator.second.turnOn();
// Open file for output.
outputFile.open(exponentialGeneratorMapIterator.first);
// Generate samples.
for (int i = 0; i < numberOfSamples; ++i) {
exponentialGeneratorMapIterator.second.createInstanceTrafficEvent();
outputFile << scheduler.cause().occurAfterTime << std::endl;
}
outputFile.close();
}
}
示例10: origin
void HelloWorld::drawPath(const std::vector<TileData*>& path)
{
this->removeChildByName(DrawNodeStr);
DrawNode* drawNode = DrawNode::create();
Size mapSize = m_gamemap->getMapSize();
Size tilesize = m_gamemap->getTileSize();
int mapheight = mapSize.height * tilesize.height;
int origin_x = path[0]->position().first * tilesize.width + tilesize.width / 2;
int origin_y = path[0]->position().second * tilesize.height + tilesize.height / 2;
Vec2 origin(origin_x, mapheight - origin_y);
for (int index = 1; index < path.size(); ++index)
{
int destination_x = path[index]->position().first * tilesize.width + tilesize.width / 2;
int destination_y = path[index]->position().second * tilesize.height + tilesize.height / 2;
Vec2 destination(destination_x, mapheight - destination_y);
drawNode->drawLine(origin, destination, Color4F(0.0, 1.0, 0.0, 1.0));
origin = destination;
}
this->addChild(drawNode, 0, DrawNodeStr);
}
示例11: strip_quotes
static Character const* __cdecl strip_quotes(Character const* const source) throw()
{
// Count the number of quotation marks in the string, and compute the length
// of the string, in case we need to allocate a new string:
size_t quote_count = 0;
size_t source_length = 0;
for (Character const* it = source; *it; ++it)
{
if (*it == '\"')
++quote_count;
++source_length;
}
// No quotes? No problem!
if (quote_count == 0)
return nullptr;
size_t const destination_length = source_length - quote_count + 1;
__crt_unique_heap_ptr<Character> destination(_calloc_crt_t(Character, destination_length));
if (destination.get() == nullptr)
return nullptr;
// Copy the string, stripping quotation marks:
Character* destination_it = destination.get();
for (Character const* source_it = source; *source_it; ++source_it)
{
if (*source_it == '\"')
continue;
*destination_it++ = *source_it;
}
*destination_it = '\0';
return destination.detach();
}
示例12: CV_Assert
void MaskFilterBase::Process( cv::Mat& srcImage, cv::Mat& destImage )
{
CV_Assert( srcImage.depth() != sizeof(uchar) );
CV_Assert( srcImage.rows == destImage.rows );
CV_Assert( srcImage.cols == destImage.cols );
switch( srcImage.channels() )
{
case 1:
CV_Assert(false);
case 3:
cv::Mat_<cv::Vec3b> source = srcImage;
cv::Mat_<cv::Vec3b> destination = destImage;
for ( int j = 1; j < srcImage.cols - 1; ++j )
{
for (int i = 1; i < srcImage.rows - 1; ++i )
destination( i, j ) = Filter( source, i, j, m_mask );
}
break;
}
}
示例13: setDestination
void MPG321::goEvent( SProcessEvent *event )
{
if( !event->address().isEmpty() )
setDestination( event->address() );
QStringList arguments;
arguments << "-v";
arguments << "--rate";
arguments << "44100";
arguments << "--stereo";
arguments << "--buffer";
arguments << "3072";
arguments << "--resync";
arguments << "-w";
arguments << destination();
arguments << source();
p->used_command.clear();
p->used_command = application() + " ";
for( int i=0 ; i<arguments.count() ; i++ )
{
QString str = arguments.at(i);
if( str.contains(" ") )
str = "\"" + str + "\"";
p->used_command = p->used_command + str + " ";
}
p->log_str = p->used_command;
emit itemicLogAdded( MPG321::Information , p->used_command );
p->process->start( application() , arguments );
p->timer->start( 25 );
p->clock->start( 1000 );
}
示例14: ShareJob
Plasma::ServiceJob *ShareService::createJob(const QString &operation,
QMap<QString, QVariant> ¶meters)
{
return new ShareJob(destination(), operation, parameters, this);
}
示例15: showError
void ShareJob::start()
{
//KService::Ptr service = KService::serviceByStorageId("plasma-share-pastebincom.desktop");
KService::Ptr service = KService::serviceByStorageId(destination());
if (!service) {
showError(i18n("Could not find the provider with the specified destination"));
return;
}
QString pluginName =
service->property("X-KDE-PluginInfo-Name", QVariant::String).toString();
const QString path =
KStandardDirs::locate("data", "plasma/shareprovider/" + pluginName + '/' );
if (path.isEmpty()) {
showError(i18n("Invalid path for the requested provider"));
return;
}
m_package = new Plasma::Package(path, ShareProvider::packageStructure());
if (m_package->isValid()) {
const QString mainscript =
m_package->path() + m_package->structure()->contentsPrefixPaths().at(0) +
m_package->structure()->path("mainscript");
if (!QFile::exists(mainscript)) {
showError(i18n("Selected provider does not have a valid script file"));
return;
}
const QString interpreter =
Kross::Manager::self().interpreternameForFile(mainscript);
if (interpreter.isEmpty()) {
showError(i18n("Selected provider does not provide a supported script file"));
return;
}
m_action = new Kross::Action(parent(), pluginName);
if (m_action) {
m_provider = new ShareProvider(this);
connect(m_provider, SIGNAL(readyToPublish()), this, SLOT(publish()));
connect(m_provider, SIGNAL(finished(QString)),
this, SLOT(showResult(QString)));
connect(m_provider, SIGNAL(finishedError(QString)),
this, SLOT(showError(QString)));
// automatically connects signals and slots with the script
m_action->addObject(m_provider, "provider",
Kross::ChildrenInterface::AutoConnectSignals);
// set the main script file and load it
m_action->setFile(mainscript);
m_action->trigger();
// check for any errors
if(m_action->hadError()) {
showError(i18n("Error trying to execute script"));
return;
}
// do the work together with the loaded plugin
const QStringList functions = m_action->functionNames();
if (!functions.contains("url") || !functions.contains("contentKey") ||
!functions.contains("setup")) {
showError(i18n("Could not find all required functions"));
return;
}
// call the methods from the plugin
const QString url =
m_action->callFunction("url", QVariantList()).toString();
m_provider->setUrl(url);
// setup the method (get/post)
QVariant vmethod;
if (functions.contains("method")) {
vmethod =
m_action->callFunction("method", QVariantList()).toString();
}
// default is POST (if the plugin does not specify one method)
const QString method = vmethod.isValid() ? vmethod.toString() : "POST";
m_provider->setMethod(method);
// setup the provider
QVariant setup = m_action->callFunction("setup", QVariantList());
// get the content from the parameters, set the url and add the file
// then we can wait the signal to publish the information
const QString contentKey =
m_action->callFunction("contentKey", QVariantList()).toString();
const QString content(parameters()["content"].toString());
m_provider->addPostFile(contentKey, content);
}
}
}