本文整理汇总了C++中serial函数的典型用法代码示例。如果您正苦于以下问题:C++ serial函数的具体用法?C++ serial怎么用?C++ serial使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了serial函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: serial
void cNPC::save()
{
if ( changed_ )
{
QSqlQuery * q;
if ( isPersistent )
q = cNPC::getUpdateQuery();
else
q = cNPC::getInsertQuery();
q->addBindValue( serial() );
q->addBindValue( summonTime_ ? summonTime_ - Server::instance()->time() : 0 );
q->addBindValue( additionalFlags_ );
q->addBindValue( owner_ ? owner_->serial() : INVALID_SERIAL );
q->addBindValue( stablemasterSerial_ );
q->addBindValue( aiid_ );
q->addBindValue( ( quint8 ) wanderType() );
q->addBindValue( wanderX1() );
q->addBindValue( wanderX2() );
q->addBindValue( wanderY1() );
q->addBindValue( wanderY2() );
q->addBindValue( wanderRadius() );
if ( isPersistent )
q->addBindValue( serial() );
if ( !q->exec() )
Console::instance()->log( LOG_ERROR, tr("Error saving NPC id %1, with server error: %2").arg( serial() ).arg( q->lastError().text() ) );
}
cBaseChar::save();
}
示例2: strcpy_s
void TellStick::aquireTellStick() {
char *tempSerial = new char[serial().size()+1];
#ifdef _WINDOWS
strcpy_s(tempSerial, serial().size()+1, serial().toLocal8Bit());
#else
strcpy(tempSerial, serial().toLocal8Bit());
int pid = 0x0C30;
if (type() == 2) {
pid = 0x0C31;
}
FT_SetVIDPID(0x1781, pid);
#endif
FT_STATUS ftStatus = FT_OpenEx(tempSerial, FT_OPEN_BY_SERIAL_NUMBER, &d->ftHandle);
delete tempSerial;
if (ftStatus != FT_OK) {
return;
}
//open = true;
if (type() == 2) {
FT_SetBaudRate(d->ftHandle, 115200);
} else {
FT_SetBaudRate(d->ftHandle, 9600);
}
FT_SetFlowControl(d->ftHandle, FT_FLOW_NONE, 0, 0);
FT_SetTimeouts(d->ftHandle,1000,0);
setUpgradeStep(2);
QTimer::singleShot(0, this, SLOT(enterBootloader()));
}
示例3: setTable
void cNPC::save()
{
if ( changed_ )
{
initSave;
setTable( "npcs" );
addField( "serial", serial() );
addField( "summontime", summonTime_ ? summonTime_ - Server::instance()->time() : 0 );
addField( "additionalflags", additionalFlags_ );
addField( "owner", owner_ ? owner_->serial() : INVALID_SERIAL );
addField( "stablemaster", stablemasterSerial_ );
addStrField( "ai", aiid_ );
addField( "wandertype", ( Q_UINT8 ) wanderType() );
addField( "wanderx1", wanderX1() );
addField( "wanderx2", wanderX2() );
addField( "wandery1", wanderY1() );
addField( "wandery2", wanderY2() );
addField( "wanderradius", wanderRadius() );
addCondition( "serial", serial() );
saveFields;
}
cBaseChar::save();
}
示例4: main
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
// This is a hack to prevent some OS to pause executing the program when the window is not visible
a.setQuitOnLastWindowClosed(false);
// The settings window allows the user to control the program
SettingsWindow window;
window.show();
// The Screen Analyzer class outputs a single color based on the image displayed on the screen
ScreenAnalyzer analyzer;
// LEDOS Talker communicates color from the Screen Analyzer to LEDOS
LEDOSTalker talker;
// Whenever the user "starts" the program, start the analysis thread
QObject::connect( &window, SIGNAL(start()), &analyzer, SLOT(start()) );
// And stop it when the user doesn't need it anymore
QObject::connect( &window, SIGNAL(stop()), &analyzer, SLOT(stop()) );
// Close the program when the window is closed
QObject::connect( &window, SIGNAL(quit()), &a, SLOT(quit()) );
// When a serial port is selected, update it in the LEDOS Talker instance
QObject::connect( &window, SIGNAL(serial(QString)), &talker, SLOT(serial(QString)) );
// Every time a color is ready to be sent pass it to the LEDOS Talker
QObject::connect( &analyzer, SIGNAL(color(QColor)), &talker, SLOT(color(QColor)) );
return a.exec();
}
示例5: serial
void cPlayer::save()
{
if ( changed_ )
{
QSqlQuery * q;
if ( isPersistent )
q = cPlayer::getUpdateQuery();
else
q = cPlayer::getInsertQuery();
q->addBindValue( serial() );
if ( account_ )
{
q->addBindValue( account_->login() );
}
else
{
q->addBindValue( QString() );
}
q->addBindValue( additionalFlags_ );
q->addBindValue( visualRange_ );
q->addBindValue( profile_ );
q->addBindValue( fixedLightLevel_ );
q->addBindValue( strengthLock_ );
q->addBindValue( dexterityLock_ );
q->addBindValue( intelligenceLock_ );
q->addBindValue( maxControlSlots_ );
if ( isPersistent )
q->addBindValue( serial() );
q->exec();
}
cBaseChar::save();
}
示例6: setTable
void cPlayer::save()
{
if ( changed_ )
{
initSave;
setTable( "players" );
addField( "serial", serial() );
if ( account_ )
{
addStrField( "account", account_->login() );
}
else
{
addStrField( "account", QString::null );
}
addField( "additionalflags", additionalFlags_ );
addField( "visualrange", visualRange_ );
addStrField( "profile", profile_ );
addField( "fixedlight", fixedLightLevel_ );
addField( "strlock", strengthLock_ );
addField( "dexlock", dexterityLock_ );
addField( "intlock", intelligenceLock_ );
addField( "maxcontrolslots", maxControlSlots_ );
addCondition( "serial", serial() );
saveFields;
}
cBaseChar::save();
}
示例7: setTable
void cNPC::save()
{
if ( changed_ )
{
initSave;
setTable( "npcs" );
addField( "serial", serial() );
addField( "mindamage", minDamage_);
addField( "maxdamage", maxDamage_);
addField( "tamingminskill", tamingMinSkill_);
addField( "summontime", summonTime_ ? summonTime_ - uiCurrentTime : 0 );
addField( "additionalflags", additionalFlags_ );
addField( "owner", owner_ ? owner_->serial() : INVALID_SERIAL );
addStrField( "carve", carve_);
addStrField( "spawnregion", spawnregion_);
addField( "stablemaster", stablemasterSerial_ );
addStrField( "lootlist", lootList_);
addStrField( "ai", aiid_ );
addField( "wandertype", (UINT8)wanderType() );
addField( "wanderx1", wanderX1() );
addField( "wanderx2", wanderX2() );
addField( "wandery1", wanderY1() );
addField( "wandery2", wanderY2() );
addField( "wanderradius", wanderRadius() );
addField( "fleeat", criticalHealth() );
addField( "spellslow", spellsLow_ );
addField( "spellshigh", spellsHigh_ );
addField( "controlslots", controlSlots_ );
addCondition( "serial", serial() );
saveFields;
}
cBaseChar::save();
}
示例8: serial
/*
* serialBit (inherited from IStream)
*/
void CMemStream::serialBit(bool &bit)
{
uint8 u;
if ( isReading() )
{
serial( u );
bit = (u!=0);
}
else
{
u = (uint8)bit;
serial( u );
}
}
示例9: getNumberOfEdges
// -----------------------------------------------------------------------------
//
// -----------------------------------------------------------------------------
void EdgeGeom::findDerivatives(DoubleArrayType::Pointer field, DoubleArrayType::Pointer derivatives, Observable* observable)
{
m_ProgressCounter = 0;
int64_t numEdges = getNumberOfEdges();
if (observable)
{
connect(this, SIGNAL(filterGeneratedMessage(const PipelineMessage&)),
observable, SLOT(broadcastPipelineMessage(const PipelineMessage&)));
}
#ifdef SIMPLib_USE_PARALLEL_ALGORITHMS
tbb::task_scheduler_init init;
bool doParallel = true;
#endif
#ifdef SIMPLib_USE_PARALLEL_ALGORITHMS
if (doParallel == true)
{
tbb::parallel_for(tbb::blocked_range<int64_t>(0, numEdges),
FindEdgeDerivativesImpl(this, field, derivatives), tbb::auto_partitioner());
}
else
#endif
{
FindEdgeDerivativesImpl serial(this, field, derivatives);
serial.compute(0, numEdges);
}
}
示例10: solaris_sysinfo
asmlinkage int solaris_sysinfo(int cmd, u32 buf, s32 count)
{
char *p, *q, *r;
char buffer[256];
int len;
/* Again, we cheat :)) */
switch (cmd) {
case SI_SYSNAME: r = "SunOS"; break;
case SI_HOSTNAME:
r = buffer + 256;
for (p = system_utsname.nodename, q = buffer;
q < r && *p && *p != '.'; *q++ = *p++);
*q = 0;
r = buffer;
break;
case SI_RELEASE: r = "5.6"; break;
case SI_MACHINE: r = machine(); break;
case SI_ARCHITECTURE: r = "sparc"; break;
case SI_HW_PROVIDER: r = "Sun_Microsystems"; break;
case SI_HW_SERIAL: r = serial(buffer); break;
case SI_PLATFORM: r = platform(buffer); break;
case SI_SRPC_DOMAIN: r = ""; break;
case SI_VERSION: r = "Generic"; break;
default: return -EINVAL;
}
len = strlen(r) + 1;
if (count < len) {
copy_to_user_ret((char *)A(buf), r, count - 1, -EFAULT);
__put_user_ret(0, (char *)A(buf) + count - 1, -EFAULT);
} else
copy_to_user_ret((char *)A(buf), r, len, -EFAULT);
return len;
}
示例11: receiver
PSMoveAPI::PSMoveAPI(EventReceiver *receiver, void *user_data)
: receiver(receiver)
, user_data(user_data)
, controllers()
{
std::map<std::string, std::vector<PSMove *>> moves;
int n = psmove_count_connected();
for (int i=0; i<n; i++) {
PSMove *move = psmove_connect_by_id(i);
char *tmp = psmove_get_serial(move);
std::string serial(tmp);
free(tmp);
moves[serial].emplace_back(move);
}
int i = 0;
for (auto &kv: moves) {
if (kv.second.size() == 2) {
// Have two handles for this controller (USB + Bluetooth)
controllers.emplace_back(new ControllerGlue(i++, kv.first, kv.second[0], kv.second[1]));
} else if (kv.second.size() == 1) {
// Have only one handle for this controller
controllers.emplace_back(new ControllerGlue(i++, kv.first, kv.second[0], nullptr));
} else {
// FATAL
}
}
}
示例12: setErrorCondition
// -----------------------------------------------------------------------------
//
// -----------------------------------------------------------------------------
void FindModulusMismatch::execute()
{
setErrorCondition(0);
dataCheckVoxel();
if(getErrorCondition() < 0) { return; }
dataCheckSurfaceMesh();
if(getErrorCondition() < 0) { return; }
#ifdef SIMPLib_USE_PARALLEL_ALGORITHMS
tbb::task_scheduler_init init;
bool doParallel = true;
#endif
int64_t numTriangles = m_SurfaceMeshFaceLabelsPtr.lock()->getNumberOfTuples();
#ifdef SIMPLib_USE_PARALLEL_ALGORITHMS
if (doParallel == true)
{
tbb::parallel_for(tbb::blocked_range<size_t>(0, numTriangles),
FindModulusMismatchImpl(m_SurfaceMeshFaceLabels, m_Moduli, m_SurfaceMeshDeltaModulus), tbb::auto_partitioner());
}
else
#endif
{
FindModulusMismatchImpl serial(m_SurfaceMeshFaceLabels, m_Moduli, m_SurfaceMeshDeltaModulus);
serial.generate(0, numTriangles);
}
notifyStatusMessage(getHumanLabel(), "Completed");
}
示例13: setErrorCondition
// -----------------------------------------------------------------------------
//
// -----------------------------------------------------------------------------
void TriangleNormalFilter::execute()
{
setErrorCondition(0);
dataCheck();
if(getErrorCondition() < 0) { return; }
DataContainer::Pointer sm = getDataContainerArray()->getDataContainer(getSurfaceMeshTriangleNormalsArrayPath().getDataContainerName());
TriangleGeom::Pointer triangleGeom = sm->getGeometryAs<TriangleGeom>();
#ifdef SIMPLib_USE_PARALLEL_ALGORITHMS
bool doParallel = true;
#endif
#ifdef SIMPLib_USE_PARALLEL_ALGORITHMS
if (doParallel == true)
{
tbb::parallel_for(tbb::blocked_range<size_t>(0, triangleGeom->getNumberOfTris()),
CalculateNormalsImpl(triangleGeom->getVertices(), triangleGeom->getTriangles(), m_SurfaceMeshTriangleNormals), tbb::auto_partitioner());
}
else
#endif
{
CalculateNormalsImpl serial(triangleGeom->getVertices(), triangleGeom->getTriangles(), m_SurfaceMeshTriangleNormals);
serial.generate(0, triangleGeom->getNumberOfTris());
}
/* Let the GUI know we are done with this filter */
notifyStatusMessage(getHumanLabel(), "Complete");
}
示例14: TEST
TEST(SubscriptionTests, decode_invalidLength_throwException)
{
SubscriptionManager subscriptionManager;
String serial("ABC");
EXPECT_THROW(subscriptionManager.decode(serial), XSubscription);
}
示例15: setErrorCondition
// -----------------------------------------------------------------------------
//
// -----------------------------------------------------------------------------
void ScaleVolume::updateSurfaceMesh()
{
setErrorCondition(0);
#ifdef DREAM3D_USE_PARALLEL_ALGORITHMS
tbb::task_scheduler_init init;
bool doParallel = true;
#endif
IGeometry2D::Pointer geom2D = getDataContainerArray()->getDataContainer(getSurfaceDataContainerName())->getGeometryAs<IGeometry2D>();
float* nodes = geom2D->getVertexPointer(0);
// First get the min/max coords.
float min[3] = { std::numeric_limits<float>::max(), std::numeric_limits<float>::max(), std::numeric_limits<float>::max() };
float max[3] = { std::numeric_limits<float>::min(), std::numeric_limits<float>::min(), std::numeric_limits<float>::min() };
int64_t count = geom2D->getNumberOfVertices();
for (int64_t i = 0; i < count; i++)
{
if (nodes[3 * i] > max[0])
{
max[0] = nodes[3 * i];
}
if (nodes[3 * i + 1] > max[1])
{
max[1] = nodes[3 * i + 1];
}
if (nodes[3 * i + 2] > max[2])
{
max[2] = nodes[3 * i + 2];
}
if (nodes[3 * i] < min[0])
{
min[0] = nodes[3 * i];
}
if (nodes[3 * i + 1] < min[1])
{
min[1] = nodes[3 * i + 1];
}
if (nodes[3 * i + 2] < min[2])
{
min[2] = nodes[3 * i + 2];
}
}
#ifdef DREAM3D_USE_PARALLEL_ALGORITHMS
if (doParallel == true)
{
tbb::parallel_for(tbb::blocked_range<size_t>(0, count),
UpdateVerticesImpl(nodes, min, m_ScaleFactor), tbb::auto_partitioner());
}
else
#endif
{
UpdateVerticesImpl serial(nodes, min, m_ScaleFactor);
serial.generate(0, count);
}
}