void cineon::GenericHeader::Reset() { // File Information this->magicNumber = MAGIC_COOKIE; this->imageOffset = ~0; EmptyString(this->version); ::strcpy(this->version, SPEC_VERSION); fileSize = sizeof(cineon::Header); // genericSize is the size of the file/image/orientation headers // sizeof(cineon::GenericHeader) won't give the correct results because // of compiler padding this->genericSize = 1024; // industrySize is the size of the motion picture/television headers this->industrySize = 1024; this->userSize = 0; EmptyString(this->fileName); EmptyString(this->creationDate); EmptyString(this->creationTime); EmptyString(this->reserved1); // Image Information this->imageOrientation = kUndefinedOrientation; this->numberOfElements = 0xff; this->unused1[0] = this->unused1[1] = 0xff; EmptyVector(this->whitePoint); EmptyVector(this->redPrimary); EmptyVector(this->greenPrimary); EmptyVector(this->bluePrimary); EmptyString(this->labelText); EmptyString(this->reserved2); this->interleave = 0xff; this->packing = 0xff; this->dataSign = 0xff; this->imageSense = 0xff; this->endOfLinePadding = 0xffffffff; this->endOfImagePadding = 0xffffffff; // Image Orientation this->xOffset = this->yOffset = 0xffffffff; EmptyString(this->sourceImageFileName); EmptyString(this->sourceDate); EmptyString(this->sourceTime); EmptyString(this->inputDevice); EmptyString(this->inputDeviceModelNumber); EmptyString(this->inputDeviceSerialNumber); EmptyFloat(this->xDevicePitch); EmptyFloat(this->yDevicePitch); EmptyFloat(this->gamma); EmptyString(this->reserved3); EmptyString(this->reserved4); }
// Overload [] const operator declaration. Guarantees that // the returned object will not be modified. // Throws an EmptyVector exception if the vector is empty const int& LinkedList::operator [](const int & sub) const throw (EmptyVector){ // If the subscript is out of range give message // and exit if (sub < 0 || sub >= vectorSize) subError(); // If the vector is empty give a message and throw and exception if(vectorSize==0 || head == NULL){ std::cout<<"Vector is empty"<<std::endl; throw EmptyVector(); } // Otherwise we traverse the list until we find the // desired position. int count = 0; Node *cursor = head; // Keep going until we reach the desired subscript while(cursor && count < sub){ // Go to the next one cursor = cursor->next; count++; } // We found it! return cursor->data; }
void SP2::Scene2Updates() { if (camera.position.x < 5.5f &&camera.position.x >-5.5f && camera.position.z > 17 && camera.position.z < 26) { gameState = GS_SCENE3; camera.position.Set(0, 0, 68); EmptyVector(); Pillars.push_back(CollisionObject(Vector3(30, 0, 30), 5.f)); Pillars.push_back(CollisionObject(Vector3(-30, 0, -30), 5.f)); Pillars.push_back(CollisionObject(Vector3(-30, 0, 30), 5.f)); Pillars.push_back(CollisionObject(Vector3(30, 0, -30), 5.f)); sound.playSoundThreaded("Music/bossfight.mp3"); } }
// Overload [] operator declaration. The returned object can be // modified. Throws an EmptyVector exception if the vector is empty. int & LinkedList::operator [](const int & sub) throw (EmptyVector){ int totalArrayOp=0; // Reset the count // 2 comparison < >= 1 boolean || totalArrayOp+=3; // If the subscript is out of range give message // and exit if (sub < 0 || sub >= vectorSize) subError(); // 2 comparison == 1 boolean || totalArrayOp+=3; // If the vector is empty give a message and throw and exception if(vectorSize==0 || head == NULL){ std::cout<<"Vector is empty"<<std::endl; throw EmptyVector(); } // 2 assignment = totalArrayOp+=2; // Otherwise we traverse the list until we find the // desired position. int count = 0; Node *cursor = head; // Keep going until we reach the desired subscript while(cursor && count < sub){ // 2 comparison < 1 boolean && totalArrayOp+=3; // Go to the next one cursor = cursor->next; count++; // 1 assignment, 1 increment totalArrayOp+=2; } // 1 return totalArrayOp++; std::cout<<"Total operations in [] operator: "<< totalArrayOp << std::endl; // We found it! return cursor->data; }