5 #ifndef CCF_COMMON_DATA_FRAME_HPP_H_
6 #define CCF_COMMON_DATA_FRAME_HPP_H_
8 #include <core/utils/param/parameter.hpp>
28 const int16_t frame_q_nb);
61 void Store(
const void* buffer,
64 const int64_t cam_frame_count,
65 const int64_t int_frame_count,
66 const int64_t sub_frame_count,
67 const int64_t exp_nb_sub_frames,
69 const int32_t offset_x,
70 const int32_t offset_y,
73 const int32_t depth = 1);
76 void AddData(
const void* buffer,
145 template <
class TYPE>
148 LOG4CPLUS_TRACE_METHOD(
Logger(), __PRETTY_FUNCTION__);
149 m_meta_data[name] = core::utils::param::Parameter(name, std::to_string(value));
156 template <
class TYPE>
159 LOG4CPLUS_TRACE_METHOD(
Logger(), __PRETTY_FUNCTION__);
160 auto it = m_meta_data.find(name);
161 if (it == m_meta_data.end()) {
164 it->second.GetValue(value);
169 std::string
ToString(
const bool full =
false)
const;
197 void _Initialise(
const std::string& frame_id =
"",
198 const int64_t frame_nb = -1);
201 std::string m_frame_id;
202 int64_t m_frame_q_nb;
204 int64_t m_cam_frame_count;
205 int64_t m_int_frame_count;
207 int64_t m_sub_frame_count;
208 int64_t m_exp_nb_sub_frames;
210 uint8_t m_consumer_count;
212 double m_handling_start_time;
216 uint32_t m_expected_size;
217 uint32_t m_cur_allocated;
229 std::map<std::string, core::utils::param::Parameter> m_meta_data;
231 template <
class DATA_TYPE>
232 double _Sum()
const {
233 LOG4CPLUS_TRACE_METHOD(
Logger(), __PRETTY_FUNCTION__);
235 DATA_TYPE* p =
static_cast<DATA_TYPE*
>(m_buffer);
237 sum +=
static_cast<DATA_TYPE
>(*p++);
Class to be used as parent all CCF classes.
Definition: base.hpp:151
Frame class used to store the data and metadata for one frames received from the camera.
Definition: dataFrame.hpp:17
void SetConsumerCount(const uint8_t count)
Definition: dataFrame.cpp:110
void DecrementConsumerCount(const uint8_t decr=1)
Definition: dataFrame.cpp:126
const void * GetBuffer() const
Get read-only pointer to internal image buffer.
Definition: dataFrame.cpp:274
int32_t GetWidth() const
Get the width of the ROI applied by the camera.
Definition: dataFrame.cpp:309
int32_t GetResolution() const
Get the resolution (bytes/pixel) of the image currently stored in the object.
Definition: dataFrame.cpp:329
void Reset()
Definition: dataFrame.cpp:65
int16_t GetFrameQNb() const
Return the frame queue number, when used in a queue.
Definition: dataFrame.cpp:77
double GetDataSum() const
Compute the data sum of all pixels.
Definition: dataFrame.cpp:385
int64_t GetCamFrameCount() const
Definition: dataFrame.cpp:254
double GetHandlingTime() const
Get handling time (duration for handling the frame in the given context).
Definition: dataFrame.cpp:350
int64_t GetSubFrameCount() const
Number of a sub-frame if the data of a frame is received in sub-frames (blocks) (first sub-frame == 1...
Definition: dataFrame.cpp:264
~DataFrame()
Definition: dataFrame.cpp:57
DataTypes GetDataType() const
Definition: dataFrame.cpp:324
double GetHandlingStartTime() const
Get the time for starting the handling of the frame.
Definition: dataFrame.cpp:345
DataFrame & operator=(const DataFrame &source)
Definition: dataFrame.cpp:334
bool HasMetadata(const std::string &name, TYPE &value) const
Get a parameter value from the configuration.
Definition: dataFrame.hpp:157
void * GetBufferReadWrite() const
Definition: dataFrame.cpp:279
void RemoveMetaData(const std::string &name)
Remove a given metadata parameter from the object.
Definition: dataFrame.cpp:377
DataFrame()
Definition: dataFrame.cpp:52
void AddData(const void *buffer, const uint32_t size)
Add a new chunk of data in the image buffer. Used to build up the image incrementally.
Definition: dataFrame.cpp:212
void Store(const void *buffer, const uint32_t size, const double time, const int64_t cam_frame_count, const int64_t int_frame_count, const int64_t sub_frame_count, const int64_t exp_nb_sub_frames, const DataTypes data_type, const int32_t offset_x, const int32_t offset_y, const int32_t width, const int32_t height, const int32_t depth=1)
Store an image frame (or sub-frame) in the object.
Definition: dataFrame.cpp:150
static int32_t GetCFitsioType(const DataTypes data_type)
Get CFITSIO data type.
int32_t GetDepth() const
Get the number of frames if a three dimensional image is contained in the object.
Definition: dataFrame.cpp:319
int64_t GetExpNbSubFrames() const
Expected number of sub-frames if the data of a frame is received in sub-frames (blocks).
Definition: dataFrame.cpp:269
double GetTime() const
Get the current time stamp stored in the object.
Definition: dataFrame.cpp:294
int32_t GetOffsetX() const
Get horisontal offset of the ROI applied by the camera.
Definition: dataFrame.cpp:299
uint8_t GetConsumerCount() const
Definition: dataFrame.cpp:121
void ResetDataSize()
Reset the size of the image. This indicates that no image is stored in the object.
Definition: dataFrame.cpp:145
bool GetCompleted() const
Return true if the image in the object is complete according to width/height/data type.
Definition: dataFrame.cpp:244
uint32_t GetBufferSize() const
Get the size of the internal buffer allocated, in bytes.
Definition: dataFrame.cpp:289
int64_t GetIntFrameCount() const
Internall frame counter, counting the frames receives since the last Start command (first frame == 1)...
Definition: dataFrame.cpp:259
uint32_t GetDataSize() const
Return the size in bytes of the image.
Definition: dataFrame.cpp:284
void SetCompleted()
Mark the frame as completed.
Definition: dataFrame.cpp:249
int32_t GetHeight() const
Get the height of the ROI applied by the camera.
Definition: dataFrame.cpp:314
void AddMetaData(const std::string &name, TYPE &value)
Definition: dataFrame.hpp:146
const std::string & GetFrameId() const
Return the frame ID allocated.
Definition: dataFrame.cpp:72
void SetHandlingStartTime(const double time)
Set the start time for handling handling the frame.
Definition: dataFrame.cpp:340
std::string ToString(const bool full=false) const
Generate a representative (short) string representation (summary) of the object.
Definition: dataFrame.cpp:82
int32_t GetOffsetY() const
Get vertical offset of the ROI applied by the camera.
Definition: dataFrame.cpp:304
Definition: appBase.cpp:8
log4cplus::Logger & Logger()
Definition: base.cpp:9
DataTypes
Definition: dataType.hpp:46