Itasca C++ Interface
Loading...
Searching...
No Matches
iinputrecord.h
1#pragma once
2
3#include "base/src/baseqt.h"
4#include "shared/interface/signal.h"
5
6namespace itasca {
7 class Archive2;
8
11 public:
12 struct FileData {
13 string name_;
14 QDateTime time_;
15 int64 size_;
16 string role_;
17 uint32 order_;
18 inline bool operator==(const FileData &in) const;
19 };
20 struct FileDataHash {
21 public:
22 uint32 operator()(const FileData &in) const { return std::hash<string>()(in.name_) + qHash(in.time_); }
23 };
24
25 // SIGNALS
26 shared::Signal<const string &> lineAdded; // line
27 shared::Signal<int64, const string &> inputLineModified; // line, newLine
28 shared::Signal<int64> inputLineRemoved; // line
29 shared::Signal<const IInputRecord::FileData &> fileAdded; // fd
30 shared::Signal<int64> dataReset; // lines
31 shared::Signal<bool> undoAvailable;
32 // timeExpected is in seconds, if <0 no way of knowing, always 0.0 if b=false.
33 shared::Signal<bool,double> playbackActiveChanged;
34
37 using FileDataSet = std::unordered_set<FileData, FileDataHash>;
38
39 // Get record, not from playback;
41 virtual uint64 getTotalInputLines() const=0;
45 virtual StringList getInputLines(uint64 start=0,uint64 len=limits<uint64>::max()) const=0;
47 virtual FileDataSet getInputFiles() const=0;
50 //virtual FileDataSet readFromSaveFile(Archive2 &a,QStringList *linesw) const=0;
53 //virtual FileDataSet extractFromStream(QDataStream &in,QTextStream &out) const=0;
56 virtual uint64 getTimeToPlayback(uint64 marksToUndo) const=0;
57 virtual bool canSmartUndo(uint64 marksToUndo) const=0;
59 virtual bool isPlaybackActive() const=0;
61 virtual StringList filterInputForDataFile(const StringList &input) const=0;
62
64 virtual void addFile(const string &fullPath,const string &role)=0;
65 //
66 };
67
68 bool IInputRecord::FileData::operator==(const FileData &in) const {
69 if (name_!=in.name_) return false;
70 if (time_!=in.time_) return false;
71 if (size_!=in.size_) return false;
72 if (role_!=in.role_) return false;
73 if (order_!=in.order_) return false;
74 return true;
75 }
76} // namespace itascaxd
77// EoF
All default base headers if Qt is being used.
Definition basestring.h:89
The input record maintains a list of all commands used in the creation of the model.
Definition iinputrecord.h:10
std::unordered_set< FileData, FileDataHash > FileDataSet
Definition iinputrecord.h:37
virtual void addFile(const string &fullPath, const string &role)=0
Add a file to the input record.
virtual bool isPlaybackActive() const =0
Return true if an undo operation is being performed or a call file is being executed.
virtual uint64 getTimeToPlayback(uint64 marksToUndo) const =0
virtual StringList filterInputForDataFile(const StringList &input) const =0
Filters out all non-command lines and interrupted lines, moves FISH CREATE commands to the front.
virtual FileDataSet getInputFiles() const =0
Return a list of the files used in the input record.
virtual StringList getInputLines(uint64 start=0, uint64 len=limits< uint64 >::max()) const =0
virtual uint64 getTotalInputLines() const =0
Return the total number of lines in the input record.
debug checked shorthand for std::numeric_limits<T>::
Definition limit.h:25
namespace Itasca
Definition basememory.cpp:10
Definition iinputrecord.h:20
Definition iinputrecord.h:12
uint32 order_
order in which this file was added to the input record, starts with 1.
Definition iinputrecord.h:17
string role_
string used to indicate the file role, "save", "call", etc.
Definition iinputrecord.h:16
QDateTime time_
last modified time/date stamp when added
Definition iinputrecord.h:14
int64 size_
size of the file when added
Definition iinputrecord.h:15
string name_
filePath relative to current directory when added
Definition iinputrecord.h:13