Nix (Dev) 3.5.10
dev - 3.5.10 - 1af9301
Loading...
Searching...
No Matches
iv::units::Unit Class Reference

#include <Unit.hpp>

Collaboration diagram for iv::units::Unit:
[legend]

Classes

struct  DefaultValues
 
struct  Keys
 
struct  Sections
 

Public Member Functions

 Unit ()
 
 Unit (iv::types::unitId id, iv::units::eUnitType unitType)
 
void update (const iv::units::Unit &other)
 
bool load (const iv::file::xml::File &xml)
 
bool save (const std::shared_ptr< iv::file::xml::File > &xml) const
 
std::shared_ptr< Unitclone () const
 
iv::types::unitId getId () const
 
std::optional< iv::units::eUnitTypegetType () const
 
iv::units::UnitInfogetUnitInfo ()
 
iv::types::timestamp getLastHeartbeat () const
 
bool hasChannels () const
 
void createSystemChannels ()
 
void initializeChannels (const std::shared_ptr< AbstractProgress > &progress)
 
std::shared_ptr< iv::channels::AbstractChannelextractChannel (iv::types::channelOrder channelOrder)
 
std::shared_ptr< iv::channels::AbstractChannelextractChannel (const iv::types::channelId &channelId)
 
bool changeChannelId (const iv::types::channelId &channelId, const iv::types::channelId &newChannelId)
 
bool changeChannelOrder (iv::types::channelOrder channelOrder, iv::types::channelOrder newChannelOrder)
 
bool deleteChannel (iv::types::channelOrder channelOrder)
 
bool deleteChannel (const iv::types::channelId &channelId)
 
std::weak_ptr< iv::channels::AbstractChannelcreateChannel (iv::channels::eChannelSpecificType channelType, std::optional< iv::types::channelOrder > channelOrder=std::nullopt, const std::optional< iv::types::channelId > &channelId=std::nullopt)
 
bool insertChannel (std::shared_ptr< iv::channels::AbstractChannel > channel)
 
std::weak_ptr< iv::channels::AbstractChannelgetChannel (iv::types::channelOrder channelOrder) const
 
std::weak_ptr< iv::channels::AbstractChannelgetChannel (const iv::types::channelId &channelId) const
 
std::weak_ptr< iv::channels::AbstractChannelgetChannelByShipyardTag (const std::string &channelTag)
 
const std::unordered_map< iv::types::channelId, std::shared_ptr< iv::channels::AbstractChannel > > & getChannels () const
 
const std::map< iv::types::channelOrder, std::shared_ptr< iv::channels::AbstractChannel > > & getActiveChannels (bool refreshCache=false) const
 
const std::map< iv::types::channelOrder, std::shared_ptr< iv::channels::AbstractChannel > > & getChannelsByOrder () const
 
std::shared_ptr< std::vector< std::weak_ptr< iv::channels::AbstractChannel > > > getActiveChannelsByGroupId (const iv::types::groupId &groupId, bool refreshCache=false) const
 Get all channels in the unit that belong to the group.
 
std::map< iv::types::indexChannel, std::shared_ptr< iv::channels::AbstractChannel > > & getChannelsByIndex ()
 
std::optional< iv::types::channelOrdergetFirstFreeChannelOrder (std::optional< iv::channels::eChannelSpecificType > channelType=std::nullopt, const std::optional< std::function< bool(iv::types::channelOrder)> > &addedCondition=std::nullopt) const
 
std::pair< iv::alarms::eAlarmState, iv::alarms::eAlarmPrioritycalculateUnitAlarmStatePriority () const
 
void setOfflineChannel (const std::weak_ptr< iv::channels::AbstractChannel > &offlineChannel)
 
void setCanAFailChannel (const std::weak_ptr< iv::channels::AbstractChannel > &canAFailChannel)
 
void setCanBFailChannel (const std::weak_ptr< iv::channels::AbstractChannel > &canBFailChannel)
 
void setCanCFailChannel (const std::weak_ptr< iv::channels::AbstractChannel > &canCFailChannel)
 
void setHeartbeatChannel (const std::weak_ptr< iv::channels::AbstractChannel > &heartbeatChannel)
 
std::weak_ptr< iv::channels::AbstractChannelgetOfflineChannel ()
 
std::weak_ptr< iv::channels::AbstractChannelgetCanAFailChannel ()
 
std::weak_ptr< iv::channels::AbstractChannelgetCanBFailChannel ()
 
std::weak_ptr< iv::channels::AbstractChannelgetCanCFailChannel ()
 
std::weak_ptr< iv::channels::AbstractChannelgetHeartbeatChannel ()
 
