1
0
mirror of https://github.com/mfontanini/libtins synced 2026-01-23 02:35:57 +01:00

Added Packet constructor.

This commit is contained in:
Matias Fontanini
2014-08-07 19:58:41 -03:00
parent aed5ccdfca
commit 282cd0913c

View File

@@ -128,6 +128,13 @@ private:
*/
class Packet {
public:
/**
* Tag used to specify that a Packet should own a PDU pointer.
*/
struct own_pdu {
};
/**
* \brief Default constructs a Packet.
*
@@ -143,6 +150,17 @@ public:
*/
Packet(const PDU *apdu, const Timestamp &tstamp)
: pdu_(apdu->clone()), ts(tstamp) { }
/**
* \brief Constructs a Packet from a PDU* and a Timestamp.
*
* The PDU* will be owned by the Packet. This means you
* <b>do not</b> have to explicitly delete the pointer, that
* will be done automatically by the Packet when it goes out
* of scope.
*/
Packet(PDU *apdu, const Timestamp &tstamp, own_pdu)
: pdu_(apdu), ts(tstamp) { }
/**
* \brief Constructs a Packet from a const PDU&.