本文整理汇总了C++中ds函数的典型用法代码示例。如果您正苦于以下问题:C++ ds函数的具体用法?C++ ds怎么用?C++ ds使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了ds函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ds
void RemoteClient::readHeader()
{
QDataStream ds(&m_buffer, QIODevice::ReadOnly);
qint32 type;
ds >> type;
ds >> m_msgSize;
switch (type)
{
case RemoteControl::Sync:
cmd = new RemoteControls::Sync(this);
break;
default:
m_sock->close();
return;
}
cmd->setManager(m_manager);
m_header = true;
}
示例2: ds
void Server::handleData(QTcpSocket* socket, QByteArray data) {
QDataStream ds(&data, QIODevice::ReadWrite);
WhiteNetwork::Message type;
ds >> type;
if(type == WhiteNetwork::Message::RegisterClient) {
client_socket = socket;
qDebug() << "Client";
start_time = std::chrono::system_clock::now();
sendJobs();
}
else if(type == WhiteNetwork::Message::RegisterWorker) {
workers_sockets.push_back(socket);
qDebug() << "Worker";
}
else if(type == WhiteNetwork::Message::PixelsData) {
collectResult(ds);
}
else if(type == WhiteNetwork::Message::JobDone) {
sendJob(socket);
}
}
示例3: dr
bool ON_SpaceMorph::Ev1Der(
ON_3dPoint rst,
ON_3dPoint& xyz,
ON_3dVector& Dr,
ON_3dVector& Ds,
ON_3dVector& Dt
) const
{
// This is a quick estimate of the derivative.
// Space morphs that are used to deform smooth breps
// should override this function.
double d = 1.0e-6;
double e = 1.0/d;
ON_3dPoint P;
ON_3dPoint dr(rst.x+d,rst.y,rst.z);
ON_3dPoint ds(rst.x,rst.y+d,rst.z);
ON_3dPoint dt(rst.x,rst.y,rst.z+d);
P = MorphPoint(rst);
Dr = e*(MorphPoint(dr) - P);
Ds = e*(MorphPoint(ds) - P);
Dt = e*(MorphPoint(dt) - P);
return true;
}
示例4: file
void FQTermHttp::httpRead(qint64 done, qint64 total) {
QByteArray ba = netreply_->readAll();
QFile file(cacheFileName_);
if (file.open(QIODevice::ReadWrite | QIODevice::Append)) {
QDataStream ds(&file);
ds.writeRawData(ba, ba.size());
file.close();
}
if (total != 0) {
//m_pDialog->setProgress(done,total);
int p = done *100 / total;
if (p - lastPercent_ >= 10 && isPreview_ && QFileInfo(cacheFileName_).suffix().toLower() == "jpg") {
if (!previewEmitted) {
emit previewImage(cacheFileName_,true, false);
previewEmitted = true;
} else {
emit previewImage(cacheFileName_,false, false);
}
lastPercent_ = p;
}
emit percent(p);
}
}
示例5: write_attribute
inline typename boost::enable_if<boost::mpl::and_<is_array<T>, boost::is_fundamental<typename T::value_type> >, void>::type
write_attribute(H5::H5Object const& object, std::string const& name, T const& value)
{
typedef typename T::value_type value_type;
enum { size = T::static_size };
H5::Attribute attr;
try {
H5XX_NO_AUTO_PRINT(H5::AttributeIException);
attr = object.openAttribute(name);
if (!has_type<T>(attr) || !has_extent<T>(attr)) {
// recreate attribute with proper type and size
object.removeAttr(name);
throw H5::AttributeIException();
}
}
catch (H5::AttributeIException const&) {
hsize_t dim[1] = { size };
H5::DataSpace ds(1, dim);
attr = object.createAttribute(name, ctype<value_type>::hid(), ds);
}
attr.write(ctype<value_type>::hid(), &*value.begin());
}
示例6: main
int main(int argv, char** args) {
QApplication app(argv, args);
QLocalSocket sock;
QObject::connect(&sock, &QLocalSocket::readyRead, [&sock]() {
qint64 bytesAvailable = sock.bytesAvailable();
QByteArray buffer = sock.readAll();
QDataStream ds(buffer);
while (bytesAvailable > 0) {
int num;
ds >> num;
qDebug("received %d", num);
bytesAvailable -= 4;
if (num == 1) {
sendData(sock, 2);
sendData(sock, -1);
} else if (num == 3) {
sendData(sock, -3);
}
}
});
示例7: ds
Foam::scalar Foam::equationReader::getScalarSrcDictSourceDScalar
(
const equationReader * eqnReader,
const label equationIndex,
const label equationOperationIndex,
const label maxStoreIndex,
const label storageOffset
) const
{
dimensionedScalar ds("noSource", dimless, 0.0);
const equation& eqn(operator[](equationIndex));
const equationOperation& eqOp(eqn[equationOperationIndex]);
label zeroSourceIndex = mag(eqOp.sourceIndex()) - 1;
word varName(dictLookups_[eqOp.dictLookupIndex()]);
ITstream srcStrm
(
dictSources_[zeroSourceIndex].lookup(varName)
);
srcStrm >> ds;
return ds.value() * sign(eqOp.sourceIndex());
}
示例8: infoFile
bool QDSDataStore::add( const QUniqueId& id )
{
// Update info file (in an atomic fashion)
QDSLockedFile infoFile( infoFileName( id ) );
if ( !infoFile.exists() ) {
qLog(DataSharing) << "QDSDataStore::add - info file doesn't exist";
return false;
}
int refCount = 0;
int transCount = 0;
QString type;
if ( infoFile.openLocked( QIODevice::ReadWrite ) ) {
QDataStream ds(&infoFile);
ds >> refCount;
ds >> transCount;
ds >> type;
infoFile.seek( 0 );
ds << refCount + 1;
ds << transCount;
ds << type;
infoFile.close();
} else {
示例9: OpenImageGroup
/* decoded base64 stream to put on mysql row , file or network streams */
QList<SPics> OpenImageGroup( const QString datastream_base64 )
{
QList<SPics> li;
QByteArray xcode("");
xcode.append(datastream_base64);
quint32 magic, version;
QByteArray bytes(QByteArray::fromBase64(xcode)); /* decoded base64 string to QByteArray */
QBuffer buffer(&bytes);
if (!buffer.open(QIODevice::ReadOnly)) {
return li;
}
QDataStream ds(&buffer);
/* place header */
ds.setVersion(QDataStream::Qt_4_2);
ds >> magic;
if ( (quint32)SPics::MAGICNUMBER != magic ) {
qDebug() << "######## SPics::MAGICNUMBER not ok ";
buffer.close();
return li;
}
ds >> version;
if ( (quint32)SPics::VERSION != version ) {
qDebug() << "######## SPics::VERSION not ok ";
buffer.close();
return li;
}
SPics appoint;
/* place header */
while (!ds.atEnd()) {
ds >> appoint;
li.append(appoint);
}
buffer.close();
return li;
}
示例10: cmd_dynsym
/**
* Display the dynamic symbol table
*/
int cmd_dynsym()
{
elfshsect_t *sct;
elfsh_Sym *dynsym;
regex_t *tmp;
int num;
char logbuf[BUFSIZ];
PROFILER_IN(__FILE__, __FUNCTION__, __LINE__);
dynsym = elfsh_get_dynsymtab(world.curjob->curfile, &num);
if (dynsym == NULL)
RET(-1);
else
{
sct = elfsh_get_section_by_name(world.curjob->curfile,
ELFSH_SECTION_NAME_ALTDYNSYM,
NULL, NULL, &num);
if (!sct)
sct = elfsh_get_section_by_type(world.curjob->curfile, SHT_DYNSYM, 0,
NULL, NULL, &num);
if (!sct)
RET(-1);
num = num / sizeof(elfsh_Sym);
}
snprintf(logbuf, BUFSIZ - 1,
" [DYNAMIC SYMBOL TABLE]\n [Object %s]\n [Section %s]\n",
world.curjob->curfile->name, sct->name);
revm_output(logbuf);
FIRSTREGX(tmp);
PROFILER_ROUT(__FILE__, __FUNCTION__, __LINE__,
ds(world.curjob->curfile, sct,
num, tmp, elfsh_get_dynsymbol_name));
}
示例11: main
int main(int argc, char **argv)
{
if (!parse_arg(argc, argv)) {
print_help(argc, argv);
return EXIT_FAILURE;
}
// libMesh::LibMeshInit init(argc, argv);
libMesh::LibMeshInit init(1, argv); // set argc to 1 to supress PETSc warnings.
Condor2Dataset ds(init.comm());
ds.PrintInfo();
ds.OpenDataFile(filename_in);
if (!ds.Valid()) {
fprintf(stderr, "Invalid input data.\n");
return EXIT_FAILURE;
}
VortexExtractor extractor;
extractor.SetDataset(&ds);
extractor.SetGaugeTransformation(!nogauge);
ds.LoadTimeStep(T0, 0);
extractor.ExtractFaces(0);
for (int t=T0+span; t<T0+T; t+=span) {
ds.LoadTimeStep(t, 1);
extractor.ExtractEdges();
extractor.ExtractFaces(1);
extractor.RotateTimeSteps();
// extractor.TraceOverTime();
// extractor.TraceVirtualCells();
// extractor.SaveVortexLines(filename_out);
}
return EXIT_SUCCESS;
}
示例12: ds
void kio_digikamdates::special(const QByteArray& data)
{
bool folders = (metaData("folders") == "true");
KUrl kurl;
QString filter;
QDataStream ds(data);
ds >> kurl;
kDebug() << "Entered kio_digikamdates::special";
Digikam::DatabaseParameters dbParameters(kurl);
QDBusConnection::sessionBus().registerService(QString("org.kde.digikam.KIO-digikamtags-%1")
.arg(QString::number(QCoreApplication::instance()->applicationPid())));
Digikam::DatabaseAccess::setParameters(dbParameters);
if (folders)
{
QMap<QDateTime, int> dateNumberMap = Digikam::DatabaseAccess().db()->getAllCreationDatesAndNumberOfImages();
QByteArray ba;
QDataStream os(&ba, QIODevice::WriteOnly);
os << dateNumberMap;
SlaveBase::data(ba);
}
else
{
Digikam::ImageLister lister;
lister.setListOnlyAvailable(metaData("listOnlyAvailableImages") == "true");
// send data every 200 images to be more responsive
Digikam::ImageListerSlaveBasePartsSendingReceiver receiver(this, 200);
lister.list(&receiver, kurl);
// send rest
receiver.sendData();
}
finished();
}
示例13: tr
QString QcepDatasetModel::indexDescription(const QModelIndex &index) const
{
if (index.isValid()) {
QcepDataObject* obj = static_cast<QcepDataObject*>(index.internalPointer());
if (obj) {
return tr("(%1,%2,\"%3\")")
.arg(index.row()).arg(index.column())
.arg(obj->get_Name());
} else {
QcepDatasetPtr ds(m_Dataset);
if (ds) {
return tr("(%1,%2,\"%3\")")
.arg(index.row()).arg(index.column())
.arg(ds->get_Name());
} else {
return "";
}
}
}
return tr("(%1,%2,null)").arg(index.row()).arg(index.column());
}
示例14: main
int main()
{
mem_fun_name::value.reserve(100);
mem_fun_email::value.reserve(100);
benchmark::Person t;
t.set_id(100);
t.set_name("Name");
t.set_email("[email protected]");
aj::deserializer<> ds;
fas::nanospan start = fas::process_nanotime();
for (size_t i = 0; i < TOTAL_OP; ++i)
{
*( ds( fasproto_json(), t, fas::range(buffer) ) )='\0';
}
fas::nanospan finish = fas::process_nanotime();
std::cout << finish - start;
std::clog << std::endl
<< t.id() << std::endl
<< t.name() << std::endl
<< t.email() << std::endl;
return 0;
}
示例15: ds
// constructor from data
void LagrangianDSTest::testBuildLagrangianDS5()
{
std::cout << "--> Test: constructor 5." <<std::endl;
std::string plugin = "TestPlugin:computeMass";
SP::DynamicalSystem ds(new LagrangianDS(13, *q0, *velocity0, plugin));
double time = 1.5;
ds->initialize("TimeStepping", time);
CPPUNIT_ASSERT_EQUAL_MESSAGE("testBuildLagrangianDS5A : ", Type::value(*ds) == Type::LagrangianDS, true);
CPPUNIT_ASSERT_EQUAL_MESSAGE("testBuildLagrangianDS5B : ", ds->number() == 13, true);
CPPUNIT_ASSERT_EQUAL_MESSAGE("testBuildLagrangianDS5D : ", std11::static_pointer_cast<LagrangianDS>(ds)->getNdof() == 3, true);
CPPUNIT_ASSERT_EQUAL_MESSAGE("testBuildLagrangianDS5L : ", std11::static_pointer_cast<LagrangianDS>(ds)->getMass() == (*mass), true);
map<string, bool> isPl = ds->getIsPlugin();
CPPUNIT_ASSERT_EQUAL_MESSAGE("testBuildLagrangianDS5M : ", isPl["mass"], true);
CPPUNIT_ASSERT_EQUAL_MESSAGE("testBuildLagrangianDS5Q : ", isPl["fExt"], false);
CPPUNIT_ASSERT_EQUAL_MESSAGE("testBuildLagrangianDS5R : ", isPl["fInt"], false);
CPPUNIT_ASSERT_EQUAL_MESSAGE("testBuildLagrangianDS5S : ", isPl["fGyr"], false);
CPPUNIT_ASSERT_EQUAL_MESSAGE("testBuildLagrangianDS5T : ", isPl["jacobianFIntq"], false);
CPPUNIT_ASSERT_EQUAL_MESSAGE("testBuildLagrangianDS5T : ", isPl["jacobianFIntVelocity"], false);
CPPUNIT_ASSERT_EQUAL_MESSAGE("testBuildLagrangianDS5T : ", isPl["jacobianFGyrq"], false);
CPPUNIT_ASSERT_EQUAL_MESSAGE("testBuildLagrangianDS5T : ", isPl["jacobianFGyrVelocity"], false);
std::cout << "--> Constructor 5 test ended with success." <<std::endl;
}