質問編集履歴

2

提示ソースの追加・注意事項の追記

2016/04/16 11:54

投稿

mash0120
mash0120

スコア10

test CHANGED
File without changes
test CHANGED
@@ -40,6 +40,8 @@
40
40
 
41
41
 
42
42
 
43
+ また、ソースですがお見せすることができない場所もありますので、これがソースのすべてではありません。限られた情報しか提示できませんがご協力お願いします(ToT)
44
+
43
45
 
44
46
 
45
47
  以下、問題のソースです。
@@ -254,52 +256,470 @@
254
256
 
255
257
  {
256
258
 
259
+ delete [] this->data->pA12;
260
+
257
261
  this->data->pA12 = NULL;
258
262
 
259
- delete[] this->data->pA12;
260
-
261
263
  }
262
264
 
263
265
  if( this->data->pA13 != NULL )
264
266
 
265
267
  {
266
268
 
269
+ delete [] this->data->pA13;
270
+
267
271
  this->data->pA13 = NULL;
268
272
 
269
- delete[] this->data->pA13;
270
-
271
273
  }
272
274
 
273
275
  if( this->data->pA14 != NULL )
274
276
 
275
277
  {
276
278
 
279
+ delete [] this->data->pA14;
280
+
277
281
  this->data->pA14 = NULL;
278
282
 
279
- delete[] this->data->pA14;
280
-
281
283
  }
282
284
 
283
285
  if( this->data->pA15 != NULL )
284
286
 
285
287
  {
286
288
 
289
+ delete [] this->data->pA15;
290
+
287
291
  this->data->pA15 = NULL;
288
292
 
289
- delete[] this->data->pA15;
290
-
291
293
  }
292
294
 
293
295
  if( this->data->pA16 != NULL )
294
296
 
295
297
  {
296
298
 
299
+ delete [] this->data->pA16;
300
+
297
301
  this->data->pA16 = NULL;
298
302
 
299
- delete[] this->data->pA16;
300
-
301
303
  }
302
304
 
303
305
  }
304
306
 
