This file is indexed.

/usr/include/Aria/ArMapComponents.h is in libaria-dev 2.8.0+repack-1.2.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

   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
 675
 676
 677
 678
 679
 680
 681
 682
 683
 684
 685
 686
 687
 688
 689
 690
 691
 692
 693
 694
 695
 696
 697
 698
 699
 700
 701
 702
 703
 704
 705
 706
 707
 708
 709
 710
 711
 712
 713
 714
 715
 716
 717
 718
 719
 720
 721
 722
 723
 724
 725
 726
 727
 728
 729
 730
 731
 732
 733
 734
 735
 736
 737
 738
 739
 740
 741
 742
 743
 744
 745
 746
 747
 748
 749
 750
 751
 752
 753
 754
 755
 756
 757
 758
 759
 760
 761
 762
 763
 764
 765
 766
 767
 768
 769
 770
 771
 772
 773
 774
 775
 776
 777
 778
 779
 780
 781
 782
 783
 784
 785
 786
 787
 788
 789
 790
 791
 792
 793
 794
 795
 796
 797
 798
 799
 800
 801
 802
 803
 804
 805
 806
 807
 808
 809
 810
 811
 812
 813
 814
 815
 816
 817
 818
 819
 820
 821
 822
 823
 824
 825
 826
 827
 828
 829
 830
 831
 832
 833
 834
 835
 836
 837
 838
 839
 840
 841
 842
 843
 844
 845
 846
 847
 848
 849
 850
 851
 852
 853
 854
 855
 856
 857
 858
 859
 860
 861
 862
 863
 864
 865
 866
 867
 868
 869
 870
 871
 872
 873
 874
 875
 876
 877
 878
 879
 880
 881
 882
 883
 884
 885
 886
 887
 888
 889
 890
 891
 892
 893
 894
 895
 896
 897
 898
 899
 900
 901
 902
 903
 904
 905
 906
 907
 908
 909
 910
 911
 912
 913
 914
 915
 916
 917
 918
 919
 920
 921
 922
 923
 924
 925
 926
 927
 928
 929
 930
 931
 932
 933
 934
 935
 936
 937
 938
 939
 940
 941
 942
 943
 944
 945
 946
 947
 948
 949
 950
 951
 952
 953
 954
 955
 956
 957
 958
 959
 960
 961
 962
 963
 964
 965
 966
 967
 968
 969
 970
 971
 972
 973
 974
 975
 976
 977
 978
 979
 980
 981
 982
 983
 984
 985
 986
 987
 988
 989
 990
 991
 992
 993
 994
 995
 996
 997
 998
 999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
/*
Adept MobileRobots Robotics Interface for Applications (ARIA)
Copyright (C) 2004, 2005 ActivMedia Robotics LLC
Copyright (C) 2006, 2007, 2008, 2009, 2010 MobileRobots Inc.
Copyright (C) 2011, 2012, 2013 Adept Technology

     This program is free software; you can redistribute it and/or modify
     it under the terms of the GNU General Public License as published by
     the Free Software Foundation; either version 2 of the License, or
     (at your option) any later version.

     This program is distributed in the hope that it will be useful,
     but WITHOUT ANY WARRANTY; without even the implied warranty of
     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     GNU General Public License for more details.

     You should have received a copy of the GNU General Public License
     along with this program; if not, write to the Free Software
     Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA

If you wish to redistribute ARIA under different terms, contact 
Adept MobileRobots for information about a commercial version of ARIA at 
robots@mobilerobots.com or 
Adept MobileRobots, 10 Columbia Drive, Amherst, NH 03031; +1-603-881-7960
*/
/*! \file ArMapComponents.h
 *  \brief Contains the set of component classes used to implement Aria maps.
 *  \date 06/27/08
 *  \author K. Cunningham
 * 
 * The ArMap class (defined in ArMap.h) is composed of several smaller 
 * classes that are defined in this header file.  These include:
 * 
 *  - ArMapScan: An implementation of the ArMapScanInterface.  This 
 *    contains all of the data related to the sensed obstacles (i.e.
 *    data points and lines).  An instance of this class is created 
 *    for each scan type that is defined in the map.
 *
 *  - ArMapObjects: An implementation of the ArMapObjectsInterface.
 *    This stores all of the map objects for the Aria map.
 *
 *  - ArMapInfo: An implementation of the ArMapInfoInterface.  This
 *    contains all of the info (ArArgumentBuilder) tags defined for 
 *    the map, including MapInfo, TaskInfo, and RouteInfo.
 *
 *  - ArMapSupplement: An implementation of the ArMapSupplementInterface.
 *    This is a repository for all of the extra data that does not fit
 *    into any of the above categories.
 * 
 *  - ArMapSimple:  The RealSubject of the ArMap Proxy.  This implements
 *    the ArMapInterface and is an aggregate of all of the above map
 *    components.
 * 
 * The following "diagram" illustrates the basic hierarchy:
 *
 * <pre>  
 *
 *          ________ArMapSupplementInterface________
 *         ^                                        ^
 *         |   ________ArMapInfoInterface________   |
 *         |   ^                                ^   |
 *         |   |   __ArMapObjectsInterface___   |   |
 *         |   |   ^                        ^   |   |
 *         |   |   |   ArMapScanInterface   |   |   |
 *         |   |   |   ^                ^   |   |   |
 *         |   |   |   |                |   |   |   |
 *        ArMapInterface                |   |   |   |  
 *        ^ (extends)                   |   |   |   | (extends)
 *        |                             |   |   |   |
 *        |                             |   |   |   |
 *     ArMapSimple +----------> ArMapScan   |   |   |
 *                 | (contains)             |   |   |
 *                 +-----------> ArMapObjects   |   |
 *                 |                            |   |
 *                 +------------------> ArMapInfo   |
 *                 |                                |
 *                 +----------------> ArMapSupplement
 *
 * </pre>

 * @see ArMapInterface
 * @see ArMap
**/
#ifndef ARMAPCOMPONENTS_H
#define ARMAPCOMPONENTS_H

#include "ArMapInterface.h"

class ArMapChangeDetails;
class ArMapFileLineSet;
class ArFileParser;
class ArMD5Calculator;


// ============================================================================
// ArMapScan 
// ============================================================================

