- // Container for the timestamp the originating attribute was last updated for
- // class TimeStamp : public SGReferenced {
- // public:
- // const SGTimeStamp& getTimeStamp() const
- // { return _timeStamp; }
- // void setTimeStamp(const SGTimeStamp& timeStamp)
- // { _timeStamp = timeStamp; }
- // private:
- // SGTimeStamp _timeStamp;
- // };
-
- // const TimeStamp* getTimeStamp() const
- // { return _timeStamp.get(); }
- // void setTimeStamp(const TimeStamp* timeStamp)
- // { _timeStamp = timeStamp; }
-
- // struct ChangeCount : public SGReferenced {
- // ChangeCount() : _value(0) {}
- // unsigned _value;
- // };
- // SGSharedPtr<ChangeCount> _changeCount;
- // unsigned getChangeCount() const
- // {
- // // If we don't have return allways the same
- // if (!_changeCount.valid())
- // return 0;
- // return _changeCount->_value;
- // }
+ bool setDataElement(const HLADataElementIndex& index, HLADataElement* dataElement)
+ { return setDataElement(index.begin(), index.end(), dataElement); }
+ HLADataElement* getDataElement(const HLADataElementIndex& index)
+ { return getDataElement(index.begin(), index.end()); }
+ const HLADataElement* getDataElement(const HLADataElementIndex& index) const
+ { return getDataElement(index.begin(), index.end()); }
+
+ virtual bool setDataElement(HLADataElementIndex::const_iterator begin, HLADataElementIndex::const_iterator end, HLADataElement* dataElement);
+ virtual HLADataElement* getDataElement(HLADataElementIndex::const_iterator begin, HLADataElementIndex::const_iterator end);
+ virtual const HLADataElement* getDataElement(HLADataElementIndex::const_iterator begin, HLADataElementIndex::const_iterator end) const;
+
+ /// Returns the time stamp if this data element.
+ /// Do not access this getter if the getTimeStampValid() method returns false.
+ const SGTimeStamp& getTimeStamp() const
+ { return _stamp->getTimeStamp(); }
+ void setTimeStamp(const SGTimeStamp& timeStamp);
+
+ bool getTimeStampValid() const
+ { if (!_stamp.valid()) return false; return _stamp->getTimeStampValid(); }
+ void setTimeStampValid(bool timeStampValid);
+
+ /// Convenience function that gives the time difference in seconds to a given timestamp
+ /// This function returns 0 if the timestamp is not valid.
+ double getTimeDifference(const SGTimeStamp& timeStamp) const;
+
+ /// Dirty tracking of the attribute/parameter that this data element belongs to
+ bool getDirty() const
+ { if (!_stamp.valid()) return true; return _stamp->getDirty(); }
+ void setDirty(bool dirty)
+ { if (!_stamp.valid()) return; _stamp->setDirty(dirty); }
+
+ /// Stamp handling
+ void createStamp();
+ void attachStamp(HLADataElement& dataElement);
+ void clearStamp();