REDAC HybridController
Firmware for LUCIDAC/REDAC Teensy
Loading...
Searching...
No Matches

#include <base.h>

Inheritance diagram for entities::Entity:
Collaboration diagram for entities::Entity:

Public Member Functions

 Entity ()=default
 
 Entity (std::string entityId)
 
const std::string & get_entity_id () const
 
void rename_entity (const std::string entityId)
 
EntityClassifier get_entity_classifier () const
 
EntityClass get_entity_class () const
 
uint8_t get_entity_type () const
 
Version get_entity_version () const
 
uint8_t get_entity_variant () const
 
virtual metadata::eui_t get_entity_eui () const =0
 
bool is_entity_class (EntityClass class_) const
 
bool is_entity_type (uint8_t type_) const
 
bool is_entity_version (Version version_) const
 
bool is_entity_variant (uint8_t variant_) const
 
virtual std::vector< Entity * > get_child_entities ()=0
 
virtual Entityget_child_entity (const std::string &child_id)=0
 
Entityresolve_child_entity (std::string paths[], size_t len)
 
Entityresolve_child_entity (JsonArrayConstIterator begin, JsonArrayConstIterator end)
 
Entityresolve_child_entity (JsonArrayConst path)
 
virtual bool init ()
 returns true in case of success
 
virtual void reset (ResetAction action)
 
virtual utils::status write_to_hardware ()
 returns true in case of success
 
utils::status config_from_json (JsonObjectConst cfg)
 Deserialize a new configuration for this entity and all its children from a JsonObject.
 
void config_to_json (JsonObject &cfg, bool recursive=true)
 Serialize the configuration for this entity to a JsonObject.
 
utils::status user_set_config (JsonObjectConst msg_in, JsonObject &msg_out)
 
utils::status user_get_config (JsonObjectConst msg_in, JsonObject &msg_out)
 
utils::status user_reset_config (JsonObjectConst msg_in, JsonObject &msg_out)
 
void classifier_to_json (JsonObject &out)
 Provide recursive entity information in a tree.
 

Protected Member Functions

virtual utils::status config_self_from_json (JsonObjectConst cfg)=0
 Deserialize a new configuration for this entity from a JsonObject.
 
utils::status config_children_from_json (JsonObjectConst &cfg)
 Deserialize a new configuration for all child entities from a JsonObject.
 
virtual void config_self_to_json (JsonObject &cfg)
 Serialize the configuration of this entity to a JsonObject.
 
void config_children_to_json (JsonObject &cfg)
 Serialize the configuration of the child entities of this entity to a JsonObject.
 

Protected Attributes

std::string entity_id
 
EntityClassifier classifier
 

Detailed Description

Definition at line 114 of file base.h.

Constructor & Destructor Documentation

◆ Entity() [1/2]

entities::Entity::Entity ( )
default

◆ Entity() [2/2]

entities::Entity::Entity ( std::string entityId)
inlineexplicit

Definition at line 121 of file base.h.

Member Function Documentation

◆ classifier_to_json()

FLASHMEM void entities::Entity::classifier_to_json ( JsonObject & out)

Provide recursive entity information in a tree.

Definition at line 125 of file base.cpp.

References utils::toString().

◆ config_children_from_json()

FLASHMEM utils::status entities::Entity::config_children_from_json ( JsonObjectConst & cfg)
protected

Deserialize a new configuration for all child entities from a JsonObject.

Does not include own configuration,

See also
config_self_from_json() instead.
Returns
true in case of success, else false

Definition at line 72 of file base.cpp.

References utils::status::success().

◆ config_children_to_json()

FLASHMEM void entities::Entity::config_children_to_json ( JsonObject & cfg)
protected

Serialize the configuration of the child entities of this entity to a JsonObject.

Does not include own configuration,

See also
config_self_to_json() instead.

Definition at line 89 of file base.cpp.

Referenced by config_to_json().

◆ config_from_json()

FLASHMEM utils::status entities::Entity::config_from_json ( JsonObjectConst cfg)

Deserialize a new configuration for this entity and all its children from a JsonObject.

Returns
true in case of success, else false

Definition at line 56 of file base.cpp.

References utils::status::success().

◆ config_self_from_json()

virtual utils::status entities::Entity::config_self_from_json ( JsonObjectConst cfg)
protectedpure virtual

Deserialize a new configuration for this entity from a JsonObject.

Implementations shall not traverse to children,

See also
config_children_from_json() instead.
Returns
true in case of success, else false

Implemented in blocks::CBlock, blocks::CTRLBlock, blocks::EmptyMBlock, blocks::IBlock, blocks::MIntBlock, blocks::SHBlock, blocks::TBlock, blocks::UBlock, carrier::Carrier, platform::Cluster, platform::LUCIDAC, platform::LUCIDACFrontPanel, and platform::REDACBackPanel.

◆ config_self_to_json()

virtual void entities::Entity::config_self_to_json ( JsonObject & cfg)
inlineprotectedvirtual

Serialize the configuration of this entity to a JsonObject.

Implementations shall not traverse to children,

See also
config_children_to_json() instead.

Reimplemented in blocks::CBlock, blocks::IBlock, blocks::MIntBlock, blocks::TBlock, blocks::UBlock, carrier::Carrier, platform::LUCIDAC, and platform::LUCIDACFrontPanel.

Definition at line 205 of file base.h.

Referenced by config_to_json().

◆ config_to_json()

void entities::Entity::config_to_json ( JsonObject & cfg,
bool recursive = true )
inline

Serialize the configuration for this entity to a JsonObject.

  • recursive If given, includes self configuration and all children.

Definition at line 170 of file base.h.

References config_children_to_json(), and config_self_to_json().

Referenced by user_get_config().

◆ get_child_entities()

virtual std::vector< Entity * > entities::Entity::get_child_entities ( )
pure virtual

◆ get_child_entity()

virtual Entity * entities::Entity::get_child_entity ( const std::string & child_id)
pure virtual

◆ get_entity_class()

FLASHMEM entities::EntityClass entities::Entity::get_entity_class ( ) const

Definition at line 21 of file base.cpp.

Referenced by is_entity_class().

◆ get_entity_classifier()

FLASHMEM entities::EntityClassifier entities::Entity::get_entity_classifier ( ) const

Definition at line 19 of file base.cpp.

References classifier.

◆ get_entity_eui()

◆ get_entity_id()

const std::string & entities::Entity::get_entity_id ( ) const
inline

Definition at line 123 of file base.h.

References entity_id.

◆ get_entity_type()

FLASHMEM uint8_t entities::Entity::get_entity_type ( ) const

Definition at line 23 of file base.cpp.

Referenced by is_entity_type().

◆ get_entity_variant()

FLASHMEM uint8_t entities::Entity::get_entity_variant ( ) const

Definition at line 27 of file base.cpp.

Referenced by is_entity_variant().

◆ get_entity_version()

FLASHMEM entities::Version entities::Entity::get_entity_version ( ) const

Definition at line 25 of file base.cpp.

Referenced by is_entity_version().

◆ init()

◆ is_entity_class()

bool entities::Entity::is_entity_class ( EntityClass class_) const
inline

Definition at line 135 of file base.h.

References get_entity_class().

◆ is_entity_type()

bool entities::Entity::is_entity_type ( uint8_t type_) const
inline

Definition at line 137 of file base.h.

References get_entity_type().

Referenced by blocks::MBlock::is_entity_type().

◆ is_entity_variant()

bool entities::Entity::is_entity_variant ( uint8_t variant_) const
inline

Definition at line 141 of file base.h.

References get_entity_variant().

◆ is_entity_version()

bool entities::Entity::is_entity_version ( Version version_) const
inline

Definition at line 139 of file base.h.

References get_entity_version().

◆ rename_entity()

void entities::Entity::rename_entity ( const std::string entityId)
inline

Definition at line 125 of file base.h.

References entity_id.

Referenced by platform::REDAC::init_backpanel_tblock().

◆ reset()

◆ resolve_child_entity() [1/3]

Entity * entities::Entity::resolve_child_entity ( JsonArrayConst path)
inline

Definition at line 150 of file base.h.

References resolve_child_entity().

Referenced by resolve_child_entity().

◆ resolve_child_entity() [2/3]

FLASHMEM entities::Entity * entities::Entity::resolve_child_entity ( JsonArrayConstIterator begin,
JsonArrayConstIterator end )

Definition at line 42 of file base.cpp.

◆ resolve_child_entity() [3/3]

FLASHMEM entities::Entity * entities::Entity::resolve_child_entity ( std::string paths[],
size_t len )

Definition at line 30 of file base.cpp.

◆ write_to_hardware()

virtual utils::status entities::Entity::write_to_hardware ( )
inlinenodiscardvirtual

Member Data Documentation

◆ classifier

◆ entity_id

std::string entities::Entity::entity_id
protected

Definition at line 116 of file base.h.

Referenced by get_entity_id(), and rename_entity().


The documentation for this class was generated from the following files:
  • lib/platform-lucidac/src/entity/base.h
  • lib/platform-lucidac/src/entity/base.cpp