/// The map data related to the sensable obstacles in the environment.
/**
 * ArMapScan encapsulates the data for a particular sensor that is generated 
 * during the scanning process (i.e. during the creation of a .2d file).  
 * The class's primary attributes are the points and line segments that 
 * were detected during the scan.  It contains methods to get and set these 
 * coordinates, and to read and write the data from and to a file.
 * <p>
 * The <code>scanType</code> parameters identify the sensor used for scanning. 
 * The parameter is used in the constructor, but it is generally disregarded
 * in the other methods.  (The method signatures are defined in 
 * ArMapScanInterface, which is also implemented by ArMap.  The map provides
 * access to the scan data for all of the sensors -- and therefore uses the 
 * <code>scanType</code> parameters.  This interface was chosen in order
 * to maintain backwards compatibility with the original map.)
 * <p>
 * If the scanType is specified, then it is used as a prefix to the DATA and
 * LINES tags that are contained in the map file.
**/
class ArMapScan : public ArMapScanInterface 
{
public:

  /// Constructor
  /**
   * Creates a new map scan object for the specified scan type.
   * @param scanType the const char * identifier of the scan; must be 
   * non-NULL and must not contain whitespaces
  **/
  AREXPORT ArMapScan(const char *scanType = ARMAP_DEFAULT_SCAN_TYPE);

  /// Copy constructor
  AREXPORT ArMapScan(const ArMapScan &other);

  /// Assignment operator
  AREXPORT ArMapScan &operator=(const ArMapScan &other);

  /// Destructor
  AREXPORT virtual ~ArMapScan();


  // --------------------------------------------------------------------------
  // ArMapScanInterface Methods
  // --------------------------------------------------------------------------

  AREXPORT virtual const char *getDisplayString
                                  (const char *scanType = ARMAP_DEFAULT_SCAN_TYPE);

  AREXPORT virtual std::vector<ArPose> *getPoints
                          (const char *scanType = ARMAP_DEFAULT_SCAN_TYPE);

  AREXPORT virtual std::vector<ArLineSegment> *getLines
                          (const char *scanType = ARMAP_DEFAULT_SCAN_TYPE);

  AREXPORT virtual ArPose getMinPose(const char *scanType = ARMAP_DEFAULT_SCAN_TYPE);

  AREXPORT virtual ArPose getMaxPose(const char *scanType = ARMAP_DEFAULT_SCAN_TYPE);

  AREXPORT virtual int getNumPoints(const char *scanType = ARMAP_DEFAULT_SCAN_TYPE);

  AREXPORT virtual bool isSortedPoints(const char *scanType = ARMAP_DEFAULT_SCAN_TYPE) const;

  AREXPORT virtual void setPoints(const std::vector<ArPose> *points,
                                  const char *scanType = ARMAP_DEFAULT_SCAN_TYPE,
                                  bool isSortedPoints = false,
                                  ArMapChangeDetails *changeDetails = NULL);


  AREXPORT virtual ArPose getLineMinPose(const char *scanType = ARMAP_DEFAULT_SCAN_TYPE);

  AREXPORT virtual ArPose getLineMaxPose(const char *scanType = ARMAP_DEFAULT_SCAN_TYPE);

  AREXPORT virtual int getNumLines(const char *scanType = ARMAP_DEFAULT_SCAN_TYPE);

  AREXPORT virtual bool isSortedLines(const char *scanType = ARMAP_DEFAULT_SCAN_TYPE) const;

  AREXPORT virtual void setLines(const std::vector<ArLineSegment> *lines,
                                 const char *scanType = ARMAP_DEFAULT_SCAN_TYPE,
                                 bool isSortedLines = false,
                                 ArMapChangeDetails *changeDetails = NULL);


  AREXPORT virtual int getResolution(const char *scanType = ARMAP_DEFAULT_SCAN_TYPE);

  AREXPORT virtual void setResolution(int resolution,
                                      const char *scanType = ARMAP_DEFAULT_SCAN_TYPE,
                                      ArMapChangeDetails *changeDetails = NULL);


  AREXPORT virtual void writeScanToFunctor
                                (ArFunctor1<const char *> *functor, 
 			                          const char *endOfLineChars,
                                const char *scanType = ARMAP_DEFAULT_SCAN_TYPE);

  AREXPORT virtual void writePointsToFunctor
 		                        (ArFunctor2<int, std::vector<ArPose> *> *functor,
                             const char *scanType = ARMAP_DEFAULT_SCAN_TYPE,
                             ArFunctor1<const char *> *keywordFunctor = NULL);

  AREXPORT virtual void writeLinesToFunctor
 	                          (ArFunctor2<int, std::vector<ArLineSegment> *> *functor,
                             const char *scanType = ARMAP_DEFAULT_SCAN_TYPE,
                             ArFunctor1<const char *> *keywordFunctor = NULL);

  AREXPORT virtual bool addToFileParser(ArFileParser *fileParser);

  AREXPORT virtual bool remFromFileParser(ArFileParser *fileParser);

  AREXPORT virtual bool readDataPoint( char *line);

  AREXPORT virtual bool readLineSegment( char *line);

  AREXPORT virtual void loadDataPoint(double x, double y);

  AREXPORT virtual void loadLineSegment(double x1, double y1, double x2, double y2);
  
  // --------------------------------------------------------------------------
  // Other Methods
  // --------------------------------------------------------------------------
 
  /// Resets the scan data, clearing all points and line segments
  AREXPORT virtual void clear();
  
  /// Combines the given other scan with this one.
  /**
   * @param other the ArMapScan * to be united with this one
   * @param isIncludeDataPointsAndLines a bool set to true if the other scan's
   * data points and lines should be copied to this scan; if false, then only
   * the summary (bounding box, counts, etc) information is copied.
  **/
  AREXPORT virtual bool unite(ArMapScan *other,
                              bool isIncludeDataPointsAndLines = false);
  
  /// Returns the time at which the scan data was last changed.
  AREXPORT virtual ArTime getTimeChanged() const;

  // TODO: Which of these need to be in the ArMapScanInterface?

  /// Returns the unique string identifier of the associated scan type.
  AREXPORT virtual const char *getScanType() const;

  /// Returns the keyword that designates the scan's data points in the map file.
  AREXPORT virtual const char *getPointsKeyword() const;
  /// Returns the keyword that designates the scan's data lines in the map file.
  AREXPORT virtual const char *getLinesKeyword() const;

  /// Writes the scan's data points (and introductory keyword) to the given functor.
  AREXPORT virtual void writePointsToFunctor
                                (ArFunctor1<const char *> *functor, 
 			                          const char *endOfLineChars,
                                const char *scanType = ARMAP_DEFAULT_SCAN_TYPE);

  /// Writes the scan's data lines (and introductory keyword) to the given functor.
  AREXPORT virtual void writeLinesToFunctor
                                (ArFunctor1<const char *> *functor, 
 			                           const char *endOfLineChars,
                                 const char *scanType = ARMAP_DEFAULT_SCAN_TYPE);

  
  /// Adds the handlers for the data points and lines keywords to the given file parser.
  /**
   * These handlers are "extra" because they are added after all of the summary
   * keyword have been parsed.
  **/
  AREXPORT virtual bool addExtraToFileParser(ArFileParser *fileParser,
                                            bool isAddLineHandler);

