Go to the documentation of this file.
5 #ifndef CCF_COMMON_RECIPE_BASE_HPP_H_
6 #define CCF_COMMON_RECIPE_BASE_HPP_H_
24 template <
class SRC_IM_TYPE,
class TRG_IM_TYPE>
27 TRG_IM_TYPE** target_buf,
28 uint32_t* target_buf_size) {
30 *target_buf_size = (pixels *
sizeof(TRG_IM_TYPE));
31 *target_buf = (TRG_IM_TYPE*)malloc(*target_buf_size);
33 SRC_IM_TYPE* im_ptr = image_buffer;
34 TRG_IM_TYPE* target_buf_ptr = *target_buf;
35 for (uint32_t n = 0; n < pixels; n++) {
36 *target_buf_ptr++ =
static_cast<TRG_IM_TYPE
>(*im_ptr++);
45 uint32_t* target_buffer_size);
53 static const std::string&
GenId(
const uint16_t proc_thread_nb,
54 const uint16_t recipe_nb);
67 const uint16_t proc_thread_nb,
68 const uint16_t recipe_nb,
69 const std::string recipe_name,
77 const uint16_t recipe_nb,
79 const bool initialise =
true);
82 static void GetRecipeObjs(std::vector<RecipeBase*>& recipe_objs);
86 const uint16_t recipe_nb,
99 const uint16_t recipe_nb,
100 const std::string& recipe_name);
134 const std::string
GenKey(
const std::string& name)
const;
167 const uint16_t recipe_nb,
168 const std::string& recipe_name,
203 static std::map<std::string, RecipeBase*> s_recipe_factory_objects;
204 static std::map<std::string, RecipeBase*> s_recipe_objects;
205 static bool s_cpl_initialised;
211 std::string m_recipe_id;
212 std::string m_recipe_name;
213 uint16_t m_proc_thread_nb;
214 uint16_t m_recipe_nb;
223 std::string m_db_base_name;
224 std::string m_key_prefix;
229 #endif // CCF_COMMON_RECIPE_BASE_HPP_H_
ImageDataType
CCF image data types. Based on the values defined for BITPIX in the FITS standard.
Definition: base.hpp:153
bool GetInitialised() const
Return flag indicating if the recipe object has been initialised.
Definition: recipeBase.cpp:249
static void FreeRecipeFactoryObjs()
Definition: recipeBase.cpp:146
void SetStatus(const ProcStatus status)
Update status for a given Publisher Thread in the OLDB.
Definition: recipeBase.cpp:374
uint16_t GetRecipeNb() const
Return the number of the Recipe to.
Definition: recipeBase.cpp:207
void Process(DataFrame &frame)
Execute the processing of the given frame.
Definition: recipeBase.cpp:278
const std::string SETUP_KEY_RECIPE_ENABLED
Definition: recipeBase.hpp:19
const std::string & GetKeyPrefix() const
Get the key prefix for this recipe, e.g. "proc1.recipe1".
Definition: recipeBase.cpp:239
static void GetRecipeObj(const uint16_t proc_thread_nb, const uint16_t recipe_nb, RecipeBase **recipe_obj, const bool initialise=true)
Definition: recipeBase.cpp:76
const std::string & GetRecipeName() const
Get the name of the recipe.
Definition: recipeBase.cpp:202
Class to be used as parent all CCF classes.
Definition: base.hpp:93
void Disable()
Disable the recipe so that it will no longer be invoked by the Processing Thread to which it belongs.
Definition: recipeBase.cpp:325
void Initialise()
Initalise the object. Invoked after creating a new object from the factory object.
Definition: recipeBase.cpp:217
static void GetRecipeFactoryObjs(std::vector< RecipeBase * > &recipe_factory_objs)
Statis method to retrieve references to the Recipe Factory Objects.
Definition: recipeBase.cpp:46
RecipeBase()
Definition: recipeBase.cpp:179
#define CCFLOC
Macro generating a location identifier: "<file>:<line>:<function>:<thread>".
Definition: base.hpp:292
void DisableRecipe()
Disable the recipe so that it will not be invoked.
Definition: recipeBase.cpp:267
void PrepCplImage(const ccf::common::DataFrame &frame, cpl_image **image, ccf::common::ImageDataType *target_data_type, uint32_t *target_buffer_size)
Definition: recipeBase.cpp:392
const std::string GenKey(const std::string &name) const
Generate a fully qualified key name, e.g. "proc1.recipe1.par".
Definition: recipeBase.cpp:244
static void FreeRecipeObjs()
Definition: recipeBase.cpp:133
void AssertPtr(const void *ptr, const std::string &object, const std::string &location)
Check that pointer is not NULL and raise rad::exception in case it is.
Definition: base.cpp:49
virtual void EnableUser()
Definition: recipeBase.cpp:320
const std::string & GetDbPath() const
Get the reference to the DB base path for ths recipe.
Definition: recipeBase.cpp:234
virtual ~RecipeBase()
Definition: recipeBase.cpp:193
static bool HasRecipeObj(const uint16_t proc_thread_nb, const uint16_t recipe_nb, RecipeBase **recipe_obj)
Check if a Proc Recipe object is defined.
Definition: recipeBase.cpp:100
virtual void DisableUser()
Definition: recipeBase.cpp:333
ProcStatus
Possible states for a Processing Recipe defined.
Definition: base.hpp:191
static void CreateRecipeObj(const std::string &class_name, const uint16_t proc_thread_nb, const uint16_t recipe_nb, const std::string recipe_name, RecipeBase **new_obj)
Definition: recipeBase.cpp:57
static void AddRecipeFactoryObj(RecipeBase &recipe_factory_obj)
Static method to register a Data Publisher factory object in the internal registry.
Definition: recipeBase.cpp:26
Definition: appBase.cpp:8
virtual void ProcessUser(DataFrame &frame)
User specific processing.
Definition: recipeBase.cpp:292
void ConvertImage(SRC_IM_TYPE *image_buffer, uint32_t pixels, TRG_IM_TYPE **target_buf, uint32_t *target_buf_size)
Convert the given image from one pixel type to another. A buffer is allocated internally,...
Definition: recipeBase.hpp:25
static void GetRecipeObjs(std::vector< RecipeBase * > &recipe_objs)
Get reference to all Processing Recipe objects registered.
Definition: recipeBase.cpp:120
const std::string & GetRecipeId() const
Get the ID of the recipe.
Definition: recipeBase.cpp:197
uint16_t GetProcThreadNb() const
Return the number of the Processing Thread to which this recipe object belongs.
Definition: recipeBase.cpp:212
ProcStatus GetStatus() const
Get status of the recipe object.
Definition: recipeBase.cpp:387
Processing Recipe base class. All recipes shall be derived from this class.
Definition: recipeBase.hpp:49
virtual void InitialiseUser()
Initialise the recipe object. See "Initialise()".
Definition: recipeBase.cpp:254
#define CCFTRACE
TRACE log macro. Includes the location ("CCFLOC") in the log message.
Definition: base.hpp:403
static const std::string & GenId(const uint16_t proc_thread_nb, const uint16_t recipe_nb)
Generate the ID for this recipe from the Processing Thread and Recipe number.
Definition: recipeBase.cpp:14
virtual void CreateObjectUser(const uint16_t proc_thread_nb, const uint16_t recipe_nb, const std::string &recipe_name, RecipeBase **new_object)
Instantiate a specific instance of the object.
Definition: recipeBase.cpp:298
bool GetEnabled() const
Return the enabled status of the recipe.
Definition: recipeBase.cpp:273
Frame class used to store the data and metadata for one frames received from the camera.
Definition: dataFrame.hpp:15
const std::string SETUP_KEY_RECIPE_BASE_DELAY
Definition: recipeBase.hpp:20
void Enable()
Enable the recipe so that it will be invoked by the Processing Thread to which it belongs.
Definition: recipeBase.cpp:308
void SetEnabled(const bool enabled)
Set the enabled status flag of the recipe object.
Definition: recipeBase.cpp:261