diff --git a/ajaanc/includes/ancillarylist.h b/ajaanc/includes/ancillarylist.h index 1f29ba2d8..6fba84a79 100644 --- a/ajaanc/includes/ancillarylist.h +++ b/ajaanc/includes/ancillarylist.h @@ -176,6 +176,9 @@ class AJAExport AJAAncillaryList ///@{ AJAAncillaryList (); ///< @brief Instantiate and initialize with a default set of values. inline AJAAncillaryList (const AJAAncillaryList & inRHS) {*this = inRHS;} ///< @brief My copy constructor. +#if defined(AJA_USE_CPLUSPLUS11) + AJAAncillaryList (AJAAncillaryList && inRHS); ///< @brief Move-construct constructor. +#endif virtual ~AJAAncillaryList (); ///< @brief My destructor. /** @@ -186,6 +189,15 @@ class AJAExport AJAAncillaryList virtual AJAAncillaryList & operator = (const AJAAncillaryList & inRHS); ///@} +#if defined(AJA_USE_CPLUSPLUS11) + /** + @brief Move-assignment operator -- moves contents from the right-hand-side to my contents, replacing my contents, and resets the right-hand-side. + @param[in] inRHS The list of packets to be move into me. + @return An r-value reference to myself. + **/ + virtual AJAAncillaryList & operator = (AJAAncillaryList && inRHS); +#endif + /** @name Fetching, Searching & Enumerating Packets diff --git a/ajaanc/src/ancillarylist.cpp b/ajaanc/src/ancillarylist.cpp index 0dfbe66eb..5ab6c12f7 100644 --- a/ajaanc/src/ancillarylist.cpp +++ b/ajaanc/src/ancillarylist.cpp @@ -17,6 +17,9 @@ #if defined(AJAANCLISTIMPL_VECTOR) #include #endif +#if defined(AJA_USE_CPLUSPLUS11) + #include // For std::move +#endif using namespace std; @@ -163,6 +166,21 @@ AJAAncillaryList::AJAAncillaryList () SetAnalogAncillaryDataTypeForLine (285, AJAAncDataType_Cea608_Line21); } +#if defined(AJA_USE_CPLUSPLUS11) +AJAAncillaryList::AJAAncillaryList(AJAAncillaryList && inRHS) + : m_ancList(std::move(inRHS.m_ancList)), + m_rcvMultiRTP(inRHS.m_rcvMultiRTP), + m_xmitMultiRTP(inRHS.m_xmitMultiRTP), + m_ignoreCS(inRHS.m_ignoreCS) +{ + // Reset RHS. + inRHS.m_rcvMultiRTP = true; + inRHS.m_xmitMultiRTP = false; + inRHS.m_ignoreCS = false; + // inRHS.m_ancList - already moved/reset. +} +#endif + AJAAncillaryList::~AJAAncillaryList () { @@ -185,6 +203,26 @@ AJAAncillaryList & AJAAncillaryList::operator = (const AJAAncillaryList & inRHS) return *this; } +#if defined(AJA_USE_CPLUSPLUS11) +AJAAncillaryList & AJAAncillaryList::operator = (AJAAncillaryList && inRHS) +{ + if (this != &inRHS) + { + m_xmitMultiRTP = inRHS.m_xmitMultiRTP; + inRHS.m_xmitMultiRTP = false; + + m_rcvMultiRTP = inRHS.m_rcvMultiRTP; + inRHS.m_rcvMultiRTP = true; + + m_ignoreCS = inRHS.m_ignoreCS; + inRHS.m_ignoreCS = false; + + Clear(); // Clear down any packets currently being held in 'this' + m_ancList = std::move(inRHS.m_ancList); + } + return *this; +} +#endif AJAAncillaryData * AJAAncillaryList::GetAncillaryDataAtIndex (const uint32_t inIndex) const {