void setLasHeartbeat (iv::comms::eLomLine line, iv::types::timestamp timestamp)
 
iv::types::timestamp getLastHeartbeat (iv::comms::eLomLine line) const
 
bool isStation () const
 
bool isLIM () const
 
bool isLOM () const
 
std::string getName (bool isNotInProjectUnit=false) const
 
bool isOn () const
 
bool existsChannel (const iv::types::channelId &channelId) const
 
bool isOnOnCanLine (comms::eLomLine line) const
 
void prvCreateLomSystemChannels ()
 
void prvCreateKLimSystemChannels ()
 

Public Attributes

bool m_isEnabled {true}
 
std::optional< iv::comms::eHeartbeatStatem_lastHeartbeatState
 
iv::types::unitId m_id {0}
 
std::string m_internalDescription
 
iv::types::cabinetId m_cabinetId
 
std::optional< iv::units::eUnitTypem_unitType
 
iv::units::UnitInfo m_unitInfo {}
 
std::mutex m_lomCommunicationMutex
 

Private Member Functions

bool changeChannelsDefaultId (const iv::types::unitId &newUnitId)
 esto ahora debe funcionar diferente
 
void updateChannelsUnitId ()
 

Private Attributes

std::unordered_map< iv::types::channelId, std::shared_ptr< iv::channels::AbstractChannel > > m_channels
 
std::map< iv::types::channelOrder, std::shared_ptr< iv::channels::AbstractChannel > > m_channelsByOrder
 
std::map< iv::types::indexChannel, std::shared_ptr< iv::channels::AbstractChannel > > m_channelsByIndex
 
std::optional< std::map< iv::types::channelOrder, std::shared_ptr< iv::channels::AbstractChannel > > > m_activeChannelsByOrder
 
std::map< iv::types::groupId, std::shared_ptr< std::vector< std::weak_ptr< iv::channels::AbstractChannel > > > > m_channelsByGroupId
 
std::weak_ptr< iv::channels::AbstractChannelm_offlineChannel
 
std::weak_ptr< iv::channels::AbstractChannelm_canAFailChannel
 
std::weak_ptr< iv::channels::AbstractChannelm_canBFailChannel
 
std::weak_ptr< iv::channels::AbstractChannelm_canCFailChannel
 
std::weak_ptr< iv::channels::AbstractChannelm_heartbeatChannel
 
std::map< iv::comms::eLomLine, iv::types::timestampm_lastHeartbeat
 

Friends

class Units
 

Constructor & Destructor Documentation

◆ Unit() [1/2]

iv::units::Unit::Unit ( )

◆ Unit() [2/2]

iv::units::Unit::Unit ( iv::types::unitId id,
iv::units::eUnitType unitType )

Member Function Documentation

◆ calculateUnitAlarmStatePriority()

std::pair< iv::alarms::eAlarmState, iv::alarms::eAlarmPriority > iv::units::Unit::calculateUnitAlarmStatePriority ( ) const

◆ changeChannelId()

bool iv::units::Unit::changeChannelId ( const iv::types::channelId & channelId,
const iv::types::channelId & newChannelId )

◆ changeChannelOrder()

bool iv::units::Unit::changeChannelOrder ( iv::types::channelOrder channelOrder,
iv::types::channelOrder newChannelOrder )

◆ changeChannelsDefaultId()

bool iv::units::Unit::changeChannelsDefaultId ( const iv::types::unitId & newUnitId)
private

esto ahora debe funcionar diferente

◆ clone()

std::shared_ptr< Unit > iv::units::Unit::clone ( ) const
nodiscard

◆ createChannel()

std::weak_ptr< iv::channels::AbstractChannel > iv::units::Unit::createChannel ( iv::channels::eChannelSpecificType channelType,
std::optional< iv::types::channelOrder > channelOrder = std::nullopt,
const std::optional< iv::types::channelId > & channelId = std::nullopt )

◆ createSystemChannels()

void iv::units::Unit::createSystemChannels ( )

◆ deleteChannel() [1/2]

bool iv::units::Unit::deleteChannel ( const iv::types::channelId & channelId)

◆ deleteChannel() [2/2]

bool iv::units::Unit::deleteChannel ( iv::types::channelOrder channelOrder)

◆ existsChannel()

bool iv::units::Unit::existsChannel ( const iv::types::channelId & channelId) const
nodiscard

◆ extractChannel() [1/2]

std::shared_ptr< iv::channels::AbstractChannel > iv::units::Unit::extractChannel ( const iv::types::channelId & channelId)
nodiscard

◆ extractChannel() [2/2]