  /// Removes the handlers for the data points and lines keywords from the given file parser.
  AREXPORT virtual bool remExtraFromFileParser(ArFileParser *fileParser);


protected:

  /// Writes the list of data lines to the given functor.
  /**
   * @param functor the ArFunctor1<const char *> * to which to write the 
   * data lines
   * @param lines the vector of ArLineSegments to be written to the functor
   * @param endOfLineChars an optional string to be appended to the end of 
   * each text line written to the functor
   * @param scanType the unique string identifier of the scan type associated
   * with the data lines
  **/
  AREXPORT virtual void writeLinesToFunctor
                                (ArFunctor1<const char *> *functor, 
                                 const std::vector<ArLineSegment> &lines,
 			                           const char *endOfLineChars,
                                 const char *scanType = ARMAP_DEFAULT_SCAN_TYPE);


  // Function to read the minimum pos
  bool handleMinPos(ArArgumentBuilder *arg);
  // Function to read the maximum pos
  bool handleMaxPos(ArArgumentBuilder *arg);
  // Function to read the number of points
  bool handleNumPoints(ArArgumentBuilder *arg);
  // Function to read whether the points are sorted
  bool handleIsSortedPoints(ArArgumentBuilder *arg);

  // Function to read the line minimum pos
  bool handleLineMinPos(ArArgumentBuilder *arg);
  // Function to read the line maximum pos
  bool handleLineMaxPos(ArArgumentBuilder *arg);
  // Function to read the number of lines
  bool handleNumLines(ArArgumentBuilder *arg);
  // Function to read whether the lines are sorted
  bool handleIsSortedLines(ArArgumentBuilder *arg);

  // Function to handle the resolution
  bool handleResolution(ArArgumentBuilder *arg);
  /// Callback to handle the Display string.
  bool handleDisplayString(ArArgumentBuilder *arg);

  // Function to snag the map points (mainly for the getMap over the network)
  bool handlePoint(ArArgumentBuilder *arg);
  // Function to snag the line segments (mainly for the getMap over the network)
  bool handleLine(ArArgumentBuilder *arg);
  
  /// Adds the specified argument handler to the given file parser.
  bool addHandlerToFileParser(ArFileParser *fileParser,
                              const char *keyword,
                              ArRetFunctor1<bool, ArArgumentBuilder *> *handler);

  /// Returns the keyword prefix for this scan type.
  const char *getKeywordPrefix() const;

  /// Parses a pose from the given arguments.
  bool parsePose(ArArgumentBuilder *arg,
                 const char *keyword,
                 ArPose *poseOut);

  /// Parses an integer from the given text line.
  bool parseNumber(char *line, 
                   size_t lineLen, 
                   size_t *charCountOut,
                   int *numOut) const;

  /// Parses whitespace from the given text line.
  bool parseWhitespace(char *line,
                       size_t lineLen,
                       size_t *charCountOut) const;


private:

  /// Constant appended to the end of each scan data text line.
  static const char *EOL_CHARS;

protected:

  /// The unique string identifier of this scan type.
  std::string myScanType;
  /// Whether this is a special summary of the other scans.
  bool myIsSummaryScan;

  /// The prefix prepended to the output log file messages.
  std::string myLogPrefix;
  /// The prefix prepended to the map file keywords (e.g. DATA and LINES)
  std::string myKeywordPrefix;
  /// The keyword that designates this scan's data points in the map file.
  std::string myPointsKeyword;
  /// The keyword that designates this scan's data lines in the map file.
  std::string myLinesKeyword;

  /// Time that this scan data was last modified.
  ArTime myTimeChanged;

  /// Displayable text for this scan type.
  std::string myDisplayString;

  /// Number of data points in the scan.
  int myNumPoints;
  /// Number of data lines in the scan.
  int myNumLines;
  /// Resolution of the data points (in mm).
  int myResolution;
  /// Maximum x/y values of all of the data points in the scan.
  ArPose myMax;
  /// Minimum x/y values of all of the data points in the scan.
  ArPose myMin;
  /// Maximum x/y values of all of the data lines in the scan.
  ArPose myLineMax;
  /// Minimum x/y values of all of the data lines in the scan.
  ArPose myLineMin;

  /// Whether the data points in myPoints have been sorted in ascending order.
  bool myIsSortedPoints;
  /// Whether the data lines in myLines have been sorted in ascending order.
  bool myIsSortedLines;

  /// List of data points contained in this scan data.
  std::vector<ArPose> myPoints;
  /// List of data lines contained in this scan data.
  std::vector<ArLineSegment> myLines;

  /// Callback to parse the minimum poise from the map file.
  ArRetFunctor1C<bool, ArMapScan, ArArgumentBuilder *> myMinPosCB;
  /// Callback to parse the maximum pose from the map file.
  ArRetFunctor1C<bool, ArMapScan, ArArgumentBuilder *> myMaxPosCB;
  /// Callback to parse whether the points in the map file have been sorted.
  ArRetFunctor1C<bool, ArMapScan, ArArgumentBuilder *> myIsSortedPointsCB;
  /// Callback to parse the number of data points in the map file.
  ArRetFunctor1C<bool, ArMapScan, ArArgumentBuilder *> myNumPointsCB;

  /// Callback to parse the minimum line pose from the map file.
  ArRetFunctor1C<bool, ArMapScan, ArArgumentBuilder *> myLineMinPosCB;
  /// Callback to parse the maximum line pose from the map file.
  ArRetFunctor1C<bool, ArMapScan, ArArgumentBuilder *> myLineMaxPosCB;
  /// Callback to parse whether the lines in the map file have been sorted.
  ArRetFunctor1C<bool, ArMapScan, ArArgumentBuilder *> myIsSortedLinesCB;
  /// Callback to parse the number of data lines in the map file.
  ArRetFunctor1C<bool, ArMapScan, ArArgumentBuilder *> myNumLinesCB;

  /// Callback to parse the resolution in the map file.
  ArRetFunctor1C<bool, ArMapScan, ArArgumentBuilder *> myResolutionCB;
  /// Callback to parse the displayable text for this scan type.
  ArRetFunctor1C<bool, ArMapScan, ArArgumentBuilder *> myDisplayStringCB;

  /// Callback to parse a data point.
  ArRetFunctor1C<bool, ArMapScan, ArArgumentBuilder *> myPointCB;
  /// Callback to parse a data line.
  ArRetFunctor1C<bool, ArMapScan, ArArgumentBuilder *> myLineCB;

}; // end class ArMapScan

// ============================================================================
// ArMapObjects
// ============================================================================