305
307
  ```
308
+
309
+ ↓以下追加のソースです。
310
+
311
+
312
+
313
+ HogeHoge.h
314
+
315
+ ```
316
+
317
+ public ref class HogeHoge // データ取得バッファ(アンマネージ)のラッパ
318
+
319
+ {
320
+
321
+ private:
322
+
323
+ FUGA_AREA* data; // データ取得バッファ
324
+
325
+
326
+
327
+ public:
328
+
329
+ int BufferSize; // バッファのサイズ
330
+
331
+ HogeHoge(void); // コンストラクタ
332
+
333
+ ~HogeHoge(void); // デストラクタ
334
+
335
+ !HogeHoge(void); // ファイナライザ
336
+
337
+ FUGA_AREA* GetReference(); // データ取得バッファのポインタを取得する
338
+
339
+ void CreateBuffer( Int32 bufferSize ); // バッファを作成
340
+
341
+ void DeleteBuffer(); // バッファを削除
342
+
343
+
344
+
345
+ public:
346
+
347
+ ///
348
+
349
+ /// プロパティ
350
+
351
+ ///
352
+
353
+
354
+
355
+ property String^ IdName // ID名(S1~S100,R1~R100,M1~M100)(Read Only)
356
+
357
+ {
358
+
359
+ String^ get()
360
+
361
+ {
362
+
363
+ std::string s( this->data->aIdName );
364
+
365
+ return Utility::ToUnicode( s );
366
+
367
+ }
368
+
369
+ };
370
+
371
+
372
+
373
+ property UInt32 AMaxSize // データ最大数(AデータのMAX値)(Read Only)
374
+
375
+ {
376
+
377
+ UInt32 get(){ return this->data->nMax; }
378
+
379
+ };
380
+
381
+
382
+
383
+ property UInt32 Count // データ個数(property)
384
+
385
+ {
386
+
387
+ UInt32 get(){ return this->data->nCnt; }
388
+
389
+ void set( UInt32 value ){ this->data->nCnt = value; }
390
+
391
+ };
392
+
393
+
394
+
395
+ property Int32 CountReference // データ個数のポインタ(Read Only)
396
+
397
+ {
398
+
399
+ Int32 get(){ return (int)( &(this->data->nCnt) ); }
400
+
401
+ };
402
+
403
+
404
+
405
+ property UInt32 StartPosition // データ開始位置(Read Only)
406
+
407
+ {
408
+
409
+ UInt32 get(){ return this->data->nStp; }
410
+
411
+ };
412
+
413
+
414
+
415
+ property UInt32 EndPosition // データ終了位置(Read Only)
416
+
417
+ {
418
+
419
+ UInt32 get(){ return this->data->nEnp; }
420
+
421
+ };
422
+
423
+
424
+
425
+ property String^ DataType // データ型(Read Only)
426
+
427
+ {
428
+
429
+ String^ get()
430
+
431
+ {
432
+
433
+ std::string s( this->data->aDataType );
434
+
435
+ return Utility::ToUnicode( s );
436
+
437
+ }
438
+
439
+ };
440
+
441
+
442
+
443
+ property Int32 DataLength // データ長(Read Only)
444
+
445
+ {
446
+
447
+ Int32 get(){ return this->data->nDataLength; }
448
+
449
+ };
450
+
451
+
452
+
453
+ property Int32 Status // 状態(Read Only)
454
+
455
+ {
456
+
457
+ Int32 get(){ return this->data->nStatus; }
458
+
459
+ };
460
+
461
+
462
+
463
+ property Int32 A1Reference //A1データのポインタ(Read Only)
464
+
465
+ {
466
+
467
+ Int32 get()
468
+
469
+ { return (int)( &( this->data->pA1[0] ) ); }
470
+
471
+ };
472
+
473
+
474
+
475
+ property Int32 A2Reference //A2データのポインタ(Read Only)
476
+
477
+ {
478
+
479
+ Int32 get()
480
+
481
+ { return (int)( &( this->data->pA2[0] ) ); }
482
+
483
+ };
484
+
485
+
486
+
487
+ property Int32 A3Reference //A3データのポインタ(Read Only)
488
+
489
+ {
490
+
491
+ Int32 get()
492
+
493
+ { return (int)( &( this->data->pA3[0] ) ); }
494
+
495
+ };
496
+
497
+
498
+
499
+ property Int32 A4Reference //A4データのポインタ(Read Only)
500
+
501
+ {
502
+
503
+ Int32 get()
504
+
505
+ { return (int)( &( this->data->pA4[0] ) ); }
506
+
507
+ };
508
+
509
+
510
+
511
+ property Int32 A5Reference //A5データのポインタ(Read Only)
512
+
513
+ {
514
+
515
+ Int32 get()
516
+
517
+ { return (int)( &( this->data->pA5[0] ) ); }
518
+
519
+ };
520
+
521
+
522
+
523
+ property Int32 A6Reference //A6データのポインタ(Read Only)
524
+
525
+ {
526
+
527
+ Int32 get()
528
+
529
+ { return (int)( &( this->data->pA6[0] ) ); }
530
+
531
+ };
532
+
533
+
534
+
535
+ property Int32 A7Reference //A7データのポインタ(Read Only)
536
+
537
+ {
538
+
539
+ Int32 get()
540
+
541
+ { return (int)( &( this->data->pA7[0] ) ); }
542
+
543
+ };
544
+
545
+
546
+
547
+ property Int32 A8Reference //A8データのポインタ(Read Only)
548
+
549
+ {
550
+
551
+ Int32 get()
552
+
553
+ { return (int)( &( this->data->pA8[0] ) ); }
554
+
555
+ };
556
+
557
+
558
+
559
+ property Int32 A9Reference //A9データのポインタ(Read Only)
560
+
561
+ {
562
+
563
+ Int32 get()
564
+
565
+ { return (int)( &( this->data->pA9[0] ) ); }
566
+
567
+ };
568
+
569
+
570
+
571
+ property Int32 A10Reference //A10データのポインタ(Read Only)
572
+
573
+ {
574
+
575
+ Int32 get()
576
+
577
+ { return (int)( &( this->data->pA10[0] ) ); }
578
+
579
+ };
580
+
581
+
582
+
583
+ property Int32 A11Reference //A11データのポインタ(Read Only)
584
+
585
+ {
586
+
587
+ Int32 get()
588
+
589
+ { return (int)( &( this->data->pA11[0] ) ); }
590
+
591
+ };
592
+
593
+
594
+
595
+ property Int32 A12Reference //A12データのポインタ(Read Only)
596
+
597
+ {
598
+
599
+ Int32 get()
600
+
601
+ { return (int)( &( this->data->pA12[0] ) ); }
602
+
603
+ };
604
+
605
+
606
+
607
+ property Int32 A13Reference //A13データのポインタ(Read Only)
608
+
609
+ {
610
+
611
+ Int32 get()
612
+
613
+ { return (int)( &( this->data->pA13[0] ) ); }
614
+
615
+ };
616
+
617
+
618
+
619
+ property Int32 A14Reference //A14データのポインタ(Read Only)
620
+
621
+ {
622
+
623
+ Int32 get()
624
+
625
+ { return (int)( &( this->data->pA14[0] ) ); }
626
+
627
+ };
628
+
629
+
630
+
631
+ property Int32 A15Reference //A15データのポインタ(Read Only)
632
+
633
+ {
634
+
635
+ Int32 get()
636
+
637
+ { return (int)( &( this->data->pA15[0] ) ); }
638
+
639
+ };
640
+
641
+
642
+
643
+ property Int32 A16Reference //A16データのポインタ(Read Only)
644
+
645
+ {
646
+
647
+ Int32 get()
648
+
649
+ { return (int)( &( this->data->pA16[0] ) ); }
650
+
651
+ };
652
+
653
+ }
654
+
655
+ ```
656
+
657
+ HogeHoge.cpp
658
+
659
+ ```
660
+
661
+ ///
662
+
663
+ /// 機能 : コンストラクタ
664
+
665
+ ///
666
+
667
+ HogeHoge::HogeHoge(void)
668
+
669
+ {
670
+
671
+ this->data = new FUGA_AREA;
672
+
673
+ memset( this->data, 0, sizeof( FUGA_AREA ) );
674
+
675
+ this->BufferSize = 0;
676
+
677
+ strcpy_s( this->data->aIdName, sizeof(this->data->aIdName), "R1" );
678
+
679
+ }
680
+
681
+
682
+
683
+ ///
684
+
685
+ /// 機能 : デストラクタ
686
+
687
+ ///
688
+
689
+ HogeHoge::~HogeHoge(void)
690
+
691
+ {
692
+
693
+ this->!HogeHoge();
694
+
695
+ }
696
+
697
+
698
+
699
+ ///
700
+
701
+ /// 機能 : ファイナライザ
702
+
703
+ ///
704
+
705
+ HogeHoge::!HogeHoge()
706
+
707
+ {
708
+
709
+ this->DeleteBuffer();
710
+
711
+
712
+
713
+ if( this->data != NULL )
714
+
715
+ {
716
+
717
+ delete this->data;
718
+
719
+ this->data = NULL;
720
+
721
+ }
722
+
723
+ }
724
+
725
+ ```

1

初心者マーク追加

2016/04/16 11:54

投稿

mash0120
mash0120

スコア10

test CHANGED
File without changes
test CHANGED
File without changes