2021-08-18 16:55:57 -04:00
|
|
|
/*
|
2021-08-24 18:10:20 -04:00
|
|
|
provenance.cpp
|
2021-08-18 16:55:57 -04:00
|
|
|
|
|
|
|
Copyright (c) 2021 Kevin Matz (kevin.matz@gmail.com)
|
|
|
|
|
|
|
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
|
|
of this software and associated documentation files (the "Software"), to deal
|
|
|
|
in the Software without restriction, including without limitation the rights
|
|
|
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
|
|
copies of the Software, and to permit persons to whom the Software is
|
|
|
|
furnished to do so, subject to the following conditions:
|
|
|
|
|
|
|
|
The above copyright notice and this permission notice shall be included in all
|
|
|
|
copies or substantial portions of the Software.
|
|
|
|
|
|
|
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
|
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
|
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
|
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
|
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
|
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
|
|
SOFTWARE.
|
|
|
|
*/
|
|
|
|
|
2021-08-24 18:10:20 -04:00
|
|
|
#include "provenance.h"
|
|
|
|
#include "rlp/rlp.h"
|
|
|
|
|
|
|
|
namespace SACN {
|
2021-08-18 16:55:57 -04:00
|
|
|
|
|
|
|
|
|
|
|
/**
|
2021-08-24 18:10:20 -04:00
|
|
|
* @brief Provenance::Provenance
|
2021-08-18 16:55:57 -04:00
|
|
|
*/
|
2021-08-24 18:10:20 -04:00
|
|
|
Provenance::Provenance()
|
|
|
|
: cid_(UUID::uuid())
|
|
|
|
, description_(std::string())
|
|
|
|
, universe_(0)
|
|
|
|
, priority_(100)
|
|
|
|
, sync_address_(0)
|
|
|
|
, options_(0)
|
|
|
|
{}
|
2021-08-18 16:55:57 -04:00
|
|
|
|
|
|
|
|
|
|
|
/**
|
2021-08-24 18:10:20 -04:00
|
|
|
* @brief Construct a Universe Source from an sACN frame PDU
|
|
|
|
* @param pdu
|
2021-08-18 16:55:57 -04:00
|
|
|
*/
|
2021-08-24 18:10:20 -04:00
|
|
|
Provenance::Provenance(std::shared_ptr<DATA::Pdu> pdu)
|
|
|
|
{
|
|
|
|
auto root_header = static_cast<ACN::RLP::rlp_header*>(pdu->parent()->header());
|
|
|
|
auto frame_header = static_cast<DATA::data_header*>(pdu->header());
|
2021-08-18 16:55:57 -04:00
|
|
|
|
2021-08-24 18:10:20 -04:00
|
|
|
cid_ = root_header->cid;
|
|
|
|
description_ = frame_header->source_name;
|
|
|
|
universe_ = frame_header->universe;
|
|
|
|
priority_ = frame_header->priority;
|
|
|
|
sync_address_ = frame_header->sync_address;
|
|
|
|
options_ = frame_header->options;
|
|
|
|
};
|
2021-08-18 16:55:57 -04:00
|
|
|
|
|
|
|
|
|
|
|
/**
|
2021-08-24 18:10:20 -04:00
|
|
|
* @brief operator ==
|
|
|
|
* @param a
|
|
|
|
* @param b
|
|
|
|
* @return
|
2021-08-18 16:55:57 -04:00
|
|
|
*/
|
2021-08-24 18:10:20 -04:00
|
|
|
bool operator== (const Provenance& a, const Provenance& b)
|
|
|
|
{
|
|
|
|
return (std::hash<Provenance>{}(a) == std::hash<Provenance>{}(b));
|
2021-08-18 16:55:57 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
2021-08-24 18:10:20 -04:00
|
|
|
} // namespace SACN
|