Question: code in C language please!! to make an opaque object wrapper that allows for all the behaviors we want in a bit collection data structur

code in C language please!!  code in C language please!! to make an opaque object wrapper
that allows for all the behaviors we want in a bit collection

to make an opaque object wrapper that allows for all the behaviors we want in a bit collection data structur called BIT.FLAGS. \#ifndef BIT.FLAGS.H \#define BIT.FLAGS.H \#include "status. h" typedef void : BIT.FLAGS: // Intentionally leaving out a default init function to force user to //at least guess at the size needed. If one WERE to be used it would /have the following prototype: / BIT.FLAGS bit_flags_init_default (void); / Precondition: number of bits is a positive integer. /Postcondition: Returns the handle to a valid Bit.flags object that has the ability to store up to number_of.bits bits but currently // all flags are set at zero. Returns NULL on failure. The container is assumed to hold size=number-of-bits after the init function runs. BIT FLAGS bit -flags init -number of _bits (int number-of ubits); //Precondition: flag-position is a non-negative integer and hBit-flags / is a handle to a valtd Bit.flags object. Postcondition: The flag // at the flag-position index is set to 1 . Function will attempt to // resize the internal representation if the flag-position is too large instead of failing for out of bounds. Returns SUCCESS if the operation is successful and FAILURE if the / operation fails a needed resize. This operation is considered to // be expensive if flag-position is constantly going out of bounds by a small amount because the restze aluays attempts to minimize / the amount of space required to store the bits. All new flags // created in a resize operation (except the one being set) will be set as tero. Status bit-flags-set-flag (BIT.FLAGS hBit-flags, int flag-position): //Precondition: flag-position is a nor-negative integer and hBit-flags / is a handle to a valid Bit-flags object. //Posteondition: The flag at the flag-position inder is set to D. Function will attempt to resize the internal representation // if the flag-position is too large instead of failing for out of bounds. Returns SUCCESs if the operation is successful and FAULURE if the operation fails a needed resize. This operation // is considered to be expensive if flag-position is constantly going out of bounds by a small amount because the resize always // attempts to minimize the amount of space required to store the // bits. All new flags created in a resize operation will be set as zero. Status bit_flags-unset_flag. (BTT_FLAGS hBit,flags, int flag-position): //Precondition: flag-position is a non-negative integer and hBit-flags // is a handle to a valid Bit_flags object. /Posteondition: returns the value of the flag at index flag-position if it is in bounds or 1 otherwise. int bit.flags_check.flag (BIT.FLAGS bBit_flags, int flag-position): //Precondition: hBit.flags is a handle to a valid Bit-flags object. / Posteondition: returns the number of bits currently held by the data structu int bit-flags-get -size (BIT.FLAGS hBit.flags); /Precondition: hBit.flags is a handle to a valid Bit.flags object. / Postcondition: returns the number of bits the object CAN hold. int bit-flags-get-capacity (BIT.FLAGS hBit-flags): //Precondition: phBit,flags is the address of a handle to a valid Bit-flags ob //Posteondition: The memory for the object referred to by the handle /s free'd and the handle is set to NULL. void bit-flags-destroy (BIT.FLAGS* phBit-flags); \#endif Turn in only your bit flags.h and bit flags.c files for grading. The graders will use their own main program to test your data structure but you should test it as well as you can yourself with your own driver. The graders will also assume you are using the status.h we created in class. Please note that you may not change prototype of any of these functions as the functions must work with our driver you can only use these. In the comments section of your code think about your data structure and what might be missing. Come up with one proposed function that you could add to the interface (you do not have to write it) and explain why you think it should be added (what it would do and how it would be useful). At the top of your code you should have a comment section that has the following format: Author: Effort: Time you spent on this project> Purpose: Purpose of this assignment in your oun words>

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!