/// The collection of map objects that are contained in an Aria map.
/**
 * ArMapObjects contains a list of objects defined in an Aria map.  There are
 * two basic classes of objects:  user-defined objects such as goals and 
 * forbidden areas; and, special data objects that are usually automatically
 * generated during the scanning process.
**/
class ArMapObjects : public ArMapObjectsInterface				
{

public :

  /// Default keyword that prefixes each map object line in the map file
  static const char *DEFAULT_KEYWORD;

  /// Constructor
  /**
   * @param keyword the char * keyword that prefixes each map object line in
   * the map file
  **/
  AREXPORT ArMapObjects(const char *keyword = "Cairn:");

  /// Copy constructor
  AREXPORT ArMapObjects(const ArMapObjects &other);

  /// Assignment operator
  AREXPORT ArMapObjects &operator=(const ArMapObjects &other);

  /// Destructor
  AREXPORT virtual ~ArMapObjects();


  // ---------------------------------------------------------------------------
  // ArMapObjectsInterface Methods
  // ---------------------------------------------------------------------------

  AREXPORT virtual ArMapObject *findFirstMapObject(const char *name, 
                                                   const char *type,
                                                   bool isIncludeWithHeading = false);

  AREXPORT virtual ArMapObject *findMapObject(const char *name, 
 				                                      const char *type = NULL, 
                                              bool isIncludeWithHeading = false);

  AREXPORT virtual std::list<ArMapObject *> findMapObjectsOfType
                                                    (const char *type,
                                                     bool isIncludeWithHeading = false);

  AREXPORT virtual std::list<ArMapObject *> *getMapObjects(void);

  AREXPORT virtual void setMapObjects(const std::list<ArMapObject *> *mapObjects,
                                      bool isSortedObjects = false,
                                      ArMapChangeDetails *changeDetails = NULL); 
   
  AREXPORT void writeObjectListToFunctor(ArFunctor1<const char *> *functor, 
		                                     const char *endOfLineChars);


  // ---------------------------------------------------------------------------
  // Other Methods
  // ---------------------------------------------------------------------------

  /// Clears the map objects and deletes them.
  AREXPORT virtual void clear();

  /// Adds the keyword and handler for the map objects to the given file parser.
  AREXPORT virtual bool addToFileParser(ArFileParser *fileParser);

  /// Removes the keyword and handler for the map objects from the given file parser.
  AREXPORT virtual bool remFromFileParser(ArFileParser *fileParser);

  /// Returns the time at which the map objects were last changed.
  AREXPORT virtual ArTime getTimeChanged() const;
 
protected:

  // Function to handle the cairns
  bool handleMapObject(ArArgumentBuilder *arg);

  /// Sorts the given list of map objects in order of increasing object pose.
  void sortMapObjects(std::list<ArMapObject *> *mapObjects);

  /// Writes the map objects to the given ArMapFileLineSet.
  void createMultiSet(ArMapFileLineSet *multiSet);

  /// Writes the given ArMapFileLineSet to the output log with the specified prefix.
  void logMultiSet(const char *prefix,
                   ArMapFileLineSet *multiSet);

protected:

  /// Time at which the map objects were last changed.
  ArTime myTimeChanged;
  /// Whether the myMapObjects list has been sorted in increasing (pose) order.
  bool myIsSortedObjects;

  /// Keyword that prefixes each map object in the map file.
  std::string myKeyword;

  /// List of map objects contained in the Aria map.
  std::list<ArMapObject *> myMapObjects;

  /// Callback to parse the map object from the map file.
  ArRetFunctor1C<bool, ArMapObjects, ArArgumentBuilder *> myMapObjectCB;

}; // end class ArMapObjects


// ============================================================================
// ArMapInfo
// ============================================================================


/// A container for the various "info" tags in an Aria map.
/**
 * ArMapInfo is an implementation of ArMapInfoInterface that provides access
 * to a collection of "info" arguments (such as MapInfo and RouteInfo).  An Aria 
 * map may have one or more categories of info, each implemented by an ordered 
 * list of ArArgumentBuilder's.
 *
 * Info types are currently identified by a unique integer.  The default types
 * are defined in ArMapInfoInterface::InfoType, but applications may define 
 * additional types.  (See ArMapInfo::ArMapInfo(int*, char**, size_t))
**/
class ArMapInfo : public ArMapInfoInterface
{
public:

  /// Contructor
  /**
   * @param infoNameList an array of the char * keywords for each of the
   * standard ArMapInfo::InfoType's; if NULL, then the default keywords are
   * used
   * @param infoNameCount the size_t length of the infoNameList array
   * @param keywordPrefix optional prefix to add to keywords.
  **/ 
  AREXPORT ArMapInfo(const char **infoNameList = NULL,
                     size_t infoNameCount = 0,
                     const char *keywordPrefix = NULL);

  /// Copy contructor
  AREXPORT ArMapInfo(const ArMapInfo &other);
  /// Assignment operator
  AREXPORT ArMapInfo &operator=(const ArMapInfo &other);
  /// Destructor
  AREXPORT virtual ~ArMapInfo();

  // ---------------------------------------------------------------------------
  // ArMapInfoInterface Methods
  // ---------------------------------------------------------------------------

  AREXPORT virtual std::list<ArArgumentBuilder *> *getInfo(const char *infoName);

  AREXPORT virtual std::list<ArArgumentBuilder *> *getInfo(int infoType);
  AREXPORT virtual std::list<ArArgumentBuilder *> *getMapInfo(void);

  AREXPORT virtual int getInfoCount() const;

  AREXPORT virtual std::list<std::string> getInfoNames() const;

  AREXPORT virtual bool setInfo(const char *infoName,
                                const std::list<ArArgumentBuilder *> *infoList,
                                ArMapChangeDetails *changeDetails);


  AREXPORT virtual bool setInfo(int infoType,
 						                    const std::list<ArArgumentBuilder *> *infoList,
                                ArMapChangeDetails *changeDetails = NULL); 
  AREXPORT virtual bool setMapInfo(const std::list<ArArgumentBuilder *> *mapInfo,
                                   ArMapChangeDetails *changeDetails = NULL); 


  AREXPORT virtual const char *getInfoName(int infoType);

  AREXPORT virtual void writeInfoToFunctor(ArFunctor1<const char *> *functor, 
 			                                     const char *endOfLineChars);

  // ---------------------------------------------------------------------------
  // Other Methods
  // ---------------------------------------------------------------------------

  /// Clears all info arguments and deletes them.
  AREXPORT virtual void clear();
 
  /// Adds handlers for all of the info types to the given file parser.
  AREXPORT virtual bool addToFileParser(ArFileParser *fileParser);
  /// Removes handlers for all of the info types from the given file parser.
  AREXPORT virtual bool remFromFileParser(ArFileParser *fileParser);

