Nix (Dev) 3.5.10
dev - 3.5.10 - 1af9301
Loading...
Searching...
No Matches
CLogicsComponent.hpp
Go to the documentation of this file.
1#ifndef LIBS_LOGIC_CLOGICSCOMPONENT_HPP_
2#define LIBS_LOGIC_CLOGICSCOMPONENT_HPP_
3
7#include "logic/types.hpp"
9
10#include <bits/stdint-uintn.h>
11#include <cstddef>
12#include <map>
13#include <string>
14#include <tuple>
15#include <vector>
16
22class CLogicsComponent : public AbstractLogicsElement, public std::enable_shared_from_this<CLogicsComponent>
23{
24public:
25 typedef std::map<AbstractCanvasItem::TId, std::shared_ptr<CLogicsConnectionPoint>> TMapIdConnPoint;
26
27 static iv::logic::eGeneralType enumGeneralType(const std::string &strType);
28
29 static std::string strGeneralType(iv::logic::eGeneralType generalType);
30
32 const iv::file::xml::node &node);// need to read first the type in order to read the rest of the component.
33 static bool hasExecutionOrder(const iv::types::logic::ComponentType &componentTypeTuple);
34 static bool isExecBlock(const iv::types::logic::ComponentType &componentTypeTuple);
35 static bool isLibraryBlock(const iv::types::logic::ComponentType &componentTypeTuple);
36
37 explicit CLogicsComponent(const iv::types::logic::ComponentType &componentTypeTuple);
39 const std::string &name);
40 CLogicsComponent() = delete;
41 ~CLogicsComponent() override = default;
42 CLogicsComponent(const CLogicsComponent &other) = delete;
46
47 iv::file::xml::node read(const iv::file::xml::node &node) override;
48 iv::file::xml::node save(iv::file::xml::node &node) const override;
49
50 std::vector<std::shared_ptr<AbstractCanvasItem>> getLinkedItems() override;
51 void updateLinkedItems() override;
52 void resetLinkedItems() override;
53
54 void addConnectionPointInput(const std::shared_ptr<CLogicsConnectionPoint> &connectionPoint);
55 void addConnectionPointOutput(const std::shared_ptr<CLogicsConnectionPoint> &connectionPoint);
56
57 [[nodiscard]] size_t numberOfInputs() const;
58 [[nodiscard]] size_t numberOfOutputs() const;
59
60 [[nodiscard]] bool isAllConnected() const;
61
63 [[nodiscard]] const iv::logic::eGeneralType &getComponentGeneralType() const;
64 [[nodiscard]] const iv::types::logic::componentType &getComponentType() const;
65 [[nodiscard]] const iv::types::logic::ComponentType &getComponentTypeTuple() const;
66 [[nodiscard]] std::shared_ptr<CLogicsConnectionPoint> getConnectionPoint(iv::logic::eDBBlockParamType pointType,
68 [[nodiscard]] std::shared_ptr<CLogicsConnectionPoint> getFirstInputConnectionPoint() const;
69 [[nodiscard]] std::shared_ptr<CLogicsConnectionPoint> getInputConnectionPoint(uint32_t index);
70 [[nodiscard]] std::shared_ptr<CLogicsConnectionPoint> getFirstOutputConnectionPoint() const;
71 [[nodiscard]] std::shared_ptr<CLogicsConnectionPoint> getOutputConnectionPoint(uint32_t index);
73 [[nodiscard]] const TMapIdConnPoint &getInputRefsConst() const;
75 [[nodiscard]] const TMapIdConnPoint &getOutputRefsConst() const;
76
77 [[nodiscard]] std::set<std::shared_ptr<CLogicsConnectionPoint>> getConnectionPoints() const;
78
79protected:
80 virtual std::optional<uint32_t> getIndexOfConnectionForParam(iv::logic::eDBBlockParamType type,
82
83private:
87};
88
89#endif /* LIBS_LOGIC_CLOGICSCOMPONENT_HPP_ */
uint32_t TId
Definition AbstractCanvasItem.hpp:47
Definition AbstractLogicsElement.hpp:15
Definition CLogicsComponent.hpp:23
virtual std::optional< uint32_t > getIndexOfConnectionForParam(iv::logic::eDBBlockParamType type, iv::types::logic::paramNumber number) const
Definition CLogicsComponent.cpp:364
std::shared_ptr< CLogicsConnectionPoint > getFirstInputConnectionPoint() const
Definition CLogicsComponent.cpp:283
CLogicsComponent & operator=(const CLogicsComponent &other)=delete
~CLogicsComponent() override=default
CLogicsComponent & operator=(CLogicsComponent &&other)=delete
iv::types::logic::ComponentType m_componentTypeTuple
Definition CLogicsComponent.hpp:84
const TMapIdConnPoint & getOutputRefsConst() const
Definition CLogicsComponent.cpp:342
TMapIdConnPoint m_inputRefs
Definition CLogicsComponent.hpp:85
std::shared_ptr< CLogicsConnectionPoint > getConnectionPoint(iv::logic::eDBBlockParamType pointType, iv::types::logic::paramNumber paramNum)
Definition CLogicsComponent.cpp:263
static std::string strGeneralType(iv::logic::eGeneralType generalType)
Definition CLogicsComponent.cpp:43
const TMapIdConnPoint & getInputRefsConst() const
Definition CLogicsComponent.cpp:332
std::vector< std::shared_ptr< AbstractCanvasItem > > getLinkedItems() override
Definition CLogicsComponent.cpp:138
iv::file::xml::node save(iv::file::xml::node &node) const override
Definition CLogicsComponent.cpp:121
size_t numberOfInputs() const
Definition CLogicsComponent.cpp:223
static bool isExecBlock(const iv::types::logic::ComponentType &componentTypeTuple)
Definition CLogicsComponent.cpp:80
const iv::types::logic::componentType & getComponentType() const
Definition CLogicsComponent.cpp:253
void addConnectionPointOutput(const std::shared_ptr< CLogicsConnectionPoint > &connectionPoint)
Definition CLogicsComponent.cpp:218
const iv::types::logic::componentFinalType & getComponentFinalType() const
Definition CLogicsComponent.cpp:243
static iv::logic::eGeneralType enumGeneralType(const std::string &strType)
Definition CLogicsComponent.cpp:30
std::shared_ptr< CLogicsConnectionPoint > getOutputConnectionPoint(uint32_t index)
Definition CLogicsComponent.cpp:315
CLogicsComponent()=delete
TMapIdConnPoint m_outputRefs
Definition CLogicsComponent.hpp:86
TMapIdConnPoint getOutputRefs()
Definition CLogicsComponent.cpp:337
static bool hasExecutionOrder(const iv::types::logic::ComponentType &componentTypeTuple)
Definition CLogicsComponent.cpp:74
void addConnectionPointInput(const std::shared_ptr< CLogicsConnectionPoint > &connectionPoint)
Definition CLogicsComponent.cpp:213
CLogicsComponent(const CLogicsComponent &other)=delete
TMapIdConnPoint getInputRefs()
Definition CLogicsComponent.cpp:327
static iv::types::logic::ComponentType readLogicsComponentTypeTuple(const iv::file::xml::node &node)
Definition CLogicsComponent.cpp:56
std::shared_ptr< CLogicsConnectionPoint > getFirstOutputConnectionPoint() const
Definition CLogicsComponent.cpp:305
const iv::logic::eGeneralType & getComponentGeneralType() const
Definition CLogicsComponent.cpp:248
std::set< std::shared_ptr< CLogicsConnectionPoint > > getConnectionPoints() const
Definition CLogicsComponent.cpp:347
size_t numberOfOutputs() const
Definition CLogicsComponent.cpp:228
iv::file::xml::node read(const iv::file::xml::node &node) override
Definition CLogicsComponent.cpp:103
std::map< AbstractCanvasItem::TId, std::shared_ptr< CLogicsConnectionPoint > > TMapIdConnPoint
Definition CLogicsComponent.hpp:25
void resetLinkedItems() override
Definition CLogicsComponent.cpp:200
static bool isLibraryBlock(const iv::types::logic::ComponentType &componentTypeTuple)
Definition CLogicsComponent.cpp:85
const iv::types::logic::ComponentType & getComponentTypeTuple() const
Definition CLogicsComponent.cpp:258
void updateLinkedItems() override
Definition CLogicsComponent.cpp:155
bool isAllConnected() const
Definition CLogicsComponent.cpp:233
std::shared_ptr< CLogicsConnectionPoint > getInputConnectionPoint(uint32_t index)
Definition CLogicsComponent.cpp:293
CLogicsComponent(CLogicsComponent &&other)=delete
Definition xmlFile.hpp:15
eGeneralType
Definition enums.hpp:19
eDBBlockParamType
Definition defines.hpp:20
uint32_t componentType
Definition types.hpp:11
uint32_t paramNumber
Definition types.hpp:136
uint32_t componentFinalType
Definition types.hpp:12
Tuple containing the type of logic component (logic blocks, library blocks & others blocks).
Definition types.hpp:22