std::shared_ptr< iv::channels::AbstractChannel > iv::units::Unit::extractChannel ( iv::types::channelOrder channelOrder)
nodiscard

◆ getActiveChannels()

const std::map< iv::types::channelOrder, std::shared_ptr< iv::channels::AbstractChannel > > & iv::units::Unit::getActiveChannels ( bool refreshCache = false) const

◆ getActiveChannelsByGroupId()

std::shared_ptr< std::vector< std::weak_ptr< iv::channels::AbstractChannel > > > iv::units::Unit::getActiveChannelsByGroupId ( const iv::types::groupId & groupId,
bool refreshCache = false ) const
nodiscard

Get all channels in the unit that belong to the group.

Parameters
groupIdID of the group
refreshCacheIf true, the cache will be refreshed
Returns
vector of weak pointers to the channels, ordered by channel order

◆ getCanAFailChannel()

std::weak_ptr< iv::channels::AbstractChannel > iv::units::Unit::getCanAFailChannel ( )

◆ getCanBFailChannel()

std::weak_ptr< iv::channels::AbstractChannel > iv::units::Unit::getCanBFailChannel ( )

◆ getCanCFailChannel()

std::weak_ptr< iv::channels::AbstractChannel > iv::units::Unit::getCanCFailChannel ( )

◆ getChannel() [1/2]

std::weak_ptr< iv::channels::AbstractChannel > iv::units::Unit::getChannel ( const iv::types::channelId & channelId) const
nodiscard

◆ getChannel() [2/2]

std::weak_ptr< iv::channels::AbstractChannel > iv::units::Unit::getChannel ( iv::types::channelOrder channelOrder) const
nodiscard

◆ getChannelByShipyardTag()

std::weak_ptr< iv::channels::AbstractChannel > iv::units::Unit::getChannelByShipyardTag ( const std::string & channelTag)
nodiscard

◆ getChannels()

const std::unordered_map< iv::types::channelId, std::shared_ptr< iv::channels::AbstractChannel > > & iv::units::Unit::getChannels ( ) const
nodiscard

◆ getChannelsByIndex()

std::map< iv::types::indexChannel, std::shared_ptr< iv::channels::AbstractChannel > > & iv::units::Unit::getChannelsByIndex ( )
nodiscard

◆ getChannelsByOrder()

const std::map< iv::types::channelOrder, std::shared_ptr< iv::channels::AbstractChannel > > & iv::units::Unit::getChannelsByOrder ( ) const
nodiscard

◆ getFirstFreeChannelOrder()

std::optional< iv::types::channelOrder > iv::units::Unit::getFirstFreeChannelOrder ( std::optional< iv::channels::eChannelSpecificType > channelType = std::nullopt,
const std::optional< std::function< bool(iv::types::channelOrder)> > & addedCondition = std::nullopt ) const
nodiscard

◆ getHeartbeatChannel()

std::weak_ptr< iv::channels::AbstractChannel > iv::units::Unit::getHeartbeatChannel ( )

◆ getId()

iv::types::unitId iv::units::Unit::getId ( ) const
nodiscard

◆ getLastHeartbeat() [1/2]

iv::types::timestamp iv::units::Unit::getLastHeartbeat ( ) const
nodiscard

◆ getLastHeartbeat() [2/2]

iv::types::timestamp iv::units::Unit::getLastHeartbeat ( iv::comms::eLomLine line) const

◆ getName()

std::string iv::units::Unit::getName ( bool isNotInProjectUnit = false) const
nodiscard

◆ getOfflineChannel()

std::weak_ptr< iv::channels::AbstractChannel > iv::units::Unit::getOfflineChannel ( )

◆ getType()

std::optional< iv::units::eUnitType > iv::units::Unit::getType ( ) const
nodiscard

◆ getUnitInfo()

iv::units::UnitInfo & iv::units::Unit::getUnitInfo ( )
nodiscard

◆ hasChannels()

bool iv::units::Unit::hasChannels ( ) const
nodiscard

◆ initializeChannels()

void iv::units::Unit::initializeChannels ( const std::shared_ptr< AbstractProgress > & progress)

◆ insertChannel()

bool iv::units::Unit::insertChannel ( std::shared_ptr< iv::channels::AbstractChannel > channel)

◆ isLIM()

bool iv::units::Unit::isLIM ( ) const
nodiscard

◆ isLOM()

bool iv::units::Unit::isLOM ( ) const
nodiscard

◆ isOn()

bool iv::units::Unit::isOn ( ) const
nodiscard

◆ isOnOnCanLine()

bool iv::units::Unit::isOnOnCanLine ( comms::eLomLine line) const

