Question
Design and code a class named ProteinDatabase that manages a dynamically allocated array of elements of type std::string. Your class keeps track of the number
Design and code a class named ProteinDatabase that manages a dynamically allocated array of elements of type std::string. Your class keeps track of the number of strings currently stored and defines the following member functions:
- a no-argument default constructor
- a 1-argument constructor that receives as parameter a string containing the name of a file from which this member function populates the current object. This function
-
reads the file to count the number of protein sequence present in the file.
In the file, each protein sequence is prefixed by a line starting with a greater than character (">") followed by a description of the origin of the sequence of no more than 131 characters.
The protein sequence will begin on the next line for some number of lines. Each line (except the last one) will contain exactly 80 characters.
-
allocates memory for that number of protein sequences in the array
-
re-reads the file and loads the protein sequences (i.e., string of characters not sequence names) into the array.
-
- size_t size(): a query that returns the number of protein sequences stored in the current object.
- std::string operator[](size_t): a query that returns a copy of the protein sequence at the index received as the function parameter. If the index is invalid, this function should return an empty string.
- Upgrade the ProteinDatabase class to include a move constructor and a move assignment operator
please respond as soon as possible!
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started