SpikeStream Library
0.2
|
00001 #include "GlobalVariables.h" 00002 #include "ArchiveInfo.h" 00003 #include "SpikeStreamException.h" 00004 using namespace spikestream; 00005 00006 00008 ArchiveInfo::ArchiveInfo(){ 00009 reset(); 00010 } 00011 00012 00014 ArchiveInfo::ArchiveInfo(unsigned int id, unsigned int networkID, unsigned int unixTimestamp, const QString& description){ 00015 //Check that name and description will fit in the database 00016 if(description.size() > MAX_DATABASE_DESCRIPTION_LENGTH) 00017 throw SpikeStreamException("Archive description length exceeds maximum possible size in database."); 00018 00019 this->id = id; 00020 this->networkID = networkID; 00021 this->startDateTime = QDateTime::fromTime_t(unixTimestamp); 00022 this->description = description; 00023 } 00024 00025 00027 ArchiveInfo::ArchiveInfo(const ArchiveInfo& archInfo){ 00028 this->id = archInfo.id; 00029 this->networkID = archInfo.networkID; 00030 this->startDateTime = archInfo.startDateTime; 00031 this->description = archInfo.description; 00032 } 00033 00034 00036 ArchiveInfo::~ArchiveInfo(){ 00037 } 00038 00039 00040 /*----------------------------------------------------------*/ 00041 /*----- PUBLIC METHODS -----*/ 00042 /*----------------------------------------------------------*/ 00043 00044 00046 ArchiveInfo& ArchiveInfo::operator=(const ArchiveInfo& rhs){ 00047 //Check for self assignment 00048 if(this == &rhs) 00049 return *this; 00050 00051 this->id = rhs.id; 00052 this->networkID = rhs.networkID; 00053 this->startDateTime = rhs.startDateTime; 00054 this->description = rhs.description; 00055 return *this; 00056 } 00057 00059 void ArchiveInfo::reset(){ 00060 this->id = 0; 00061 this->networkID = 0; 00062 this->startDateTime = QDateTime::fromTime_t(0); 00063 this->description = "Undescribed"; 00064 } 00065 00066