  /// Returns the time at which the info were last changed.
  AREXPORT virtual ArTime getTimeChanged() const;

protected:

  /// Processes the given argument for the specified info.
  bool handleInfo(ArArgumentBuilder *arg);

  /// Give ArMapSimple access to the createMultiSet() and  setChanged() methods
  friend class ArMapSimple;
  
  /// Writes the specified info arguments to the given ArMapFileLineSet.
  /**
   * @param infoName unique identifier for the info to be written
   * @param multiSet the ArMapFileLineSet * to which to write the info; 
   * must be non-NULL
   * @param changeDetails the ArMapChangeDetails * that specifies the 
   * parent/child relationship amongst info lines 
   * @see ArMapChangeDetails::isChildArg
  **/
  void createMultiSet(const char *infoName, 
                      ArMapFileLineSet *multiSet,
                      ArMapChangeDetails *changeDetails);

  /// Basically updates the timeChanged to now.
  void setChanged();
  
  /// Populates this object with the default info names / keywords
  void setDefaultInfoNames();



protected:

  struct ArMapInfoData {

    ArMapInfo *myParent;
    int myType;
    std::string myKeyword;
    std::list<ArArgumentBuilder *> myInfo;
    ArRetFunctor1C<bool, ArMapInfo, ArArgumentBuilder *> *myInfoCB;

    ArMapInfoData(ArMapInfo *parent,
                  const char *name = NULL,
                  int type = -1);
    ~ArMapInfoData();
    ArMapInfoData(ArMapInfo *parent,
                  const ArMapInfoData &other);
    ArMapInfoData &operator=(const ArMapInfoData &other);

  }; // end struct ArMapInfoData

  typedef std::map<std::string, ArMapInfoData *, ArStrCaseCmpOp> ArInfoNameToDataMap;


  AREXPORT ArMapInfoData *findData(const char *infoName);

  AREXPORT ArMapInfoData *findDataByKeyword(const char *keyword);


   /// Time at which the info was last changed
  ArTime myTimeChanged;

  // Sigh... In retrospect, this should have been structured differently
  // and we probably should've used a string for the info identifier...

  /// Number of info types contained in this collection
  int myNumInfos;
  std::string myPrefix;

  std::map<int, std::string> myInfoTypeToNameMap;
  ArInfoNameToDataMap myInfoNameToDataMap;
  std::map<std::string, std::string, ArStrCaseCmpOp> myKeywordToInfoNameMap;

}; // end class ArMapInfo


// ============================================================================
// ArMapSupplement
// ============================================================================

/// Supplemental data associated with an Aria map.
/**
 * ArMapSupplement is a repository for extra, miscellaneous data that is 
 * associated with an Aria map but which does not fit neatly into any of the 
 * other components.  
**/
class ArMapSupplement : public ArMapSupplementInterface 
{
public:

  /// Constructor
  AREXPORT ArMapSupplement();

  /// Copy constructor
  AREXPORT ArMapSupplement(const ArMapSupplement &other);

  /// Assignment operator
  AREXPORT ArMapSupplement &operator=(const ArMapSupplement &other);

  /// Destructor
  AREXPORT virtual ~ArMapSupplement();


  // --------------------------------------------------------------------------
  // ArMapSupplementInterface Methods
  // --------------------------------------------------------------------------

  AREXPORT virtual bool hasOriginLatLongAlt();
  
  AREXPORT virtual ArPose getOriginLatLong();
  
  AREXPORT virtual double getOriginAltitude();

  AREXPORT virtual void setOriginLatLongAlt(bool hasOriginLatLong,
                                            const ArPose &originLatLong,
                                            double altitude,
                                            ArMapChangeDetails *changeDetails = NULL);
  
  AREXPORT virtual void writeSupplementToFunctor
                                (ArFunctor1<const char *> *functor, 
 			                           const char *endOfLineChars);

  // --------------------------------------------------------------------------
  // Other Methods
  // --------------------------------------------------------------------------

  /// Resets the map supplement to its default values.
  AREXPORT virtual void clear();

  /// Adds handlers for all of the supplement keywords to the given file parser.
  AREXPORT virtual bool addToFileParser(ArFileParser *fileParser);
  /// Removes handlers for all of the supplement keywords from the given file parser.
  AREXPORT virtual bool remFromFileParser(ArFileParser *fileParser);
  
  /// Returns the time at which the supplement data were last changed.
  AREXPORT virtual ArTime getTimeChanged() const;

protected:

  // Function to get the origin lat long altitude
  bool handleOriginLatLongAlt(ArArgumentBuilder *arg);
  
private:

  /// Constant appended to the end of each supplement text line.
  static const char *EOL_CHARS;

protected:

  /// Time at which the supplement was last changed
  ArTime myTimeChanged;

  /// Whether the supplement data contains latitude/longitude information for the origin
  bool myHasOriginLatLongAlt;
  /// The latitude/longitude of the origin; only if myHasOriginLatLongAlt is true
  ArPose myOriginLatLong;
  /// The altitude (in m) of the origin; only if myHasOriginLatLongAlt is true
  double myOriginAltitude;

  /// Callback that parses the origin latitude/longitude/altitude information
  ArRetFunctor1C<bool, ArMapSupplement, ArArgumentBuilder *> myOriginLatLongAltCB;

}; // end class ArMapSupplement


// =============================================================================
// ArMapSimple
// =============================================================================
 
/// Comparator used to sort scan data types in a case-insensitive manner. 
struct ArDataTagCaseCmpOp 
{
public:
  bool operator() (const std::string &s1, const std::string &s2) const
  {
    size_t s1Len = s1.length();
    size_t s2Len = s2.length();

    if (s1Len < s2Len) {
      return strncasecmp(s1.c_str(), s2.c_str(), s1Len) < 0;
    }
    else {
      return strncasecmp(s1.c_str(), s2.c_str(), s2Len) < 0;
    }
  }
}; // end struct ArDataTagCaseCmpOp

/// Type definition for a map of scan types to scan data.
typedef std::map<std::string, ArMapScan *, ArStrCaseCmpOp> ArTypeToScanMap;

/// Type definition for a map of data tags to scan types
typedef std::map<std::string, std::string, ArDataTagCaseCmpOp> ArDataTagToScanTypeMap;


/// Simple map that can be read from and written to a file
/**
 * ArMapSimple is the real subject of the ArMap proxy.  Functionally, it is identical
 * to the ArMap, @b except that it is not well-suited for for loading from a file at
 * runtime and therefore doesn't provide any hooks into the Aria config.  In general,
 * ArMap should be used instead.  The exception to this rule may be in off-line 
 * authoring tools where error checking can be performed at a higher level.
**/
class ArMapSimple : public ArMapInterface
{
public:

