本文整理汇总了C++中Disk类的典型用法代码示例。如果您正苦于以下问题:C++ Disk类的具体用法?C++ Disk怎么用?C++ Disk使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Disk类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: QFETCH
void TestFlacon::testOutFormatEncoderArgs()
{
QFETCH(QString, formatId);
QFETCH(SettingsValues, config);
QFETCH(QString, expected);
applySettings(config);
foreach (OutFormat *format, OutFormat::allFormats())
{
if (format->id() != formatId)
continue;
Disk *disk = standardDisk();
QStringList args = format->encoderArgs(disk->track(0), "OutFile.wav");
QString result = args.join(" ");
if (result != expected)
{
QString msg = QString("Compared values are not the same\n Format %1\n Actual: %2\n Expected: %3").arg(
formatId,
result,
expected);
QFAIL(msg.toLocal8Bit());
}
return;
}
FAIL(QString("Unknown format \"%1\"").arg(formatId).toLocal8Bit());
}
示例2: shiftLeft
void shiftLeft(int start, int end, int diskCount, Queue<int> board[])
{
int onePeg = start - 1;
int otherPeg = end - 1;
int steps = 0;
double totalSteps = pow(2.0, (double)diskCount) - 1;
Disk test;
while(steps < totalSteps)
{
bool cases = (board[onePeg].isEmpty() || board[onePeg].peek() > board[otherPeg].peek()) ? true : false;
makeValidMove(board[onePeg], board[otherPeg]);
test.displayQueue(19, 20, board[0]);
test.displayQueue(19, 40, board[1]);
test.displayQueue(19, 60, board[2]);
delay_output(DELAY);
if(cases)
board[onePeg].prioritize(board[onePeg].seek(board[onePeg].size()-1));
else
board[otherPeg].prioritize(board[otherPeg].seek(board[otherPeg].size()-1));
onePeg = (onePeg == 2) ? 0 : onePeg + 1;
otherPeg = (otherPeg == 2) ? 0 : otherPeg + 1;
steps++;
test.displayQueue(19, 20, board[0]);
test.displayQueue(19, 40, board[1]);
test.displayQueue(19, 60, board[2]);
delay_output(DELAY);
}
}
示例3: father
/**
* @brief BTRecordFile::readRecordFromDiskTest
* @param pDisk
* @param pRecordID
* Hace la lectura de un registro en la RAM
*/
void BTRecordFile::readRecordFromDiskTest(Disk pDisk, unsigned short pRecordID)
{
const char *padre = pDisk.read(this->_metadataPtr->getFirstRecordPos(), 7);
const char *hizq = pDisk.read(this->_metadataPtr->getFirstRecordPos() + 8, 7);
const char *hder = pDisk.read(this->_metadataPtr->getFirstRecordPos() + 16, 7);
std::string father(padre); // obtiene el padre
std::string HI(hizq); // obtiene el hijo izq
std::string HD(hder); // obtiene el hijo der
unsigned short _sizeCounter = this->_metadataPtr->getFirstRecordPos() + 24; // inicio de la data
DLL<IRecordDataType*> *tmp1 = _metadataPtr->getRecordStruct();
DLLNode<IRecordDataType*> *tmp = tmp1->getHeadPtr();
const char *data;
cout << "Binario " << father << " " << HI << " " << HD << endl;
std::string P = _conversion->binaryToDecimal(father);
std::string PHI = _conversion->binaryToDecimal(HI);
std::string PHD = _conversion->binaryToDecimal(HD);
cout << P << " " << PHI << " " << PHD << " ";
while (tmp != nullptr) {
data = (dynamic_cast<RecordDataType<char>*>(tmp->getData()))->getDataPtr();
const char *DATO = pDisk.read(_sizeCounter, 7);
std::string DATOSTR(DATO); // obtiene el padre
_sizeCounter += 8;
cout << sortUserDataFromDisk(DATOSTR, *data) << endl;
tmp = tmp->getNextPtr();
}
}
示例4: diskTest
string diskTest()
{
Disk * disk = new Disk(1000000000, "test", false);
if(disk->isReadOnly()) return "readonly check failed";
if(disk->getCapacity() != 1000000000) return "capacity check failed";
if(!disk->getRootFolder()) return "root folder was not generated";
if(disk->getRootFolder()->getName() != "test") return "root folder name check failed";
File * infected = new File();
Virus * virus = new Virus();
infected->setVirus(virus);
disk->getRootFolder()->addFile(infected);
Disk * backup = new Disk(1000000000, "b", true);
if(!disk->backup(backup)) return "backup failed";
vector<pair<Folder *, int>> folds;
backup->getRootFolder()->getAllFoldersRecursively(folds);
if(!folds.size()) return "backup was not created";
delete disk;
delete backup;
return "";
}
示例5: rowCount
int TrackViewModel::rowCount(const QModelIndex &parent) const
{
if (!parent.isValid())
return project->count();
QObject *obj = static_cast<QObject*>(parent.internalPointer());
Disk *disk = qobject_cast<Disk*>(obj);
if(disk)
return disk->count();
return 0;
}
示例6: IsDeepThoughtDisk
bool IsDeepThoughtDisk (Disk &disk, const Sector *§or)
{
// Try the primary catalogue location on cyl 0
if (!disk.find(Header(0, 0, 0, SizeToCode(4096)), sector))
{
// Try the backup location on cyl 1
if (!disk.find(Header(1, 0, 0, SizeToCode(4096)), sector))
return false;
}
return true;
}
示例7: selectFromTable
void selectFromTable(bool dis, string attributes, string tabs, string whereCondition, string orderBy) {
int disk0 = disk.getDiskIOs();
vector<string> tableNames = split(tabs, ',');
vector<string> attributeNames = split(attributes, ',');
string tableName;
if(validate(tableNames)) return;
if(tableNames.size()==1) {
Relation *relation = schemaManager.getRelation(tableNames[0]);
string pName = projection(attributeNames, tableNames[0], whereCondition);
string d;
relation = schemaManager.getRelation(pName);
if(dis) {
d = distinct(pName);
relation = schemaManager.getRelation(d);
}
cout<<*relation<<endl;
if(!(attributeNames.size()==1 && attributeNames[0]=="*" && whereCondition.empty()))
schemaManager.deleteRelation(pName);
if(dis)
schemaManager.deleteRelation(d);
}
else {
vector<string>::iterator it;
vector<string> projections;
if(tableNames.size()==2) {
string ptemp = crossJoin(attributeNames, tableNames[0], tableNames[1], whereCondition, false);
string d;
Relation *relation = schemaManager.getRelation(ptemp);
if(dis) {
d = distinct(ptemp);
relation = schemaManager.getRelation(d);
}
cout<<*relation<<endl;
schemaManager.deleteRelation(ptemp);
if(dis)
schemaManager.deleteRelation(d);
}
else {
bool flag =true;
vector<string> blah;
string str = crossJoin(blah, tableNames[0],tableNames[1], whereCondition, false);
for(int i=2;i<tableNames.size();i++) {
str = crossJoin(blah, str, tableNames[i], whereCondition, true);
}
Relation *relation = schemaManager.getRelation(str);
cout<<*relation<<endl;
schemaManager.deleteRelation(str);
}
}
cout<<"No. of disk IO's used for this opertaion are "<<disk.getDiskIOs()-disk0<<endl;
}
示例8: Assembly
Assembly *GraspGLObjects::CreateTorso( void ) {
Assembly *torso = new Assembly();
Slab *slab = new Slab( torso_shape[X], torso_shape[Y], torso_shape[Z] );
slab->SetColor( 0.1f, 0.4f, 0.0f );
torso->AddComponent( slab );
Disk *disk = new Disk( 50.0 );
disk->SetPosition( 0.0, 0.0, -40.0 );
disk->SetColor( 1.0f, 0.7f, 0.0f );
torso->AddComponent( disk );
return torso;
}
示例9: Disk
Device* DiskDeviceClass::CreateDevice(DeviceClass* deviceClass, SP_DEVINFO_DATA deviceInfoData, CString path)
{
Disk* disk = new Disk(deviceClass, deviceInfoData.DevInst, path, m_pLibHandle);
// Only Create USB Disks
if ( disk->IsUsb() )
{
return disk;
}
delete disk;
return NULL;
}
示例10: drawDisk
// draws solid Disk and wire Disk together. The wire color is always black
void drawDisk(vec4 color)
{
glUniform4fv( model_color, 1,color );
myDisk.draw();
glUniform4fv( model_color, 1,vec4(0,0,0,1) );
myWireDisk.draw();
}
示例11: WillCollide
bool WillCollide(float a_dt,
Disk const & a_disk,
vec3 const & a_vel,
Line const & a_line,
float a_lineLength,
float & a_outTime)
{
Dg::R2::FPCDiskLine<float> fpc;
Dg::R2::FPCDiskLine<float>::Result result_fpc = fpc(a_disk, a_vel, a_line, vec3::ZeroVector());
bool willCollide = result_fpc.code == Dg::QC_Intersecting;
willCollide = willCollide && (result_fpc.t <= a_dt);
willCollide = willCollide && (result_fpc.t >= 0.0f);
if (willCollide)
{
vec3 p = a_disk.Center() + result_fpc.t * a_vel;
Dg::R2::CPPointLine<float> cp;
Dg::R2::CPPointLine<float>::Result result_cp = cp(p, a_line);
willCollide = willCollide && (result_cp.u <= a_lineLength);
willCollide = willCollide && (result_cp.u >= 0.0f);
a_outTime = result_fpc.t;
}
return willCollide;
}
示例12: disk_transfer
void Async::disk_transfer(
Disk disk,
const Dirent& ent,
on_write_func write_func,
on_after_func callback,
const size_t CHUNK_SIZE)
{
typedef delegate<void(size_t)> next_func_t;
auto next = std::make_shared<next_func_t> ();
auto weak_next = std::weak_ptr<next_func_t>(next);
*next = next_func_t::make_packed(
[weak_next, disk, ent, write_func, callback, CHUNK_SIZE] (size_t pos) {
// number of write calls necessary
const size_t writes = roundup(ent.size(), CHUNK_SIZE);
// done condition
if (pos >= writes) {
callback(fs::no_error, true);
return;
}
auto next = weak_next.lock();
// read chunk from file
disk->fs().read(
ent,
pos * CHUNK_SIZE,
CHUNK_SIZE,
fs::on_read_func::make_packed(
[next, pos, write_func, callback] (
fs::error_t err,
fs::buffer_t buffer)
{
debug("<Async> len=%lu\n", buffer->size());
if (err) {
printf("%s\n", err.to_string().c_str());
callback(err, false);
return;
}
// call write callback with data
write_func(
buffer,
next_func::make_packed(
[next, pos, callback] (bool good)
{
// if the write succeeded, call next
if (LIKELY(good))
(*next)(pos+1);
else
// otherwise, fail
callback({fs::error_t::E_IO, "Write failed"}, false);
})
);
})
);
});
// start async loop
(*next)(0);
}
示例13: init
// OpenGL initialization
void
init()
{
program = InitShader( "/home/GONZAGA/yerion/Documents/ACAR/LgsparksCar/vertex.glsl", "/home/GONZAGA/yerion/Documents/ACAR/LgsparksCar/fragment.glsl" );
glUseProgram( program );
// Uniform variables: color and viewing parameters
model_color = glGetUniformLocation( program, "model_color" );
model_view = glGetUniformLocation( program, "model_view" );
projection = glGetUniformLocation( program, "projection" );
// Create multiple vertex array objects using an array of vertex array objects
GLuint vao[6];
glGenVertexArrays( 6, vao );
//******** Create the VAOs ************//
myCube.createVAO(vao[0],program);
myWireCube.createVAO(vao[1],program);
myDisk.createVAO(vao[2],program);
myWireDisk.createVAO(vao[3],program);
myCylinder.createVAO(vao[4],program);
myWireCylinder.createVAO(vao[5],program);
glUniform4fv( model_color, 1,vec4(1,1,1,1) ); // set color to white initially
glLineWidth(4);
glEnable( GL_DEPTH_TEST );
glClearColor( 0.5, 0.5, 0.5, 1.0 );
}
示例14: Disk
//----------------------------------------------------------------------------------------------------------------------
void SMCAgentViz::init()
{
NodeGroup::init();
m_agentDisk = new Disk(m_agent->getRadius(), m_agent->getRadius()/2, 32);
m_agentDisk->m_color = ci::Vec4f(0,0,0,1);
m_agentDisk->createGeometry();
m_children.push_back(m_agentDisk);
Disk* innerDisk = new Disk(m_agent->getRadius()/2.0, 0, 32);
//innerDisk->translate(cinder::Vec4f(0,0,0,0));
innerDisk->m_color = ci::Vec4f(0,0,0, 1);
innerDisk->createGeometry();
m_children.push_back(innerDisk);
m_paused = false;
}
示例15: dump_double_indirect_stream
void
dump_double_indirect_stream(Disk& disk, bfs_inode* node, bool showOffsets)
{
if (node->data.max_double_indirect_range == 0)
return;
int32 bytes = node->data.double_indirect.length * disk.BlockSize();
int32 count = bytes / sizeof(block_run);
block_run runs[count];
off_t offset = node->data.max_indirect_range;
ssize_t bytesRead = disk.ReadAt(disk.ToOffset(node->data.double_indirect),
(uint8*)runs, bytes);
if (bytesRead < bytes) {
fprintf(stderr, "couldn't read double indirect runs: %s\n",
strerror(bytesRead));
return;
}
puts("double indirect stream:");
for (int32 i = 0; i < count; i++) {
if (runs[i].IsZero())
return;
printf(" double_indirect[%02" B_PRId32 "] = ", i);
dump_block_run("", runs[i], "");
int32 indirectBytes = runs[i].length * disk.BlockSize();
int32 indirectCount = indirectBytes / sizeof(block_run);
block_run indirectRuns[indirectCount];
bytesRead = disk.ReadAt(disk.ToOffset(runs[i]), (uint8*)indirectRuns,
indirectBytes);
if (bytesRead < indirectBytes) {
fprintf(stderr, "couldn't read double indirect runs: %s\n",
strerror(bytesRead));
continue;
}
for (int32 j = 0; j < indirectCount; j++) {
if (indirectRuns[j].IsZero())
break;
printf(" [%04" B_PRId32 "] = ", j);
char buffer[256];
if (showOffsets)
snprintf(buffer, sizeof(buffer), " %16" B_PRIdOFF, offset);
else
buffer[0] = '\0';
dump_block_run("", indirectRuns[j], buffer);
offset += indirectRuns[j].length * disk.BlockSize();
}
}
}