X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=simgear%2Fhla%2FHLAFixedRecordDataElement.cxx;h=b9c0b8559cd15dc768b02a31e2290c244851b196;hb=cc8977b83d5ba20a040d1f9d54d884f6c576985e;hp=d0980b957d22eab206cdf61bfde561e5651ad6a1;hpb=baf511684119e219906fa37f3e7c7f43151bb435;p=simgear.git diff --git a/simgear/hla/HLAFixedRecordDataElement.cxx b/simgear/hla/HLAFixedRecordDataElement.cxx index d0980b95..b9c0b855 100644 --- a/simgear/hla/HLAFixedRecordDataElement.cxx +++ b/simgear/hla/HLAFixedRecordDataElement.cxx @@ -1,4 +1,4 @@ -// Copyright (C) 2009 - 2010 Mathias Froehlich - Mathias.Froehlich@web.de +// Copyright (C) 2009 - 2012 Mathias Froehlich - Mathias.Froehlich@web.de // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Library General Public @@ -15,11 +15,19 @@ // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. // +#ifdef HAVE_CONFIG_H +# include +#endif + +#include + #include "HLAFixedRecordDataElement.hxx" #include #include #include + +#include "HLADataElementVisitor.hxx" #include "HLADataTypeVisitor.hxx" namespace simgear { @@ -33,6 +41,18 @@ HLAAbstractFixedRecordDataElement::~HLAAbstractFixedRecordDataElement() { } +void +HLAAbstractFixedRecordDataElement::accept(HLADataElementVisitor& visitor) +{ + visitor.apply(*this); +} + +void +HLAAbstractFixedRecordDataElement::accept(HLAConstDataElementVisitor& visitor) const +{ + visitor.apply(*this); +} + bool HLAAbstractFixedRecordDataElement::decode(HLADecodeStream& stream) { @@ -106,6 +126,7 @@ HLAFixedRecordDataElement::HLAFixedRecordDataElement(const HLAFixedRecordDataTyp HLAFixedRecordDataElement::~HLAFixedRecordDataElement() { + clearStamp(); } bool @@ -167,7 +188,12 @@ HLAFixedRecordDataElement::setField(unsigned index, HLADataElement* value) { if (getNumFields() <= index) return; + if (_fieldVector[index].valid()) + _fieldVector[index]->clearStamp(); _fieldVector[index] = value; + if (value) + value->attachStamp(*this); + setDirty(true); } void @@ -176,4 +202,15 @@ HLAFixedRecordDataElement::setField(const std::string& name, HLADataElement* val setField(getFieldNumber(name), value); } +void +HLAFixedRecordDataElement::_setStamp(Stamp* stamp) +{ + HLAAbstractFixedRecordDataElement::_setStamp(stamp); + for (FieldVector::iterator i = _fieldVector.begin(); i != _fieldVector.end(); ++i) { + if (!i->valid()) + continue; + (*i)->attachStamp(*this); + } +} + }