  /// Constructor
  /**
   * @param baseDirectory the name of the directory in which to search for map
   * files that are not fully qualified
   * @param tempDirectory the name of the directory in which to write temporary
   * files when saving a map; if NULL, then the map file is written directly.  
   * Note that using a temp file reduces the risk that the map will be corrupted
   * if the application crashes.
   * @param overrideMutexName an optional name to be used for the map object's
   * mutex; useful for debugging when multiple maps are active
  **/
  AREXPORT ArMapSimple(const char *baseDirectory = "./",
                       const char *tempDirectory = NULL,
                       const char *overrideMutexName = NULL);

  /// Copy constructor
  AREXPORT ArMapSimple(const ArMapSimple &other);
  /// Assignment operator
  AREXPORT ArMapSimple &operator=(const ArMapSimple &other);
  /// Destructor
  AREXPORT virtual ~ArMapSimple(void);


  AREXPORT virtual void clear();

  AREXPORT virtual bool set(ArMapInterface *other);

  AREXPORT virtual ArMapInterface *clone();

  // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  // Scan Types Methods
  // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
   
  AREXPORT virtual std::list<std::string> getScanTypes() const;

  AREXPORT virtual bool setScanTypes(const std::list<std::string> &scanTypeList);

  // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  // Locking / Semaphore Method
  // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

  AREXPORT virtual int lock();

  AREXPORT virtual int tryLock();

  AREXPORT virtual int unlock();


  // ---------------------------------------------------------------------------
  // ArMapInfoInterface
  // ---------------------------------------------------------------------------

  AREXPORT virtual std::list<ArArgumentBuilder *> *getInfo(const char *infoName);
  AREXPORT virtual std::list<ArArgumentBuilder *> *getInfo(int infoType);
  AREXPORT virtual std::list<ArArgumentBuilder *> *getMapInfo(void);
  
  AREXPORT virtual int getInfoCount() const;
  
  AREXPORT virtual std::list<std::string> getInfoNames() const;

  AREXPORT virtual bool setInfo(const char *infoName,
 						                    const std::list<ArArgumentBuilder *> *infoList,
                                ArMapChangeDetails *changeDetails = NULL);

  AREXPORT virtual bool setInfo(int infoType,
 						                    const std::list<ArArgumentBuilder *> *infoList,
                                ArMapChangeDetails *changeDetails = NULL);

  AREXPORT virtual bool setMapInfo(const std::list<ArArgumentBuilder *> *mapInfo,
                                   ArMapChangeDetails *changeDetails = NULL);

  AREXPORT virtual void writeInfoToFunctor
 				(ArFunctor1<const char *> *functor, 
 			        const char *endOfLineChars);

  AREXPORT virtual const char *getInfoName(int infoType);

  // ---------------------------------------------------------------------------
  // ArMapObjectsInterface
  // ---------------------------------------------------------------------------

  AREXPORT virtual ArMapObject *findFirstMapObject(const char *name, 
                                                   const char *type,
                                                   bool isIncludeWithHeading = false);

  AREXPORT virtual ArMapObject *findMapObject(const char *name, 
 				                                      const char *type = NULL,
                                              bool isIncludeWithHeading = false);

  AREXPORT virtual std::list<ArMapObject *> findMapObjectsOfType
                                                    (const char *type,
                                                     bool isIncludeWithHeading = false);

  AREXPORT virtual std::list<ArMapObject *> *getMapObjects(void);

  AREXPORT virtual void setMapObjects(const std::list<ArMapObject *> *mapObjects,
                                      bool isSortedObjects = false,
                                      ArMapChangeDetails *changeDetails = NULL); 


   AREXPORT virtual void writeObjectListToFunctor(ArFunctor1<const char *> *functor, 
			                                            const char *endOfLineChars);

  // ---------------------------------------------------------------------------
  // ArMapSupplementInterface
  // ---------------------------------------------------------------------------

  AREXPORT virtual bool hasOriginLatLongAlt();

  AREXPORT virtual ArPose getOriginLatLong();

  AREXPORT virtual double getOriginAltitude();

  AREXPORT virtual void setOriginLatLongAlt
                                        (bool hasOriginLatLong,
                                         const ArPose &originLatLong,
                                         double altitude,
                                         ArMapChangeDetails *changeDetails = NULL);


  AREXPORT virtual void writeSupplementToFunctor(ArFunctor1<const char *> *functor, 
			                                          const char *endOfLineChars);

  // ---------------------------------------------------------------------------
  // ArMapScanInterface
  // ---------------------------------------------------------------------------

  AREXPORT virtual const char *getDisplayString
                                 (const char *scanType = ARMAP_DEFAULT_SCAN_TYPE);

  AREXPORT virtual std::vector<ArPose> *getPoints
                                 (const char *scanType = ARMAP_DEFAULT_SCAN_TYPE);

  AREXPORT virtual ArPose getMinPose(const char *scanType = ARMAP_DEFAULT_SCAN_TYPE);
  AREXPORT virtual ArPose getMaxPose(const char *scanType = ARMAP_DEFAULT_SCAN_TYPE);
  AREXPORT virtual int getNumPoints(const char *scanType = ARMAP_DEFAULT_SCAN_TYPE);
  AREXPORT virtual bool isSortedPoints(const char *scanType = ARMAP_DEFAULT_SCAN_TYPE) const;

  AREXPORT virtual void setPoints(const std::vector<ArPose> *points,
                                  const char *scanType = ARMAP_DEFAULT_SCAN_TYPE,
                                  bool isSortedPoints = false,
                                  ArMapChangeDetails *changeDetails = NULL);


  AREXPORT virtual std::vector<ArLineSegment> *getLines
                                 (const char *scanType = ARMAP_DEFAULT_SCAN_TYPE);

  AREXPORT virtual ArPose getLineMinPose(const char *scanType = ARMAP_DEFAULT_SCAN_TYPE);
  AREXPORT virtual ArPose getLineMaxPose(const char *scanType = ARMAP_DEFAULT_SCAN_TYPE);
  AREXPORT virtual int getNumLines(const char *scanType = ARMAP_DEFAULT_SCAN_TYPE);
  AREXPORT virtual bool isSortedLines(const char *scanType = ARMAP_DEFAULT_SCAN_TYPE) const;

  AREXPORT virtual void setLines(const std::vector<ArLineSegment> *lines,
                                 const char *scanType = ARMAP_DEFAULT_SCAN_TYPE,
                                 bool isSortedLines = false,
                                 ArMapChangeDetails *changeDetails = NULL);


  AREXPORT virtual int getResolution(const char *scanType = ARMAP_DEFAULT_SCAN_TYPE);

