// $Revision: 1.5 $ // Copyright (C) 1994, 1995 Taligent, Inc. All rights reserved. #ifndef TaligentSamples_STOCKDAY #include "StockDay.h" #endif //============================================================================== // TStockDay TStockDay::TStockDay() : fDate(), fHigh(0.0), fLow(0.0), fClose(0.0), fVolume(0) { } TStockDay::TStockDay(const TDays& date, StockValue high, StockValue low, StockValue close, StockVolume volume) : fDate(date), fHigh(high), fLow(low), fClose(close), fVolume(volume) { } TStockDay::TStockDay(const TStockDay& source) : fDate(source.fDate), fHigh(source.fHigh), fLow(source.fLow), fClose(source.fClose), fVolume(source.fVolume) { } TStockDay::~TStockDay() { } TStockDay& TStockDay::operator=(const TStockDay& source) { if (&source != this) { fDate = source.fDate; fHigh = source.fHigh; fLow = source.fLow; fClose = source.fClose; fVolume = source.fVolume; } return *this; } TStream& TStockDay::operator>>=(TStream& toStream) const { ::WriteVersion(toStream, kOriginalVersion); fDate >>= toStream; fHigh >>= toStream; fLow >>= toStream; fClose >>= toStream; fVolume >>= toStream; return toStream; } TStream& TStockDay::operator<<=(TStream& fromStream) { ::ReadVersion(fromStream, kOriginalVersion, kOriginalVersion); fDate <<= fromStream; fHigh <<= fromStream; fLow <<= fromStream; fClose <<= fromStream; fVolume <<= fromStream; return fromStream; } bool TStockDay::operator==(const TStockDay& other) const { return fDate == other.fDate && fHigh == other.fHigh && fLow == other.fLow && fClose == other.fClose && fVolume == other.fVolume; } long TStockDay::Hash() const { return (long)fDate.GetDays(); } bool TStockDay::IsHoliday() const { return fHigh == 0.0 && fLow == 0.0 && fClose == 0.0 && fVolume == 0; } const TDays& TStockDay::GetDate() const { return fDate; } StockValue TStockDay::GetHigh() const { return fHigh; } StockValue TStockDay::GetLow() const { return fLow; } StockValue TStockDay::GetClose() const { return fClose; } StockVolume TStockDay::GetVolume() const { return fVolume; }