Loading [MathJax]/extensions/tex2jax.js
Go to the documentation of this file.
17 #include <nlohmann/json.hpp>
37 inline constexpr
bool has_from_json_v = Gaudi::cpp17::is_detected_v<has_from_json_, T>;
43 if constexpr ( has_merge_and_reset_v<T> ) {
44 return [](
void* ptr,
void* other ) {
45 reinterpret_cast<T*
>( ptr )->mergeAndReset(
std::move( *
reinterpret_cast<T*
>( other ) ) );
48 return [](
void*,
void* ) {};
56 if constexpr ( has_merge_from_json_v<T> ) {
57 return [](
void* ptr,
const nlohmann::json& other ) {
reinterpret_cast<T*
>( ptr )->mergeAndReset( other ); };
58 }
else if constexpr ( has_merge_and_reset_v<T> && has_from_json_v<T> ) {
60 reinterpret_cast<T*
>( ptr )->mergeAndReset( T::fromJSON( other ) );
100 ,
m_reset{ [](
void* ptr ) {
reinterpret_cast<T*
>( ptr )->
reset(); } }
102 ,
m_getJSON{ [](
const void* ptr ) {
return reinterpret_cast<const T*
>( ptr )->
toJSON(); } }
166 template <
typename T>
174 template <
typename T>
Interface reporting services must implement.
std::string name
name of the entity
bool operator==(Entity const &ent)
operator== for comparison with an entity
bool operator==(void *ent)
operator== for comparison with raw pointer
std::vector< Sink * > m_sinks
virtual void removeEntity(Entity const &ent)=0
constexpr bool has_from_json_v
void mergeAndReset(nlohmann::json const &j)
allow merging to internal data from JSON input
decltype(T::fromJSON(nlohmann::json{})) has_from_json_
decltype(std::declval< T >().mergeAndReset(std::declval< T && >())) has_merge_and_reset_
virtual void registerEntity(Entity ent)=0
std::type_index(* m_typeIndex)(const void *)
function to get internal type.
double * begin(CLHEP::HepVector &v)
void removeSink(Sink *sink)
void reset()
function resetting internal data
void registerEntity(std::string c, std::string n, std::string t, T &ent)
std::type_index typeIndex() const
function to get internal type
MergeAndResetFromJSON_t makeMergeAndResetFromJSONFor()
void removeEntity(T &ent)
constexpr bool has_merge_and_reset_v
void * id() const
unique identifier, actually mapped to internal pointer
void registerEntity(Entity ent)
decltype(std::declval< T >().mergeAndReset(nlohmann::json{})) has_merge_from_json_
details::MergeAndReset_t m_mergeAndReset
function calling merge and reset on internal data with the internal data of another entity
json(* m_getJSON)(const void *)
function converting the internal data to json.
void * m_ptr
pointer to the actual data inside this Entity
void(*)(void *, const nlohmann::json &) MergeAndResetFromJSON_t
json toJSON() const
function giving access to internal data in json format
constexpr bool has_merge_from_json_v
Entity(std::string component, std::string name, std::string type, T &ent)
MergeAndReset_t makeMergeAndResetFor()
void mergeAndReset(Entity const &ent)
function calling merge and reset on internal data with the internal data of another entity
std::map< void *, Entity > m_entities
Central entity in a Gaudi application that manages monitoring objects (i.e.
bool canMergeFromJSON() const
tell if the Entity data can be updated from JSON input
Wrapper class for arbitrary monitoring objects.
details::MergeAndResetFromJSON_t m_mergeAndResetFromJSON
function calling merge and reset on internal data from JSON input
void(* m_reset)(void *)
function reseting internal data.
void(*)(void *, void *) MergeAndReset_t
std::string type
type of the entity, see comment above concerning its format and usage
std::string component
name of the component owning the Entity