Add/update comments to the code (#25)

* Add/update comments to the code

* update comments

* Update comments
This commit is contained in:
Aryan Salmanpour
2024-05-15 13:44:51 -04:00
committed by GitHub
parent e73ec1412c
commit 73c0b10f6a
14 changed files with 2181 additions and 805 deletions
+39 -4
View File
@@ -29,20 +29,55 @@ THE SOFTWARE.
#include "rocjpeg_parser.h"
/**
* @brief RocJpegStreamParserHandle class
* This class wraps around RocJpegStreamParser to parse and store information from a JPEG stream.
* @brief The RocJpegStreamParserHandle class represents a handle to the RocJpegStreamParser object.
*
* This class provides a convenient way to manage the RocJpegStreamParser object by encapsulating it
* within a shared pointer. It also provides error handling functionality.
*/
class RocJpegStreamParserHandle {
public:
/**
* @brief Constructs a RocJpegStreamParserHandle object.
*
* This constructor initializes the rocjpeg_stream member with a new instance of RocJpegStreamParser
* using std::make_shared.
*/
explicit RocJpegStreamParserHandle() : rocjpeg_stream(std::make_shared<RocJpegStreamParser>()) {};
/**
* @brief Destroys the RocJpegStreamParserHandle object.
*
* This destructor clears any errors associated with the handle.
*/
~RocJpegStreamParserHandle() { ClearErrors(); }
std::shared_ptr<RocJpegStreamParser> rocjpeg_stream;
std::shared_ptr<RocJpegStreamParser> rocjpeg_stream; /**< The RocJpegStreamParser object. */
/**
* @brief Checks if there are no errors associated with the handle.
* @return true if there are no errors, false otherwise.
*/
bool NoError() { return error_.empty(); }
/**
* @brief Gets the error message associated with the handle.
* @return The error message as a C-style string.
*/
const char* ErrorMsg() { return error_.c_str(); }
/**
* @brief Captures an error message.
* @param err_msg The error message to capture.
*/
void CaptureError(const std::string& err_msg) { error_ = err_msg; }
private:
/**
* @brief Clears any errors associated with the handle.
*/
void ClearErrors() { error_ = "";}
std::string error_;
std::string error_; /**< The error message. */
};
#endif //ROC_JPEG_STREAM_HANDLE_H