◆ isStation()

bool iv::units::Unit::isStation ( ) const
nodiscard

◆ load()

bool iv::units::Unit::load ( const iv::file::xml::File & xml)

◆ prvCreateKLimSystemChannels()

void iv::units::Unit::prvCreateKLimSystemChannels ( )

◆ prvCreateLomSystemChannels()

void iv::units::Unit::prvCreateLomSystemChannels ( )

◆ save()

bool iv::units::Unit::save ( const std::shared_ptr< iv::file::xml::File > & xml) const

◆ setCanAFailChannel()

void iv::units::Unit::setCanAFailChannel ( const std::weak_ptr< iv::channels::AbstractChannel > & canAFailChannel)

◆ setCanBFailChannel()

void iv::units::Unit::setCanBFailChannel ( const std::weak_ptr< iv::channels::AbstractChannel > & canBFailChannel)

◆ setCanCFailChannel()

void iv::units::Unit::setCanCFailChannel ( const std::weak_ptr< iv::channels::AbstractChannel > & canCFailChannel)

◆ setHeartbeatChannel()

void iv::units::Unit::setHeartbeatChannel ( const std::weak_ptr< iv::channels::AbstractChannel > & heartbeatChannel)

◆ setLasHeartbeat()

void iv::units::Unit::setLasHeartbeat ( iv::comms::eLomLine line,
iv::types::timestamp timestamp )

◆ setOfflineChannel()

void iv::units::Unit::setOfflineChannel ( const std::weak_ptr< iv::channels::AbstractChannel > & offlineChannel)

◆ update()

void iv::units::Unit::update ( const iv::units::Unit & other)

◆ updateChannelsUnitId()

void iv::units::Unit::updateChannelsUnitId ( )
private

Friends And Related Symbol Documentation

◆ Units

friend class Units
friend

Member Data Documentation

◆ m_activeChannelsByOrder

std::optional<std::map<iv::types::channelOrder, std::shared_ptr<iv::channels::AbstractChannel> > > iv::units::Unit::m_activeChannelsByOrder
mutableprivate

Diamar perforomance optimization

◆ m_cabinetId

iv::types::cabinetId iv::units::Unit::m_cabinetId

◆ m_canAFailChannel

std::weak_ptr<iv::channels::AbstractChannel> iv::units::Unit::m_canAFailChannel
private

◆ m_canBFailChannel

std::weak_ptr<iv::channels::AbstractChannel> iv::units::Unit::m_canBFailChannel
private

◆ m_canCFailChannel

std::weak_ptr<iv::channels::AbstractChannel> iv::units::Unit::m_canCFailChannel
private

◆ m_channels

std::unordered_map<iv::types::channelId, std::shared_ptr<iv::channels::AbstractChannel> > iv::units::Unit::m_channels
private

◆ m_channelsByGroupId

std::map<iv::types::groupId, std::shared_ptr<std::vector<std::weak_ptr<iv::channels::AbstractChannel> > > > iv::units::Unit::m_channelsByGroupId
mutableprivate

◆ m_channelsByIndex

std::map<iv::types::indexChannel, std::shared_ptr<iv::channels::AbstractChannel> > iv::units::Unit::m_channelsByIndex
private

◆ m_channelsByOrder

std::map<iv::types::channelOrder, std::shared_ptr<iv::channels::AbstractChannel> > iv::units::Unit::m_channelsByOrder
private

Info redundant for performance

◆ m_heartbeatChannel

std::weak_ptr<iv::channels::AbstractChannel> iv::units::Unit::m_heartbeatChannel
private

◆ m_id

iv::types::unitId iv::units::Unit::m_id {0}

◆ m_internalDescription

std::string iv::units::Unit::m_internalDescription

◆ m_isEnabled

bool iv::units::Unit::m_isEnabled {true}

◆ m_lastHeartbeat

std::map<iv::comms::eLomLine, iv::types::timestamp> iv::units::Unit::m_lastHeartbeat
private

◆ m_lastHeartbeatState

std::optional<iv::comms::eHeartbeatState> iv::units::Unit::m_lastHeartbeatState

◆ m_lomCommunicationMutex

std::mutex iv::units::Unit::m_lomCommunicationMutex

◆ m_offlineChannel

std::weak_ptr<iv::channels::AbstractChannel> iv::units::Unit::m_offlineChannel
private

◆ m_unitInfo

iv::units::UnitInfo iv::units::Unit::m_unitInfo {}

◆ m_unitType

std::optional<iv::units::eUnitType> iv::units::Unit::m_unitType

The documentation for this class was generated from the following files: