Ocean
BufferRecorder.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) Meta Platforms, Inc. and affiliates.
3  *
4  * This source code is licensed under the MIT license found in the
5  * LICENSE file in the root directory of this source tree.
6  */
7 
8 #ifndef META_OCEAN_MEDIA_BUFFER_FILE_RECORDER_H
9 #define META_OCEAN_MEDIA_BUFFER_FILE_RECORDER_H
10 
11 #include "ocean/media/Media.h"
13 
15 
16 namespace Ocean
17 {
18 
19 namespace Media
20 {
21 
22 // Forward declaration.
23 class BufferRecorder;
24 
25 /**
26  * Definition of a object reference holding a buffer recorder.
27  * @see SmartObjectRef, BufferRecorder.
28  * @ingroup media
29  */
31 
32 /**
33  * This class is the base class for all buffer recorders.
34  * @ingroup media
35  */
36 class OCEAN_MEDIA_EXPORT BufferRecorder : virtual public ExplicitRecorder
37 {
38  public:
39 
40  /**
41  * Returns the buffer of the most recently saved image.
42  * @return Buffer of most recently saved image
43  */
44  virtual bool buffer(std::vector<unsigned char>& data) const = 0;
45 
46  /**
47  * Returns the buffer type of this recorder.
48  * @return Buffer type
49  * @see setBufferType().
50  */
51  virtual const std::string& bufferType() const;
52 
53  /**
54  * Sets the type of the buffer.
55  * For images this type will be the file extension of a corresponding image file, e.g. bmp, jpg, png, etc.
56  * @param bufferType Buffer type to be set
57  * @return True, if succeeded
58  */
59  virtual bool setBufferType(const std::string& bufferType);
60 
61  protected:
62 
63  /**
64  * Creates a new buffer recorder.
65  */
67 
68  /**
69  * Destructs a buffer recorder.
70  */
71  ~BufferRecorder() override;
72 
73  protected:
74 
75  /// Buffer type of this recorder.
76  std::string recorderBufferType;
77 };
78 
79 }
80 
81 }
82 
83 #endif // META_OCEAN_MEDIA_BUFFER_FILE_RECORDER_H
This class is the base class for all buffer recorders.
Definition: BufferRecorder.h:37
virtual bool setBufferType(const std::string &bufferType)
Sets the type of the buffer.
BufferRecorder()
Creates a new buffer recorder.
std::string recorderBufferType
Buffer type of this recorder.
Definition: BufferRecorder.h:76
virtual bool buffer(std::vector< unsigned char > &data) const =0
Returns the buffer of the most recently saved image.
virtual const std::string & bufferType() const
Returns the buffer type of this recorder.
~BufferRecorder() override
Destructs a buffer recorder.
This class is the base class for all explicit media recorder.
Definition: ExplicitRecorder.h:40
This template class implements a smart object reference which is a specialization of an ObjectRef obj...
Definition: SmartObjectRef.h:90
Ocean::SmartObjectRef< BufferRecorder, Recorder > BufferRecorderRef
Definition of a object reference holding a buffer recorder.
Definition: BufferRecorder.h:23
The namespace covering the entire Ocean framework.
Definition: Accessor.h:15