In my audio C++ project, I am developing a class called AudioLogic that should act as a…
- User
In my audio C++ project, I am developing a class called AudioLogic that should act as a setup class for another class, called AudioSystem. AudioSystem is effectively the responsible for process the data, while AudioLogic should act as a setup class to parse and prepare all the necessary material for AudioSystem. I list 6 actions to be performed bu AudioLogic, such that the 6-th is to provide data to AudioSystem and run it. I have two interfaces that I use for AudioSystem: Configurable and Runnable and I am considering to use them to maintain the same logic and abstraction. However, I am stuck while choosing while dividing the functions between these two methods. Indeed, a choice can be 3 and 3; on the other hand, I am considering to make 5 and 1, such that the run() method should contain only the direct link with AudioSystem. Please provide feedback on it. Additionally, please provide feedback on the name of the class proposed, AudioLogic and AudioSystem. I know that I provided small context, but feel free to suggest or review it.
- Assistant
- User
Actually my interface Configurable is quite easy, like providing only: virtual void configure() = 0; that it is used by AudioSystem. If I would keep this idea, the configure method in AudioLogic should contain all the five steps, encapsulating a lot of codes. Please provide alternatives to this situation. Additionally, please provide feedback if the idea to keep the configure() method for both of classes sounds interesting or not.
- Assistant
- User
I need to call configure() of AudioSystem: do you suggest to call it inside the private method setupAudioSystem() or inside the run() method, like void run() override { audioSystem.configure(); audioSystem.run();} ?
- Assistant
- User
Do you think that call configureAudioSystem() instead of setupAudioSystem() can improve the readability of the code?
- Assistant
- User
One of my parser takes directly the std::string to parse, however I am providing to the handler the std::string of the filename. Please provide a function that:
- try to open the file provided, otherwise throw;
- read the content;
- create a std::string within the full code. Alternatively, provide suggestion to this method.
- Assistant
- User
In a class, I have a data structure that in this class I fill of data from a text file. However, this class is responsible to only fill the data structure and not to use it, the usage is given to third class. For this reason, I am considering to implement or a move semantics or the usage of a unique_ptr, such to release the resource to the third class. Please provide feedback on this strategy.
- Assistant
- User
One syntax question: when using std::move, I have to declare it both in "giving" method both in "receiving"" method? Like your pair extractData() and setData()?
- Assistant
- User
Let me try to better explain my PoV. ~ void setData(std::vectorstd::string data) { // Move the data into the member variable this->data = std::move(data); // this std::move } ~ In setData() I am using std::move because now I am moving the std::vectorstd::string data that is incoming as argument. COrrect?
- Assistant
- User
Can a function like extractData() labelled as noexcept?
- Assistant
- User
Please list the most important qualifier for method in C++.
- Assistant
- User
Is it the best practice to use qualifier every time is possible?
- Assistant
- User
I have a class in which I declared an unordered_map as private member. In this class, I do not provide the big six (constructor, destructor, ...). Now, to use an assignment operator implementing move semantics, must I to declare the move assignment in my class?
- Assistant