本文整理汇总了C++中Star::readStar方法的典型用法代码示例。如果您正苦于以下问题:C++ Star::readStar方法的具体用法?C++ Star::readStar怎么用?C++ Star::readStar使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Star
的用法示例。
在下文中一共展示了Star::readStar方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
//.........这里部分代码省略.........
if (memcmp(&planetA,&planetB,PLANET_SIZE)) {
printf("Endianness Mismatch: luckily we coded for that\n");
}
byt testIdempotency[PLANET_SIZE];
planetB.writePlanet(testIdempotency);
planetA.readPlanet(testIdempotency);
if (memcmp(&planetA,&planetB,PLANET_SIZE)) {
printf("Idempotency Mismatch: FAIL\n");
}
if (memcmp(testIdempotency,curData,PLANET_SIZE)) {
printf("Idempotency Mismatch: FAIL Internal\n");
}
if (doInput) {
planets[i]=planetB;
}else {
newPlanets[i]=planetB;
}
}
}
int maxx = -(1<<30);
int minx = (1<<30);
int maxy = -(1<<30);
int miny = (1<<30);
nerf(stars,planets);
for (int doInput=(argc>2?0:1);doInput<2;++doInput) {
for (int i=0;i<NUM_STARS;++i) {
const byt * curData = (doInput?data:writeData)+(STAR_OFFSET+i*STAR_SIZE);
Star starA;
memcpy(&starA,curData,STAR_SIZE);
// starA.printStar();
Star starB;
starB.readStar(curData);
if (doInput) {
if (starB.x!=0||starB.y!=0) {
if (starB.x<minx) {
minx = starB.x;
}
if (starB.x>maxx) {
maxx = starB.x;
}
if (starB.y<miny) {
miny = starB.y;
}
if (starB.y>maxy) {
maxy = starB.y;
}
}else {
//invalid system
}
stars[i]=starB;
}else {
newStars[i]=starB;
}
if (memcmp(&starA,&starB,STAR_SIZE)) {
printf("Endianness Mismatch: luckily we coded for that\n");
}
byt testIdempotency[STAR_SIZE];
starB.writeStar(testIdempotency);
starA.readStar(testIdempotency);
if (memcmp(&starA,&starB,STAR_SIZE)) {
starB.writeStar(testIdempotency);
starA.readStar(testIdempotency);