本文整理汇总了C++中sd函数的典型用法代码示例。如果您正苦于以下问题:C++ sd函数的具体用法?C++ sd怎么用?C++ sd使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了sd函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: sd
void indri::file::Path::remove( const std::string& path ) {
std::stack<indri::file::DirectoryIterator*> iterators;
indri::utility::StackDeleter<indri::file::DirectoryIterator> sd( iterators );
iterators.push( new indri::file::DirectoryIterator( path ) );
while( iterators.size() ) {
indri::file::DirectoryIterator* top = iterators.top();
// all done, so go up a level
if( (*top) == indri::file::DirectoryIterator::end() ) {
// release any search handles that may point
// to this directory
top->close();
int result = rmdir( top->base().c_str() );
if( result != 0 )
LEMUR_THROW( LEMUR_IO_ERROR, "indri::file::Path::remove couldn't remove directory '" + top->base() + "'." );
delete top;
iterators.pop();
continue;
}
std::string path = **top;
(*top)++;
if( indri::file::Path::isFile( path ) ) {
int result = lemur_compat::remove( path.c_str() );
if( result != 0 )
LEMUR_THROW( LEMUR_IO_ERROR, "indri::file::Path::remove couldn't remove file '" + path + "'." );
} else {
iterators.push( new indri::file::DirectoryIterator( path ) );
}
}
}
示例2: min_bucket
void STATS::short_print( //print stats table
FILE *, //Now uses tprintf instead
BOOL8 dump //dump full table
) {
inT32 index; //table index
inT32 min = min_bucket ();
inT32 max = max_bucket ();
if (buckets == NULL) {
/* err.log(RESULT_LOGICAL_ERROR,E_LOC,ERR_PRIMITIVES,
ERR_SCROLLING,ERR_CONTINUE,ERR_ERROR,
"Empty stats"); */
return;
}
if (dump) {
for (index = min; index <= max; index++) {
tprintf ("%4d:%-3d ", rangemin + index, buckets[index]);
if ((index - min) % 8 == 7)
tprintf ("\n");
}
tprintf ("\n");
}
tprintf ("Total count=%d\n", total_count);
tprintf ("Min=%d Really=%d\n", (inT32) (ile ((float) 0.0)), min);
tprintf ("Max=%d Really=%d\n", (inT32) (ile ((float) 1.1)), max);
tprintf ("Range=%d\n", max + 1 - min);
tprintf ("Lower quartile=%.2f\n", ile ((float) 0.25));
tprintf ("Median=%.2f\n", ile ((float) 0.5));
tprintf ("Upper quartile=%.2f\n", ile ((float) 0.75));
tprintf ("Mean= %.2f\n", mean ());
tprintf ("SD= %.2f\n", sd ());
}
示例3: sd
ServiceDescription ServiceDiscovery::getServiceDescription(const std::string& name)
{
bool found = false;
ServiceDescription sd("");
{
boost::unique_lock<boost::mutex> lock(mServicesMutex);
std::vector<ServiceDiscovery*>::iterator it;
for(it = msServiceDiscoveries.begin(); it != msServiceDiscoveries.end(); it++)
{
try {
ServiceConfiguration conf = (*it)->getConfiguration();
if(conf.getName() == name)
{
sd = conf;
found = true;
break;
}
} catch(...)
{
// ignore errors
}
}
}
if(!found)
{
char buffer[512];
snprintf(buffer, 512, "Could not find service: %s\n", name.c_str());
throw std::runtime_error(std::string(buffer));
}
return sd;
}
示例4: sd
void ListaCursor::newCursor(int valor)
{
int temp = sd();
disponibles[temp] = disponibles[0];
bdd[disponibles[0]].numero = valor;
disponibles[0] = bdd[disponibles[0]].next;
bdd[disponibles[temp]].next = -1;
}
示例5: sd
void DisassemblerView::showSegments()
{
SegmentsDialog sd(this->_listing, this);
int res = sd.exec();
if(res == SegmentsDialog::Accepted && sd.selectedSegment())
ui->disassemblerWidget->jumpTo(sd.selectedSegment());
}
示例6: TEST
TEST(JsonTest, LoadInvalidKey)
{
ScopedDevice sd(sample_invalid_key);
ASSERT_EQ(sd.device, nullptr);
ASSERT_EQ(sd.error.type, MB_DEVICE_JSON_UNKNOWN_KEY);
ASSERT_STREQ(sd.error.context, ".foo");
}
示例7: main
int main(int argc, char **argv)
{
QApplication app( argc, argv);
app.setFont( QFont( "helvetica", 18));
KDMShutdown sd( 0, 0,"Hej", "echo shutdown", "echo restart");
app.setMainWidget( &sd);
return sd.exec();
}
示例8: ts
void Background::draw() {
ci::gl::clear(mSettings.mBackgroundColor);
if (mTexture) {
ci::gl::color(1, 1, 1, 1);
ci::gl::ScopedTextureBind ts(mTexture);
ci::gl::ScopedDepth sd(false);
mBatch->draw();
}
}
示例9: assert
// o+o+o+o+o+o+o+o+o+o+o+o+o+o+o+o+o+o+o+o+o+o+o+o+o+o+o+o+o+o+o+o
void
BRTKernelDef::print(std::ostream& out, int) const
{
char name[1024];
if (Project::gDebug) {
out << "/* BRTKernelDef:" ;
location.printLocation(out) ;
out << " */" << std::endl;
}
assert(FunctionName());
assert(FunctionName()->entry);
assert(FunctionName()->entry->scope);
/* If the symbol for the generated assembly code already
** exists, don't generate the assembly. This allows the user
** to hand generate the code.
*/
#define PRINT_CODE(a,b) \
sprintf (name, "__%s_%s", FunctionName()->name.c_str(), #b); \
if (!FunctionName()->entry->scope->Lookup(name)) { \
if (globals.target & TARGET_##a) { \
BRTKernelCode *var; \
var = decl->isReduce() ? new BRT##a##ReduceCode(*this) : \
new BRT##a##KernelCode(*this); \
out << *var << std::endl; \
delete var; \
} else { \
out << "static const char *__" \
<< *FunctionName() << "_" << #b << "= NULL;\n"; \
} \
}
PRINT_CODE(PS20, ps20);
PRINT_CODE(FP30, fp30);
PRINT_CODE(ARB, arb);
PRINT_CODE(CPU, cpu);
#undef PRINT_CODE
/*
* XXX I have no idea why this is here instead of in
* BRTCPUKernel::print(). It's CPU only and needs to be suppressed when
* the CPU target is suppressed. --Jeremy.
* The scatter functions need to be there whether or not the CPU target is repressed
* For the fallback requirement --Daniel
*/
if (decl->isReduce()) {
BRTCPUReduceCode crc(*this);
BRTScatterDef sd(*crc.fDef);
sd.print(out,0);
// this is needed for CPU fallback for scatter whether or not CPU is enabled
}
printStub(out);
}
示例10: SaveStateDescriptor
SaveStateDescriptor AdlMetaEngine::querySaveMetaInfos(const char *target, int slot) const {
Common::String fileName = Common::String::format("%s.s%02d", target, slot);
Common::InSaveFile *inFile = g_system->getSavefileManager()->openForLoading(fileName);
if (!inFile)
return SaveStateDescriptor();
if (inFile->readUint32BE() != MKTAG('A', 'D', 'L', ':')) {
delete inFile;
return SaveStateDescriptor();
}
byte saveVersion = inFile->readByte();
if (saveVersion != SAVEGAME_VERSION) {
delete inFile;
return SaveStateDescriptor();
}
char name[SAVEGAME_NAME_LEN] = { };
inFile->read(name, sizeof(name) - 1);
inFile->readByte();
if (inFile->eos() || inFile->err()) {
delete inFile;
return SaveStateDescriptor();
}
SaveStateDescriptor sd(slot, name);
int year = inFile->readUint16BE();
int month = inFile->readByte();
int day = inFile->readByte();
sd.setSaveDate(year + 1900, month + 1, day);
int hour = inFile->readByte();
int minutes = inFile->readByte();
sd.setSaveTime(hour, minutes);
uint32 playTime = inFile->readUint32BE();
sd.setPlayTime(playTime);
if (inFile->eos() || inFile->err()) {
delete inFile;
return SaveStateDescriptor();
}
Graphics::Surface *thumbnail;
if (!Graphics::loadThumbnail(*inFile, thumbnail)) {
delete inFile;
return SaveStateDescriptor();
}
sd.setThumbnail(thumbnail);
delete inFile;
return sd;
}
示例11: sd
QString SupportDialog::getHost( QWidget *parent )
{
SupportDialog sd( parent );
if( sd.exec() == Accepted )
{
return sd.ui->hostEdit->text();
}
return QString();
}
示例12: sd
void MainApp::OnFatalException()
{
#ifndef __APPLE__
#ifndef _DEBUG
SLADEStackTrace st;
st.WalkFromException();
SLADECrashDialog sd(st);
sd.ShowModal();
#endif
#endif
}
示例13: if
str::seq LexicalAnnotation::lines(size_t i, size_t f) const {
if (!this->bfptr) {
return str::seq();
} else if (this->bfptr->first) {
std::ifstream fd(this->bfptr->second);
return slurpLines(fd, i, f);
} else {
std::istringstream sd(this->bfptr->second);
return slurpLines(sd, i, f);
}
}
示例14: sd
integer_t ScalarDialog::getScalar(QWidget *parent, const QString &title, const QString &description)
{
ScalarDialog sd(parent);
sd.setWindowTitle(title);
sd.setDescription(description);
if(sd.exec() == ScalarDialog::Accepted)
return sd.value();
return UINT64_MAX;
}
示例15: CreateServer
void CreateServer()
{
if (m_Peer == NULL)
Initialize();
RakNet::SocketDescriptor sd(SERVER_PORT, 0);
m_Peer->Startup(MAX_CLIENTS, &sd, 1);
m_IsServer = true;
m_Peer->SetMaximumIncomingConnections(MAX_CLIENTS);
}