.. _program_listing_file_src_cue_event.cpp: Program Listing for File event.cpp ================================== |exhale_lsh| :ref:`Return to documentation for file ` (``src/cue/event.cpp``) .. |exhale_lsh| unicode:: U+021B0 .. UPWARDS ARROW WITH TIP LEFTWARDS .. code-block:: cpp /* * * Event.cpp - Base class for Show events. */ #include "../cue/cuecontroller.h" #include "event.h" using namespace PixelMaestro; namespace PixelMaestro { Event::Event(uint32_t time, uint8_t* cue) { set_time(time); set_cue(cue); } Event::Event(const Event& other) { set_cue(other.cue_); this->time_ = other.time_; } Event& Event::operator=(const Event& other) { set_cue(other.cue_); this->time_ = other.time_; return *this; } uint8_t* Event::get_cue() const { return cue_; } uint32_t Event::get_time() const { return time_; } bool Event::operator ==(const Event& other) { bool match = false; if (other.get_time() == this->time_) { uint32_t size = IntByteConvert::byte_to_uint32(&other.get_cue()[(uint8_t)CueController::Byte::SizeByte1]); for (uint32_t i = 0; i < size; i++) { if (other.get_cue()[i] != cue_[i]) { return match; } } match = true; } return match; } void Event::set_cue(uint8_t* cue) { delete [] this->cue_; uint32_t size = IntByteConvert::byte_to_uint32(&cue[(uint8_t)CueController::Byte::SizeByte1]); this->cue_ = new uint8_t[size]; for (uint32_t i = 0; i < size; i++) { this->cue_[i] = cue[i]; } } void Event::set_time(uint32_t time) { this->time_ = time; } Event::~Event() { delete[] cue_; } }