]> git.mxchange.org Git - simgear.git/blob - simgear/hla/HLADataElement.cxx
hla: Remove HLADataElement::Path based attribute handling.
[simgear.git] / simgear / hla / HLADataElement.cxx
1 // Copyright (C) 2009 - 2010  Mathias Froehlich - Mathias.Froehlich@web.de
2 //
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Library General Public
5 // License as published by the Free Software Foundation; either
6 // version 2 of the License, or (at your option) any later version.
7 //
8 // This library is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
11 // Library General Public License for more details.
12 //
13 // You should have received a copy of the GNU General Public License
14 // along with this program; if not, write to the Free Software
15 // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
16 //
17
18 #ifdef HAVE_CONFIG_H
19 #  include <simgear_config.h>
20 #endif
21
22 #include <simgear/compiler.h>
23
24 #include "HLADataElement.hxx"
25
26 #include <simgear/debug/logstream.hxx>
27
28 #include "HLADataElementVisitor.hxx"
29
30 namespace simgear {
31
32 HLADataElement::~HLADataElement()
33 {
34 }
35
36 bool
37 HLADataElement::setDataElement(HLADataElementIndex::const_iterator begin, HLADataElementIndex::const_iterator end, HLADataElement* dataElement)
38 {
39     return false;
40 }
41
42 HLADataElement*
43 HLADataElement::getDataElement(HLADataElementIndex::const_iterator begin, HLADataElementIndex::const_iterator end)
44 {
45     if (begin != end)
46         return 0;
47     return this;
48 }
49
50 const HLADataElement*
51 HLADataElement::getDataElement(HLADataElementIndex::const_iterator begin, HLADataElementIndex::const_iterator end) const
52 {
53     if (begin != end)
54         return 0;
55     return this;
56 }
57
58 void
59 HLADataElement::setTimeStamp(const SGTimeStamp& timeStamp)
60 {
61     if (!_stamp.valid())
62         return;
63     _stamp->setTimeStamp(timeStamp);
64 }
65
66 void
67 HLADataElement::setTimeStampValid(bool timeStampValid)
68 {
69     if (!_stamp.valid())
70         return;
71     _stamp->setTimeStampValid(timeStampValid);
72 }
73
74 double
75 HLADataElement::getTimeDifference(const SGTimeStamp& timeStamp) const
76 {
77     if (!_stamp.valid())
78         return 0;
79     if (!_stamp->getTimeStampValid())
80         return 0;
81     return (timeStamp - _stamp->getTimeStamp()).toSecs();
82 }
83
84 void
85 HLADataElement::createStamp()
86 {
87     _setStamp(new Stamp);
88     setDirty(true);
89 }
90
91 void
92 HLADataElement::attachStamp(HLADataElement& dataElement)
93 {
94     _setStamp(dataElement._getStamp());
95 }
96
97 void
98 HLADataElement::clearStamp()
99 {
100     _setStamp(0);
101 }
102
103 void
104 HLADataElement::accept(HLADataElementVisitor& visitor)
105 {
106     visitor.apply(*this);
107 }
108
109 void
110 HLADataElement::accept(HLAConstDataElementVisitor& visitor) const
111 {
112     visitor.apply(*this);
113 }
114
115 void
116 HLADataElement::_setStamp(HLADataElement::Stamp* stamp)
117 {
118     _stamp = stamp;
119 }
120
121 }