-
Notifications
You must be signed in to change notification settings - Fork 35
/
BaseMathPersistence.pas
674 lines (568 loc) · 22.8 KB
/
BaseMathPersistence.pas
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
// ###################################################################
// #### This file is part of the mathematics library project, and is
// #### offered under the licence agreement described on
// #### http://www.mrsoft.org/
// ####
// #### Copyright:(c) 2011, Michael R. . All rights reserved.
// ####
// #### Unless required by applicable law or agreed to in writing, software
// #### distributed under the License is distributed on an "AS IS" BASIS,
// #### WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// #### See the License for the specific language governing permissions and
// #### limitations under the License.
// ###################################################################
unit BaseMathPersistence;
// ###################################################
// #### Base abstract I/O functionality
// ###################################################
interface
uses SysUtils, Classes, Types;
// #############################################################
// #### Loading/saving data
type
TCustomMathPersistenceIO = class;
TCustomMathPersistenceIOClass = class of TCustomMathPersistenceIO;
IMathPersistence = interface
['{16A5F1D0-CA39-4BD0-BABE-E1E70B0045C3}']
procedure SaveToFile(const FileName : string; Writer : TCustomMathPersistenceIOClass);
procedure SaveToStream(stream : TStream; Writer : TCustomMathPersistenceIOClass);
end;
TPropType = (ptUnknown, ptDouble, ptInteger, ptString, ptObject, ptBinary);
TBaseMathPersistence = class(TInterfacedObject, IMathPersistence)
private
fWriter : TCustomMathPersistenceIO;
fInList : boolean;
protected
// functions to add and load properties
procedure BeginList(const Name : String; count : integer);
procedure EndList;
procedure AddObjectDescription(const Name : String; const Value : String);
procedure AddDoubleProperty(const Name : String; const Value : double);
procedure AddStringProperty(const Name : String; const Value : String);
procedure AddIntProperty(const Name : String; const Value : integer);
procedure AddBinaryProperty(const Name : String; const Value; size : integer);
procedure AddDoubleArr(const Name : String; const Value : TDoubleDynArray);
procedure AddListDoubleArr(const Value : TDoubleDynArray);
procedure AddIntArr(const Name : String; const Value : TIntegerDynArray);
procedure AddListIntArr(const Value : TIntegerDynArray);
procedure AddObject(Obj : TBaseMathPersistence); overload;
procedure AddObject(const Name : String; obj : TBaseMathPersistence); overload;
protected
procedure FinishReading; virtual;
procedure OnLoadDoubleProperty(const Name : String; const Value : double); virtual;
procedure OnLoadStringProperty(const Name : String; const Value : String); virtual;
procedure OnLoadIntProperty(const Name : String; Value : integer); virtual;
procedure OnLoadBinaryProperty(const Name : String; const Value; size : integer); virtual;
function OnLoadObject(Obj : TBaseMathPersistence) : boolean; overload; virtual;
function OnLoadObject(const Name : String; Obj : TBaseMathPersistence) : boolean; overload; virtual;
procedure OnLoadBeginList(const Name : String; count : integer); virtual;
procedure OnLoadEndList; virtual;
procedure OnLoadDoubleArr(const Name : String; const Value : TDoubleDynArray); virtual;
procedure OnLoadIntArr(const Name : String; const Value : TIntegerDynArray); virtual;
procedure OnLoadListDoubleArr(const Value : TDoubleDynArray); virtual;
procedure OnLoadListIntArr(const Value : TIntegerDynArray); virtual;
procedure InitWriter(Writer : TCustomMathPersistenceIO);
class function ClassIdentifier : String; virtual;
procedure DefineProps; virtual; abstract;
function PropTypeOfName(const Name : string) : TPropType; virtual; //
procedure CleanupWriter;
public
procedure SaveToFile(const FileName : string; WriterClass : TCustomMathPersistenceIOClass);
procedure SaveToStream(stream : TStream; WriterClass : TCustomMathPersistenceIOClass);
end;
TBaseMathPersistenceClass = class of TBaseMathPersistence;
// ###################################################
// #### Base IO functionality
TCustomMathPersistenceIO = class(TObject)
private
fStream : TStream;
protected
property Stream : TStream read fStream;
class function CanReadStream(aStream : TStream) : boolean; virtual; abstract;
function PropTypeOfName(readObj : TBaseMathPersistence; const Name : string) : TPropType;
// ###########################################################
// #### Reading routines - these call the onLoad xx routines
procedure ReadDoubleProperty(readObj : TBaseMathPersistence; const Name : String; const Value : double);
procedure ReadStringProperty(readObj : TBaseMathPersistence; const Name : String; const Value : String);
procedure ReadIntProperty(readObj : TBaseMathPersistence; const Name : String; Value : integer);
procedure ReadBinaryProperty(readObj : TBaseMathPersistence; const Name : String; const Value; size : integer);
function ReadObject(readObj : TBaseMathPersistence; Obj : TBaseMathPersistence) : boolean; overload;
function ReadObject(readObj : TBaseMathPersistence; const Name : String; Obj : TBaseMathPersistence) : boolean; overload;
procedure ReadBeginList(readObj : TBaseMathPersistence; const Name : String; count : integer);
procedure ReadEndList(readObj : TBaseMathPersistence);
procedure ReadDoubleArr(readObj : TBaseMathPersistence; const Name : String; const Value : TDoubleDynArray);
procedure ReadIntArr(readObj : TBaseMathPersistence; const Name : String; const Value : TIntegerDynArray);
procedure ReadListDoubleArr(readObj : TBaseMathPersistence; const Value : TDoubleDynArray);
procedure ReadListIntArr(readObj : TBaseMathPersistence; const Value : TIntegerDynArray);
procedure ReadFinalize(readObj : TBaseMathPersistence);
// ###########################################################
// #### Writing routines - called from the TBaseMathPersistence objects
procedure WriteStreamHeader; virtual; abstract;
procedure FinalizeStream; virtual; abstract;
procedure WriteVersion(ver : integer); virtual;
procedure WriteObjDescriptor(const Name : String; const Value : String); virtual; abstract;
procedure WriteListBegin(const Name : String; count : integer); virtual; abstract;
procedure WriteListEnd; virtual; abstract;
procedure WriteProperty(const Name : String; const Value : double); overload; virtual; abstract;
procedure WriteProperty(const Name : String; const Value : String); overload; virtual; abstract;
procedure WriteProperty(const Name : String; const Value : integer); overload; virtual; abstract;
procedure WriteDoubleArr(const Name : String; const Value : Array of double); virtual; abstract;
procedure WriteListDoubleArr(const Value : Array of double); virtual; abstract;
procedure WriteIntArr(const Name : String; const Value : Array of Integer); virtual; abstract;
procedure WriteListIntArr(const Value : Array of Integer); virtual; abstract;
procedure WriteBinaryProperty(const Name : String; const Value; size : integer); virtual; abstract;
procedure WriteObject(Obj : TBaseMathPersistence); overload; virtual; abstract;
procedure WriteObject(const Name : String; Obj : TBaseMathPersistence); overload; virtual; abstract;
public
function LoadFromFile(const FileName : string) : TBaseMathPersistence;
function LoadFromStream(aStream : TStream) : TBaseMathPersistence; virtual; abstract;
procedure SaveToFile(aMathObj : TBaseMathPersistence; const FileName : string);
procedure SaveToStream(aMathObj : TBaseMathPersistence; aStream : TStream); virtual;
class procedure StaticSaveToFile(aMathObj : TBaseMathPersistence; const FileName : string);
class procedure StaticSaveToStream(aMathObj : TBaseMathPersistence; aStream : TStream);
end;
function CreateMathIOReader(const FileName : TFileName) : TCustomMathPersistenceIOClass; overload;
function CreateMathIOReader(Stream : TStream) : TCustomMathPersistenceIOClass; overload;
function ReadObjFromFile(const FileName : TFileName) : TBaseMathPersistence;
function ReadObjFromStream(aStream : TStream) : TBaseMathPersistence;
// every math IO file type must be registered here to be recognized
procedure RegisterMathIOReader(reader : TCustomMathPersistenceIOClass);
// every classifier must be registered here in order to get recognized in the IO routines
procedure RegisterMathIO(AMathIOClass : TBaseMathPersistenceClass);
function MathIOClassFromName(const CLName : String) : TBaseMathPersistenceClass;
// for dll deinitalizations:
procedure FinalizeMathIO;
implementation
uses Contnrs;
// ###################################################
// #### Global functions / reader writer handling
// ###################################################
var IOObjects : TClassList;
MathIOClasses : TClassList;
function GetIOObjects : TClassList;
begin
if not Assigned(IOObjects) then
IOObjects := TClassList.Create;
Result := IOObjects;
end;
function GetMathIOClasses : TClassList;
begin
if not Assigned(MathIOClasses) then
MathIOClasses := TClassList.Create;
Result := MathIOClasses;
end;
procedure RegisterMathIO(AMathIOClass : TBaseMathPersistenceClass);
begin
GetMathIOClasses.Add(AMathIOClass);
end;
function MathIOClassFromName(const CLName : String) : TBaseMathPersistenceClass;
var cl : TBaseMathPersistenceClass;
i : integer;
begin
Result := nil;
for i := 0 to GetMathIOClasses.Count - 1 do
begin
cl := TBaseMathPersistenceClass(GetMathIOClasses[i]);
if CompareText(String(cl.ClassIdentifier), String(CLName)) = 0 then
begin
Result := cl;
exit;
end;
end;
end;
function CreateMathIOReader(const FileName : TFileName) : TCustomMathPersistenceIOClass;
var fs : TFileStream;
begin
fs := TFileStream.Create(FileName, fmOpenRead);
try
Result := CreateMathIOReader(fs);
finally
fs.Free;
end;
end;
function CreateMathIOReader(Stream : TStream) : TCustomMathPersistenceIOClass;
var i : integer;
startPos : Int64;
begin
startPos := stream.Position;
Result := nil;
for i := 0 to GetIOObjects.Count - 1 do
begin
try
if TCustomMathPersistenceIOClass(GetIOObjects[i]).CanReadStream(stream) then
Result := TCustomMathPersistenceIOClass(GetIOObjects[i]);
except
end;
stream.Position := startPos;
if Assigned(Result) then
break;
end;
end;
procedure RegisterMathIOReader(reader : TCustomMathPersistenceIOClass);
begin
GetIOObjects.Add(reader);
end;
function ReadObjFromFile(const FileName : TFileName) : TBaseMathPersistence;
var readerClass : TCustomMathPersistenceIOClass;
begin
Result := nil;
readerClass := CreateMathIOReader(FileName);
if not Assigned(readerClass) then
exit;
with readerClass.Create do
try
Result := LoadFromFile(FileName);
finally
Free;
end;
end;
function ReadObjFromStream(aStream : TStream) : TBaseMathPersistence;
var readerClass : TCustomMathPersistenceIOClass;
begin
Result := nil;
readerClass := CreateMathIOReader(aStream);
if not Assigned(readerClass) then
exit;
with readerClass.Create do
try
Result := LoadFromStream(aStream);
finally
Free;
end;
end;
{ TCustomMathPersistenceIO }
function TCustomMathPersistenceIO.LoadFromFile(
const FileName: string): TBaseMathPersistence;
var fs : TFileStream;
begin
fs := TFileStream.Create(FileName, fmOpenRead or fmShareDenyWrite);
try
Result := LoadFromStream(fs);
finally
fs.Free;
end;
end;
procedure TCustomMathPersistenceIO.SaveToFile(aMathObj : TBaseMathPersistence; const FileName: string);
var fs : TFileStream;
begin
fs := TFileStream.Create(FileName, fmCreate or fmOpenWrite);
try
SaveToStream(aMathObj, fs);
finally
fs.Free;
end;
end;
procedure TCustomMathPersistenceIO.SaveToStream(aMathObj: TBaseMathPersistence;
aStream: TStream);
begin
fStream := aStream;
try
WriteStreamHeader;
aMathObj.InitWriter(Self);
aMathObj.DefineProps;
FinalizeStream;
finally
aMathObj.CleanupWriter;
fStream := nil;
end;
end;
class procedure TCustomMathPersistenceIO.StaticSaveToFile(
aMathObj: TBaseMathPersistence; const FileName: string);
begin
with self.Create do
try
SaveToFile(aMathObj, FileName);
finally
Free;
end;
end;
class procedure TCustomMathPersistenceIO.StaticSaveToStream(
aMathObj: TBaseMathPersistence; aStream: TStream);
begin
with self.Create do
try
SaveToStream(aMathObj, aStream);
finally
Free;
end;
end;
procedure TCustomMathPersistenceIO.WriteVersion(ver: integer);
begin
// do nothing here
end;
// ################################################
// #### writing propertyies - called from the reader classes
// and serve as surrogates between the reader classes and the objects themself
procedure TCustomMathPersistenceIO.ReadDoubleProperty(
readObj: TBaseMathPersistence; const Name: String; const Value: double);
begin
assert(assigned(readObj), 'Error: tried write a property on a nil object');
readObj.OnLoadDoubleProperty(Name, Value);
end;
procedure TCustomMathPersistenceIO.ReadStringProperty(
readObj: TBaseMathPersistence; const Name, Value: String);
begin
assert(assigned(readObj), 'Error: tried write a property on a nil object');
readObj.OnLoadStringProperty(Name, value);
end;
procedure TCustomMathPersistenceIO.ReadIntProperty(
readObj: TBaseMathPersistence; const Name: String; Value: integer);
begin
assert(assigned(readObj), 'Error: tried write a property on a nil object');
readObj.OnLoadIntProperty(Name, Value);
end;
procedure TCustomMathPersistenceIO.ReadBinaryProperty(
readObj: TBaseMathPersistence; const Name: String; const Value;
size: integer);
begin
assert(assigned(readObj), 'Error: tried write a property on a nil object');
readObj.OnLoadBinaryProperty(Name, Value, Size);
end;
function TCustomMathPersistenceIO.ReadObject(readObj: TBaseMathPersistence;
const Name: String; Obj: TBaseMathPersistence): boolean;
begin
assert(assigned(readObj), 'Error: tried write a property on a nil object');
Result := readObj.OnLoadObject(Name, Obj);
end;
function TCustomMathPersistenceIO.ReadObject(readObj,
Obj: TBaseMathPersistence): boolean;
begin
assert(assigned(readObj), 'Error: tried write a property on a nil object');
Result := readObj.OnLoadObject(Obj);
end;
procedure TCustomMathPersistenceIO.ReadBeginList(readObj: TBaseMathPersistence;
const Name: String; count: integer);
begin
assert(assigned(readObj), 'Error: tried write a property on a nil object');
readObj.OnLoadBeginList(Name, Count);
end;
procedure TCustomMathPersistenceIO.ReadEndList(readObj: TBaseMathPersistence);
begin
assert(assigned(readObj), 'Error: tried write a property on a nil object');
readObj.OnLoadEndList;
end;
procedure TCustomMathPersistenceIO.ReadDoubleArr(readObj: TBaseMathPersistence;
const Name: String; const Value: TDoubleDynArray);
begin
assert(assigned(readObj), 'Error: tried write a property on a nil object');
readObj.OnLoadDoubleArr(Name, Value);
end;
procedure TCustomMathPersistenceIO.ReadIntArr(readObj: TBaseMathPersistence;
const Name: String; const Value: TIntegerDynArray);
begin
assert(assigned(readObj), 'Error: tried write a property on a nil object');
readObj.OnLoadIntArr(Name, Value);
end;
procedure TCustomMathPersistenceIO.ReadListDoubleArr(
readObj: TBaseMathPersistence; const Value: TDoubleDynArray);
begin
assert(assigned(readObj), 'Error: tried write a property on a nil object');
readObj.OnLoadListDoubleArr(Value);
end;
procedure TCustomMathPersistenceIO.ReadListIntArr(readObj: TBaseMathPersistence;
const Value: TIntegerDynArray);
begin
assert(assigned(readObj), 'Error: tried write a property on a nil object');
readObj.OnLoadListIntArr(Value);
end;
procedure TCustomMathPersistenceIO.ReadFinalize(readObj: TBaseMathPersistence);
begin
assert(assigned(readObj), 'Error: tried write a property on a nil object');
readObj.FinishReading;
end;
procedure TBaseMathPersistence.AddBinaryProperty(const Name: String;
const Value; size: integer);
begin
assert(Assigned(fWriter), 'No writer assigned');
fWriter.WriteBinaryProperty(Name, Value, size);
end;
procedure TBaseMathPersistence.AddDoubleArr(const Name: String;
const Value: TDoubleDynArray);
begin
assert(Assigned(fWriter), 'No writer assigned');
fWriter.WriteDoubleArr(Name, Value);
end;
procedure TBaseMathPersistence.AddObject(const Name: String;
obj: TBaseMathPersistence);
begin
assert(Assigned(fWriter), 'No writer assigned');
fWriter.WriteObject(Name, obj);
end;
procedure TBaseMathPersistence.AddObjectDescription(const Name,
Value: String);
begin
assert(Assigned(fWriter), 'No writer assigned');
fWriter.WriteObjDescriptor('obj', Value);
end;
procedure TBaseMathPersistence.AddObject(Obj: TBaseMathPersistence);
begin
assert(Assigned(fWriter), 'No writer assigned');
fWriter.WriteObject(Obj);
end;
procedure TBaseMathPersistence.AddStringProperty(const Name, Value: String);
begin
assert(Assigned(fWriter), 'No writer assigned');
fWriter.WriteProperty(Name, Value);
end;
procedure TBaseMathPersistence.AddDoubleProperty(const Name: String;
const Value: double);
begin
assert(Assigned(fWriter), 'No writer assigned');
fWriter.WriteProperty(Name, Value);
end;
procedure TBaseMathPersistence.AddIntProperty(const Name: String;
const Value: integer);
begin
assert(Assigned(fWriter), 'No writer assigned');
fWriter.WriteProperty(Name, Value);
end;
procedure TBaseMathPersistence.BeginList(const Name: String; count: integer);
begin
assert(Assigned(fWriter), 'No writer assigned');
fWriter.WriteListBegin(Name, count);
fInList := True;
end;
class function TBaseMathPersistence.ClassIdentifier: String;
begin
Result := String(ClassName);
end;
procedure TBaseMathPersistence.CleanupWriter;
begin
fWriter := nil;
end;
procedure TBaseMathPersistence.EndList;
begin
assert(Assigned(fWriter), 'No writer assigned');
fWriter.WriteListEnd;
fInList := False;
end;
procedure TBaseMathPersistence.FinishReading;
begin
// do nothing in the base class
end;
procedure TBaseMathPersistence.InitWriter(Writer: TCustomMathPersistenceIO);
begin
fInList := False;
fWriter := Writer;
// init the stream with a header
AddObjectDescription('hea', ClassIdentifier);
end;
procedure TBaseMathPersistence.OnLoadBeginList(const Name: String;
count: integer);
begin
// do nothing in the base class
end;
procedure TBaseMathPersistence.OnLoadBinaryProperty(const Name: String;
const Value; size: integer);
begin
// do nothing in the base class
end;
procedure TBaseMathPersistence.OnLoadDoubleArr(const Name: String;
const Value: TDoubleDynArray);
begin
// do nothing in the base class
end;
procedure TBaseMathPersistence.OnLoadEndList;
begin
// do nothing in the base class
end;
procedure TBaseMathPersistence.OnLoadIntArr(const Name: String;
const Value: TIntegerDynArray);
begin
// do nothing in the base class
end;
procedure TBaseMathPersistence.OnLoadListDoubleArr(
const Value: TDoubleDynArray);
begin
// do nothing in the base class
end;
procedure TBaseMathPersistence.OnLoadListIntArr(const Value: TIntegerDynArray);
begin
// do nothing in the base class
end;
function TBaseMathPersistence.OnLoadObject(const Name: String;
Obj: TBaseMathPersistence) : boolean;
begin
Result := False;
end;
function TBaseMathPersistence.OnLoadObject(Obj: TBaseMathPersistence) : boolean;
begin
// do nothing in the base class
Result := False;
end;
procedure TBaseMathPersistence.OnLoadStringProperty(const Name, Value: String);
begin
// do nothing in the base class
end;
procedure TBaseMathPersistence.SaveToFile(const FileName: string;
WriterClass: TCustomMathPersistenceIOClass);
var fs : TFileStream;
begin
fs := TFileStream.Create(FileName, fmCreate or fmOpenWrite);
try
SaveToStream(fs, WriterClass);
finally
fs.Free;
end;
end;
procedure TBaseMathPersistence.SaveToStream(stream: TStream;
WriterClass : TCustomMathPersistenceIOClass);
var obj : TCustomMathPersistenceIO;
begin
obj := WriterClass.Create;
try
obj.SaveToStream(self, stream);
finally
obj.Free;
end;
end;
procedure TBaseMathPersistence.OnLoadIntProperty(const Name: String;
Value: integer);
begin
// do nothing in the base class
end;
procedure TBaseMathPersistence.OnLoadDoubleProperty(const Name: String;
const Value: double);
begin
// do nothing in the base class
end;
procedure FinalizeMathIO;
begin
FreeAndNil(IOObjects);
FreeAndNil(MathIOClasses);
end;
procedure TBaseMathPersistence.AddIntArr(const Name: String;
const Value: TIntegerDynArray);
begin
assert(Assigned(fWriter), 'No writer assigned');
fWriter.WriteIntArr(Name, Value);
end;
procedure TBaseMathPersistence.AddListDoubleArr(const Value: TDoubleDynArray);
begin
assert(Assigned(fWriter), 'No writer assigned');
if not fInList then
raise EWriteError.Create('Error call "addlist x" function without call of BeginList');
fWriter.WriteListDoubleArr(Value);
end;
procedure TBaseMathPersistence.AddListIntArr(const Value: TIntegerDynArray);
begin
assert(Assigned(fWriter), 'No writer assigned');
if not fInList then
raise EWriteError.Create('Error call "addlist x" function without call of BeginList');
fWriter.WriteListIntArr(Value);
end;
function TBaseMathPersistence.PropTypeOfName(const Name: string): TPropType;
begin
Result := ptUnknown;
end;
function TCustomMathPersistenceIO.PropTypeOfName(
readObj: TBaseMathPersistence; const Name : string): TPropType;
begin
Result := readObj.PropTypeOfName(Name);
end;
initialization
IOObjects := nil;
MathIOClasses := nil;
finalization
FinalizeMathIO;
end.