1
0
Fork 0

be explicit when using shared pointers

This commit is contained in:
Kevin Matz 2023-05-18 15:37:27 -04:00
parent c4ab516efe
commit f01b3c8a56
1 changed files with 12 additions and 11 deletions

View File

@ -42,6 +42,7 @@ namespace ACN::PDU {
class Pdu; // forward declare
/**
* @brief The pdu_header struct
*/
@ -85,12 +86,12 @@ struct Block
/**
* @brief member Messages of this block
*/
std::vector<Message<T>> pdu;
std::vector<std::shared_ptr<T>> pdu;
/**
* @brief setParent
* @param parent
*/
void setParent(Message<Pdu> parent) {
void setParent(std::shared_ptr<Pdu> parent) {
for (auto &p : pdu)
p->setParent(parent);
}
@ -163,7 +164,7 @@ public:
uint32_t vector(); // may inherit
std::shared_ptr<pdu_header> header(); // may inherit
std::shared_ptr<pdu_data> data(); // may inherit
Message<Pdu> parent();
std::shared_ptr<Pdu> parent();
Stream stream();
virtual size_t streamSize() const override;
virtual void iStream(Stream) override;
@ -173,8 +174,8 @@ public:
void setVector (const uint32_t);
void setHeader (std::shared_ptr<pdu_header>);
void setData (std::shared_ptr<pdu_data>);
void setParent (Message<Pdu> pdu);
void setInherit(Message<Pdu> pdu);
void setParent (std::shared_ptr<Pdu> pdu);
void setInherit(std::shared_ptr<Pdu> pdu);
// protocol payloads
/**
@ -220,12 +221,12 @@ public:
}
protected:
pdu_flags flags_; //!< flags for length, vector, header and data
uint32_t vector_ = 0; //!< vector of this PDU
size_t vector_size_; //!< width (numbe of octets) of the vector
Message<Pdu> parent_; //!< parent PDU
Message<Pdu> inherit_; //!< PDU from which to inherit
Stream stream_; //!< buffer
pdu_flags flags_; //!< flags for length, vector, header and data
uint32_t vector_ = 0; //!< vector of this PDU
size_t vector_size_; //!< width (numbe of octets) of the vector
std::shared_ptr<Pdu> parent_; //!< parent PDU
std::shared_ptr<Pdu> inherit_; //!< PDU from which to inherit
std::shared_ptr<bufferstream> stream_; //!< buffer
std::shared_ptr<pdu_header> header_ = nullptr; //!< header segment
std::shared_ptr<pdu_data> data_ = nullptr; //!< data segment
};