AGX Dynamics 2.38.0.2
Loading...
Searching...
No Matches
FileTrack.h
Go to the documentation of this file.
1/*
2Copyright 2007-2024. Algoryx Simulation AB.
3
4All AGX source code, intellectual property, documentation, sample code,
5tutorials, scene files and technical white papers, are copyrighted, proprietary
6and confidential material of Algoryx Simulation AB. You may not download, read,
7store, distribute, publish, copy or otherwise disseminate, use or expose this
8material unless having a written signed agreement with Algoryx Simulation AB, or having been
9advised so by Algoryx Simulation AB for a time limited evaluation, or having purchased a
10valid commercial license from Algoryx Simulation AB.
11
12Algoryx Simulation AB disclaims all responsibilities for loss or damage caused
13from using this software, unless otherwise stated in written agreements with
14Algoryx Simulation AB.
15*/
16
17
18#ifndef AGXDATA_FILE_TRACK_H
19#define AGXDATA_FILE_TRACK_H
20
21#include <agx/config/AGX_USE_AIO.h>
22#include <agx/agx.h>
23#include <agx/Logger.h>
24#include <agx/List.h>
25#include <agxData/DiskTrack.h>
27#include <agxData/FileJournal.h>
28#include <fstream>
29
30
31#if AGX_USE_AIO()
32#include <aio.h>
33#endif
34
35namespace agx
36{
37 class TiXmlDocument;
38 class TiXmlElement;
39}
40
41namespace agxData
42{
44
49 {
50 public:
52
53 virtual const agxData::JournalArchive::Session* getSession() const override;
54
55 virtual bool jumpToFrame(agx::UInt frameIndex) override;
56 virtual bool jumpToTime(agx::Real time) override;
57
59 agx::UInt getFrameOffset() const;
60
67 enum BinaryReadStrategy { FSTREAM, CACHED, DIRECT };
68
71
72#if AGX_USE_AIO()
77 void setEnableUseAio( bool useAio );
78 bool getEnableUseAio() const;
79#endif
80
81 protected:
83
84 virtual void prepareSequence(agx::UInt startFrame, agx::UInt lastFrame) override;
85 virtual void endSequence() override;
86
87 private:
88
89
90 bool isValidFrame(agx::UInt frameIndex);
91 virtual Frame* readFrame(agx::UInt frameIndex) override;
92 using DiskFrameReader::readFrame;
93
94 // void readComponent(agx::Component* parent, agx::TiXmlElement* eElement, std::istream& binaryFile);
95 // void readBuffer(agx::Component* parent, agx::TiXmlElement* eElement, std::istream& binaryFile);
96 // void readValue(agx::Component* parent, agx::TiXmlElement* eElement, std::istream& binaryFile);
97
98
99 void removeUnwantedBuffers( agx::TiXmlElement* eElement, const agxData::Frame::DataBindingRefVector& bindings, const agx::String& path );
100
101
102 private:
103 BinaryReadStrategy m_readStrategy;
104
105#if AGX_USE_AIO()
106 bool m_useAio;
108#endif
109
110 FileJournal::SessionRef m_session;
111
112 std::ifstream m_journalFile;
114 bool m_activeMergeSequence;
115 };
116
117
118
119#if AGX_USE_AIO()
123 class FileFrameReader::PreloadedFrame : public agx::Referenced
124 {
125 public:
127
135
144
148 bool hasQueuedRead() const;
149
154 const agx::String& getQueuedFilePath() const;
155
156 private:
158 void clear();
159 virtual ~PreloadedFrame();
160 private:
161 struct aiocb m_aioHandle;
163 size_t m_frameDataSize;
165 agx::String m_filePath;
166 };
167#endif
168
169 //---------------------------------------------------------------
170
171
174 {
175 public:
180
181
182 virtual void writeFrame(const agxData::Frame* frame) override;
183 virtual const JournalArchive::Session* getSession() const override;
184 virtual void endOfStream() override;
185
186 protected:
188
189 private:
190 agx::String getFilePath() const;
191
192 private:
194 // bool m_storeAsciiValues;
195
197 };
198
199
200
201
202 /* Implementation */
203 AGX_FORCE_INLINE agx::UInt FileFrameReader::getFrameOffset() const { return (agx::UInt)m_session->getFirstFrameIndex(); }
204}
205
206
207
208/* AGXDATA_FILE_TRACK_H */
209#endif
#define AGX_DECLARE_POINTER_TYPES(type)
Definition Referenced.h:254
#define AGXCORE_EXPORT
Helper class for the FrameReaders that are backed by a file on disk.
Definition DiskTrack.h:35
Base class for the FrameReaders that are backed by a file on disk.
Definition DiskTrack.h:108
Frame reader that supports the files-and-foldes prototype format.
Definition FileTrack.h:49
FileFrameReader(agxData::JournalArchive::Session *session)
agx::UInt getFrameOffset() const
Definition FileTrack.h:203
virtual bool jumpToTime(agx::Real time) override
virtual bool jumpToFrame(agx::UInt frameIndex) override
Select which frame that should be returned by the next call to 'readFrame'.
virtual const agxData::JournalArchive::Session * getSession() const override
BinaryReadStrategy getBinaryReadStrategy() const
virtual void prepareSequence(agx::UInt startFrame, agx::UInt lastFrame) override
void setBinaryReadStrategy(BinaryReadStrategy strategy)
virtual void endSequence() override
BinaryReadStrategy
Controls how the binary data of a frame is read from disk.
Definition FileTrack.h:67
virtual void writeFrame(const agxData::Frame *frame) override
FileFrameWriter(agxData::JournalArchive::Session *session)
NOTE: Buffer compression is default disabled due to decompression being slow for large datasets,...
virtual const JournalArchive::Session * getSession() const override
virtual void endOfStream() override
Session(const agx::Name &name)
Only use as member allocated variable.
Definition Value.h:285
Base class providing referencing counted objects.
Definition Referenced.h:120
#define AGX_FORCE_INLINE
Definition macros.h:58
Contains classes for low level data storage for AGX.
Definition Container.h:23
The agx namespace contains the dynamics/math part of the AGX Dynamics API.
uint64_t UInt
Definition Integer.h:27
double Real
Definition Real.h:42
uint8_t UInt8
Definition Integer.h:30