  AREXPORT virtual void setResolution(int resolution,
                                      const char *scanType = ARMAP_DEFAULT_SCAN_TYPE,
                                      ArMapChangeDetails *changeDetails = NULL);

  
  AREXPORT virtual void writeScanToFunctor
                              (ArFunctor1<const char *> *functor, 
			                         const char *endOfLineChars,
                               const char *scanType = ARMAP_DEFAULT_SCAN_TYPE);

  AREXPORT virtual void writePointsToFunctor
                              (ArFunctor2<int, std::vector<ArPose> *> *functor,
                               const char *scanType = ARMAP_DEFAULT_SCAN_TYPE,
                               ArFunctor1<const char *> *keywordFunctor = NULL);

  AREXPORT virtual void writeLinesToFunctor
 	                            (ArFunctor2<int, std::vector<ArLineSegment> *> *functor,
                               const char *scanType = ARMAP_DEFAULT_SCAN_TYPE,
                               ArFunctor1<const char *> *keywordFunctor = NULL);

  AREXPORT virtual bool addToFileParser(ArFileParser *fileParser);
  AREXPORT virtual bool remFromFileParser(ArFileParser *fileParser);


  AREXPORT virtual bool readDataPoint( char *line);
  AREXPORT virtual bool readLineSegment( char *line);


  /** Public for ArQClientMapProducer **/

  AREXPORT virtual void loadDataPoint(double x, double y);
  AREXPORT virtual void loadLineSegment(double x1, double y1, double x2, double y2);


  // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  // Map Changed / Callback Methods
  // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

  AREXPORT virtual void mapChanged(void);

  AREXPORT virtual void addMapChangedCB(ArFunctor *functor, 
					int position = 50);

  AREXPORT virtual void remMapChangedCB(ArFunctor *functor);

  AREXPORT virtual void addPreMapChangedCB(ArFunctor *functor,
                                           int position = 50);

  AREXPORT virtual void remPreMapChangedCB(ArFunctor *functor);

  AREXPORT virtual void setMapChangedLogLevel(ArLog::LogLevel level);

  AREXPORT virtual ArLog::LogLevel getMapChangedLogLevel(void);

  // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  // Persistence
  // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  

  AREXPORT virtual void writeToFunctor(ArFunctor1<const char *> *functor, 
 			                                 const char *endOfLineChars);

  AREXPORT virtual void writeObjectsToFunctor(ArFunctor1<const char *> *functor, 
 			                                        const char *endOfLineChars,
                                              bool isOverrideAsSingleScan = false,
                                              const char *maxCategory = NULL);

  // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  // File I/O Methods
  // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  
  AREXPORT virtual void addPreWriteFileCB(ArFunctor *functor,
                                          ArListPos::Pos position = ArListPos::LAST);
  AREXPORT virtual void remPreWriteFileCB(ArFunctor *functor);
 
  AREXPORT virtual void addPostWriteFileCB(ArFunctor *functor,
                                           ArListPos::Pos position = ArListPos::LAST);
  AREXPORT virtual void remPostWriteFileCB(ArFunctor *functor);

  AREXPORT virtual bool readFile(const char *fileName, 
 			                           char *errorBuffer = NULL, 
                                 size_t errorBufferLen = 0,
                                 unsigned char *md5DigestBuffer = NULL,
                                 size_t md5DigestBufferLen = 0);

  AREXPORT virtual bool writeFile(const char *fileName, 
                                  bool internalCall = false,
                                  unsigned char *md5DigestBuffer = NULL,
                                  size_t md5DigestBufferLen = 0,
                                  time_t fileTimestamp = -1);

#ifndef SWIG
  /// @swigomit
  AREXPORT virtual struct stat getReadFileStat() const;
#endif

  AREXPORT virtual bool getMapId(ArMapId *mapIdOut,
                                 bool isInternalCall = false);

  AREXPORT virtual bool calculateChecksum(unsigned char *md5DigestBuffer,
                                          size_t md5DigestBufferLen);
  
  AREXPORT virtual const char *getBaseDirectory(void) const;

  AREXPORT virtual void setBaseDirectory(const char *baseDirectory);

  AREXPORT virtual const char *getTempDirectory(void) const;

  AREXPORT virtual void setTempDirectory(const char *tempDirectory);

  AREXPORT virtual std::string createRealFileName(const char *fileName);

  AREXPORT virtual const char *getFileName(void) const;

  AREXPORT virtual void setSourceFileName(const char *sourceName,
                                          const char *fileName,
                                          bool isInternalCall = false);

  AREXPORT virtual bool refresh();


  virtual void setIgnoreEmptyFileName(bool ignore);
  virtual bool getIgnoreEmptyFileName(void);
  virtual void setIgnoreCase(bool ignoreCase = false);
  virtual bool getIgnoreCase(void);

  // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  // Inactive Section
  // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

  AREXPORT virtual ArMapInfoInterface *getInactiveInfo();

  AREXPORT virtual ArMapObjectsInterface *getInactiveObjects();

  // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  // Child Objects Section
  // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

  AREXPORT virtual ArMapObjectsInterface *getChildObjects();

  // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  // Miscellaneous
  // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -


  AREXPORT virtual ArArgumentBuilder *findMapObjectParams(const char *mapObjectName);

  AREXPORT virtual bool setMapObjectParams(const char *mapObjectName,
                                           ArArgumentBuilder *params, 
                                           ArMapChangeDetails *changeDetails = NULL);



  AREXPORT virtual std::list<ArArgumentBuilder *> *getRemainder();

  AREXPORT virtual void setQuiet(bool isQuiet);
 	
  AREXPORT bool parseLine(char *line);
  AREXPORT void parsingComplete(void);

  AREXPORT bool isLoadingDataStarted(); 
  AREXPORT bool isLoadingLinesAndDataStarted(); 


  // ---------------------------------------------------------------------

  /// Searches the given CairnInfo list for an entry that matches the given mapObject.
  /**
   * The CairnInfo list stores the parameter information (if any) for map 
   * objects. If a map object is removed (or activated), then the CairnInfo 
   * must also be updated.
   * @param mapObjectName the ArMapObject for which to find the parameters
   * @param cairnInfoList the list of ArArgumentBuilder *'s that contain the
   * map object parameters (also may be set to the inactive section)
   * @return iterator that points to the parameter information for the map
   * object, or cairnInfoList.end() if not found
  **/
  AREXPORT static std::list<ArArgumentBuilder *>::iterator findMapObjectParamInfo
             (const char *mapObjectName,
              std::list<ArArgumentBuilder*> &cairnInfoList);

protected:

  AREXPORT bool setInactiveInfo(const char *infoName,
 						                    const std::list<ArArgumentBuilder *> *infoList,
                                ArMapChangeDetails *changeDetails = NULL);

