Add/update comments to the code (#25)
* Add/update comments to the code * update comments * Update comments
This commit is contained in:
@@ -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
|
||||
Reference in New Issue
Block a user