  AREXPORT void setInactiveObjects(const std::list<ArMapObject *> *mapObjects,
                                   bool isSortedObjects = false,
                                   ArMapChangeDetails *changeDetails = NULL); 

  AREXPORT void setChildObjects(const std::list<ArMapObject *> *mapObjects,
                                bool isSortedObjects = false,
                                ArMapChangeDetails *changeDetails = NULL); 

  // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  
  /// Callback that handles the different types of map categories (e.g. 2D-Map, 2D-Map-Ex)
  /**
   * This method replaces the old handle2DMap method.  It determines which category
   * was detected and sets the myMapCategory attribute accordingly.
   * @param arg a pointer to the parsed ArArgumentBuilder; no arguments are expected
  **/
  bool handleMapCategory(ArArgumentBuilder *arg);
  
  /// Callback that handles the Sources keyword
  /**
   * @param arg a pointer to the parsed ArArgumentBuilder; a list of string scan type
   * arguments are expected
  **/
  bool handleSources(ArArgumentBuilder *arg);


  /// Callback that handles the different types of data introductions (e.g. DATA, LINES)
  /**
   * This method replaces the old handleData and handleLines methods.  It determines
   * which keyword was detected and updates the myLoadingDataTag and myLoadingScan
   * attributes accordingly.
   * @param arg a pointer to the parsed ArArgumentBuilder; no arguments are expected
  **/
  bool handleDataIntro(ArArgumentBuilder *arg);


  bool handleRemainder(ArArgumentBuilder *arg);


  // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

  /// Returns the ArMapScan for the specified scan type.
  AREXPORT virtual ArMapScan *getScan(const char *scanType) const;

  /// Sets up the map to contain teh specified scan types.
  /**
   * Any scans which are currently in the map are cleared and removed.
   * This method is not virtual because it is called by the constructor.
   * @param scanTypeList a list of the scan type string identifiers to be 
   * created; the list must be non-empty and must not contain duplicates;
   * if the list contains more than one entry, then they all must be 
   * non-empty
   * @return bool true if the scans were successfully created; false otherwise
  **/
  bool createScans(const std::list<std::string> &scanTypeList);

  /// Adds all of the map's scan types to the current file parser.
  /**
   * This method calls addToFileParser() on each of the map's scans.  It also
   * adds handlers for each of the scans' data point and line introduction 
   * keywords.
   * @return bool true if the scans were successfully added to the current
   * file parser
  **/
  bool addScansToParser();

  /// Removes all of the map's scan types from the current file parser.
  bool remScansFromParser(bool isRemovePointsAndLinesKeywords = true);

  AREXPORT void writeScanTypesToFunctor(ArFunctor1<const char *> *functor, 
			                                  const char *endOfLineChars);

  AREXPORT ArTime findMaxMapScanTimeChanged();

  AREXPORT ArMapScan *findScanWithDataKeyword(const char *myLoadingDataTag,
                                              bool *isLineDataTagOut);
  
  AREXPORT void updateSummaryScan();
  

  // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  

  AREXPORT virtual const char *getMapCategory();


  AREXPORT virtual void updateMapCategory(const char *updatedInfoName = NULL);

  AREXPORT virtual bool mapInfoContains(const char *arg0Text);

  AREXPORT bool isDataTag(const char *line); 

  AREXPORT void reset();

  AREXPORT void updateMapFileInfo(const char *realFileName);



  AREXPORT static int getNextFileNumber();

  AREXPORT void invokeCallbackList(std::list<ArFunctor*> *cbList);
  
  AREXPORT void addToCallbackList(ArFunctor *functor,
                                  ArListPos::Pos position,
                                  std::list<ArFunctor*> *cbList);

  AREXPORT void remFromCallbackList(ArFunctor *functor,
                                    std::list<ArFunctor*> *cbList);

protected:

  // static const char *ourDefaultInactiveInfoNames[INFO_COUNT];


  static int ourTempFileNumber;
  static ArMutex ourTempFileNumberMutex;

  // lock for our data
  ArMutex myMutex;

  std::list<std::string> myMapCategoryList;
  std::string myMapCategory;


  ArMD5Calculator *myChecksumCalculator;

  std::string myBaseDirectory;
  std::string myFileName;
  struct stat myReadFileStat;

  std::list<ArFunctor*> myPreWriteCBList;
  std::list<ArFunctor*> myPostWriteCBList;

  bool myIsWriteToTempFile;
  std::string myTempDirectory;

  ArMapId myMapId;

  ArFileParser *myLoadingParser;

  // std::string myConfigParam;
  bool myIgnoreEmptyFileName;
  bool myIgnoreCase;

  ArMapChangedHelper *myMapChangedHelper;

  /***
  // things for our config
  bool myConfigProcessedBefore;
  char myConfigMapName[MAX_MAP_NAME_LENGTH];
  ***/

  bool myLoadingGotMapCategory; 
  // TODO: Need to change for multi scans
  bool myLoadingDataStarted;
  bool myLoadingLinesAndDataStarted;

  ArMapInfo       * const myMapInfo;
  ArMapObjects    * const myMapObjects;
  ArMapSupplement * const myMapSupplement;

  std::list<std::string> myScanTypeList;
  ArTypeToScanMap myTypeToScanMap;
  ArMapScan    * mySummaryScan;

  ArDataTagToScanTypeMap myDataTagToScanTypeMap;

  std::string    myLoadingDataTag;
  ArMapScan    * myLoadingScan;

  ArMapInfo    * const myInactiveInfo;
  ArMapObjects * const myInactiveObjects;

  ArMapObjects * const myChildObjects;

  std::map<std::string, ArArgumentBuilder *, ArStrCaseCmpOp> myMapObjectNameToParamsMap;

  /// List of map file lines that were not recognized
  std::list<ArArgumentBuilder *> myRemainderList;

  ArTime myTimeMapInfoChanged;
  ArTime myTimeMapObjectsChanged;
  ArTime myTimeMapScanChanged;
  ArTime myTimeMapSupplementChanged;

  // callbacks
  ArRetFunctor1C<bool, ArMapSimple, ArArgumentBuilder *> myMapCategoryCB;
  ArRetFunctor1C<bool, ArMapSimple, ArArgumentBuilder *> mySourcesCB;
  ArRetFunctor1C<bool, ArMapSimple, ArArgumentBuilder *> myDataIntroCB;

  // Handler for unrecognized lines
  ArRetFunctor1C<bool, ArMapSimple, ArArgumentBuilder *> myRemCB;

  bool myIsQuiet;
  bool myIsReadInProgress;
  bool myIsCancelRead;

}; // end class ArMapSimple

/// --------------------------------------------------------------------------- 

#endif // ARMAPCOMPONENTS_H