Aria  2.8.0
ArMapSimple Class Reference

Simple map that can be read from and written to a file. More...

#include <ArMapComponents.h>

Inherits ArMapInterface.

Public Member Functions

virtual void addMapChangedCB (ArFunctor *functor, int position=50)
 
virtual void addPostWriteFileCB (ArFunctor *functor, ArListPos::Pos position=ArListPos::LAST)
 
virtual void addPreMapChangedCB (ArFunctor *functor, int position=50)
 
virtual void addPreWriteFileCB (ArFunctor *functor, ArListPos::Pos position=ArListPos::LAST)
 
virtual bool addToFileParser (ArFileParser *fileParser)
 
 ArMapSimple (const char *baseDirectory="./", const char *tempDirectory=NULL, const char *overrideMutexName=NULL)
 Constructor. More...
 
 ArMapSimple (const ArMapSimple &other)
 Copy constructor.
 
virtual bool calculateChecksum (unsigned char *md5DigestBuffer, size_t md5DigestBufferLen)
 
virtual void clear ()
 
virtual ArMapInterfaceclone ()
 
virtual std::string createRealFileName (const char *fileName)
 
virtual ArMapObjectfindFirstMapObject (const char *name, const char *type, bool isIncludeWithHeading=false)
 
virtual ArMapObjectfindMapObject (const char *name, const char *type=NULL, bool isIncludeWithHeading=false)
 
virtual ArArgumentBuilderfindMapObjectParams (const char *mapObjectName)
 
virtual std::list< ArMapObject * > findMapObjectsOfType (const char *type, bool isIncludeWithHeading=false)
 
virtual const char * getBaseDirectory (void) const
 
virtual ArMapObjectsInterfacegetChildObjects ()
 
virtual const char * getDisplayString (const char *scanType=ARMAP_DEFAULT_SCAN_TYPE)
 
virtual const char * getFileName (void) const
 
virtual bool getIgnoreCase (void)
 
virtual bool getIgnoreEmptyFileName (void)
 
virtual ArMapInfoInterfacegetInactiveInfo ()
 
virtual ArMapObjectsInterfacegetInactiveObjects ()
 
virtual std::list< ArArgumentBuilder * > * getInfo (const char *infoName)
 
virtual std::list< ArArgumentBuilder * > * getInfo (int infoType)
 
virtual int getInfoCount () const
 
virtual const char * getInfoName (int infoType)
 
virtual std::list< std::string > getInfoNames () const
 
virtual ArPose getLineMaxPose (const char *scanType=ARMAP_DEFAULT_SCAN_TYPE)
 
virtual ArPose getLineMinPose (const char *scanType=ARMAP_DEFAULT_SCAN_TYPE)
 
virtual std::vector< ArLineSegment > * getLines (const char *scanType=ARMAP_DEFAULT_SCAN_TYPE)
 
virtual ArLog::LogLevel getMapChangedLogLevel (void)
 
virtual bool getMapId (ArMapId *mapIdOut, bool isInternalCall=false)
 
virtual std::list< ArArgumentBuilder * > * getMapInfo (void)
 
virtual std::list< ArMapObject * > * getMapObjects (void)
 
virtual ArPose getMaxPose (const char *scanType=ARMAP_DEFAULT_SCAN_TYPE)
 
virtual ArPose getMinPose (const char *scanType=ARMAP_DEFAULT_SCAN_TYPE)
 
virtual int getNumLines (const char *scanType=ARMAP_DEFAULT_SCAN_TYPE)
 
virtual int getNumPoints (const char *scanType=ARMAP_DEFAULT_SCAN_TYPE)
 
virtual double getOriginAltitude ()
 
virtual ArPose getOriginLatLong ()
 
virtual std::vector< ArPose > * getPoints (const char *scanType=ARMAP_DEFAULT_SCAN_TYPE)
 
virtual struct stat getReadFileStat () const
 
virtual std::list< ArArgumentBuilder * > * getRemainder ()
 
virtual int getResolution (const char *scanType=ARMAP_DEFAULT_SCAN_TYPE)
 
virtual std::list< std::string > getScanTypes () const
 
virtual const char * getTempDirectory (void) const
 
virtual bool hasOriginLatLongAlt ()
 
bool isLoadingDataStarted ()
 
bool isLoadingLinesAndDataStarted ()
 
virtual bool isSortedLines (const char *scanType=ARMAP_DEFAULT_SCAN_TYPE) const
 
virtual bool isSortedPoints (const char *scanType=ARMAP_DEFAULT_SCAN_TYPE) const
 
virtual void loadDataPoint (double x, double y)
 Public for ArQClientMapProducer.
 
virtual void loadLineSegment (double x1, double y1, double x2, double y2)
 
virtual int lock ()
 
virtual void mapChanged (void)
 
ArMapSimpleoperator= (const ArMapSimple &other)
 Assignment operator.
 
bool parseLine (char *line)
 
void parsingComplete (void)
 
virtual bool readDataPoint (char *line)
 
virtual bool readFile (const char *fileName, char *errorBuffer=NULL, size_t errorBufferLen=0, unsigned char *md5DigestBuffer=NULL, size_t md5DigestBufferLen=0)
 
virtual bool readLineSegment (char *line)
 
virtual bool refresh ()
 
virtual bool remFromFileParser (ArFileParser *fileParser)
 
virtual void remMapChangedCB (ArFunctor *functor)
 
virtual void remPostWriteFileCB (ArFunctor *functor)
 
virtual void remPreMapChangedCB (ArFunctor *functor)
 
virtual void remPreWriteFileCB (ArFunctor *functor)
 
virtual bool set (ArMapInterface *other)
 
virtual void setBaseDirectory (const char *baseDirectory)
 
virtual void setIgnoreCase (bool ignoreCase=false)
 
virtual void setIgnoreEmptyFileName (bool ignore)
 
virtual bool setInfo (const char *infoName, const std::list< ArArgumentBuilder *> *infoList, ArMapChangeDetails *changeDetails=NULL)
 
virtual bool setInfo (int infoType, const std::list< ArArgumentBuilder *> *infoList, ArMapChangeDetails *changeDetails=NULL)
 
virtual void setLines (const std::vector< ArLineSegment > *lines, const char *scanType=ARMAP_DEFAULT_SCAN_TYPE, bool isSortedLines=false, ArMapChangeDetails *changeDetails=NULL)
 
virtual void setMapChangedLogLevel (ArLog::LogLevel level)
 
virtual bool setMapInfo (const std::list< ArArgumentBuilder *> *mapInfo, ArMapChangeDetails *changeDetails=NULL)
 
virtual bool setMapObjectParams (const char *mapObjectName, ArArgumentBuilder *params, ArMapChangeDetails *changeDetails=NULL)
 ArMapObject *obj = myMap->findMapObject(objName); const ArArgumentBuilder *args = myMap->findMapObjectParams(objName);. More...
 
virtual void setMapObjects (const std::list< ArMapObject *> *mapObjects, bool isSortedObjects=false, ArMapChangeDetails *changeDetails=NULL)
 
virtual void setOriginLatLongAlt (bool hasOriginLatLong, const ArPose &originLatLong, double altitude, ArMapChangeDetails *changeDetails=NULL)
 
virtual void setPoints (const std::vector< ArPose > *points, const char *scanType=ARMAP_DEFAULT_SCAN_TYPE, bool isSortedPoints=false, ArMapChangeDetails *changeDetails=NULL)
 
virtual void setQuiet (bool isQuiet)
 
virtual void setResolution (int resolution, const char *scanType=ARMAP_DEFAULT_SCAN_TYPE, ArMapChangeDetails *changeDetails=NULL)
 
virtual bool setScanTypes (const std::list< std::string > &scanTypeList)
 
virtual void setSourceFileName (const char *sourceName, const char *fileName, bool isInternalCall=false)
 
virtual void setTempDirectory (const char *tempDirectory)
 
virtual int tryLock ()
 
virtual int unlock ()
 
virtual bool writeFile (const char *fileName, bool internalCall=false, unsigned char *md5DigestBuffer=NULL, size_t md5DigestBufferLen=0, time_t fileTimestamp=-1)
 
virtual void writeInfoToFunctor (ArFunctor1< const char *> *functor, const char *endOfLineChars)
 
virtual void writeLinesToFunctor (ArFunctor2< int, std::vector< ArLineSegment > *> *functor, const char *scanType=ARMAP_DEFAULT_SCAN_TYPE, ArFunctor1< const char *> *keywordFunctor=NULL)
 
virtual void writeObjectListToFunctor (ArFunctor1< const char *> *functor, const char *endOfLineChars)
 
virtual void writeObjectsToFunctor (ArFunctor1< const char *> *functor, const char *endOfLineChars, bool isOverrideAsSingleScan=false, const char *maxCategory=NULL)
 
virtual void writePointsToFunctor (ArFunctor2< int, std::vector< ArPose > *> *functor, const char *scanType=ARMAP_DEFAULT_SCAN_TYPE, ArFunctor1< const char *> *keywordFunctor=NULL)
 
virtual void writeScanToFunctor (ArFunctor1< const char *> *functor, const char *endOfLineChars, const char *scanType=ARMAP_DEFAULT_SCAN_TYPE)
 
virtual void writeSupplementToFunctor (ArFunctor1< const char *> *functor, const char *endOfLineChars)
 
virtual void writeToFunctor (ArFunctor1< const char *> *functor, const char *endOfLineChars)
 
virtual ~ArMapSimple (void)
 Destructor.
 
- Public Member Functions inherited from ArMapInterface
virtual void addMapChangedCB (ArFunctor *functor, ArListPos::Pos position)
 Adds a callback that is invoked when the map has been changed. More...
 
virtual void addPreMapChangedCB (ArFunctor *functor, ArListPos::Pos position)
 Adds a callback called before the map changed callbacks are called. More...
 
 ArMapInterface ()
 Constructor.
 
virtual ~ArMapInterface (void)
 Destructor.
 
- Public Member Functions inherited from ArHasFileName
 ArHasFileName ()
 Constructor.
 
 ArHasFileName (ArHasFileName const &)
 Copy constructor.
 
ArHasFileNameoperator= (ArHasFileName const &)
 Assignment operator.
 
virtual ~ArHasFileName ()
 Destructor.
 
- Public Member Functions inherited from ArMapInfoInterface
 ArMapInfoInterface ()
 Constructor.
 
virtual ~ArMapInfoInterface ()
 Destructor.
 
- Public Member Functions inherited from ArMapObjectsInterface
 ArMapObjectsInterface ()
 Constructor.
 
virtual ~ArMapObjectsInterface ()
 Destructor.
 
- Public Member Functions inherited from ArMapScanInterface
 ArMapScanInterface ()
 Default constructor.
 
virtual ~ArMapScanInterface ()
 Destructor.
 
- Public Member Functions inherited from ArMapSupplementInterface
 ArMapSupplementInterface ()
 Default constructor.
 
virtual ~ArMapSupplementInterface ()
 Destructor.
 

Static Public Member Functions

static std::list< ArArgumentBuilder * >::iterator findMapObjectParamInfo (const char *mapObjectName, std::list< ArArgumentBuilder *> &cairnInfoList)
 Searches the given CairnInfo list for an entry that matches the given mapObject. More...
 
- Static Public Member Functions inherited from ArMapInterface
static std::string createRealFileName (const char *baseDirectory, const char *fileName, bool isIgnoreCase)
 Helper method creates a full file path name from the given components. More...
 
- Static Public Member Functions inherited from ArMapScanInterface
static bool isDefaultScanType (const char *scanType)
 Determines whether the given scan type is the default (i.e. no prefix on the map tags)
 
static bool isSummaryScanType (const char *scanType)
 Determines whether the given scan type represents the summary of all other scan types.
 

Protected Member Functions

bool addScansToParser ()
 Adds all of the map's scan types to the current file parser. More...
 
void addToCallbackList (ArFunctor *functor, ArListPos::Pos position, std::list< ArFunctor *> *cbList)
 
bool createScans (const std::list< std::string > &scanTypeList)
 Sets up the map to contain teh specified scan types. More...
 
ArTime findMaxMapScanTimeChanged ()
 
ArMapScanfindScanWithDataKeyword (const char *myLoadingDataTag, bool *isLineDataTagOut)
 
virtual const char * getMapCategory ()
 
virtual ArMapScangetScan (const char *scanType) const
 Returns the ArMapScan for the specified scan type.
 
bool handleDataIntro (ArArgumentBuilder *arg)
 Callback that handles the different types of data introductions (e.g. DATA, LINES) More...
 
bool handleMapCategory (ArArgumentBuilder *arg)
 Callback that handles the different types of map categories (e.g. 2D-Map, 2D-Map-Ex) More...
 
bool handleRemainder (ArArgumentBuilder *arg)
 
bool handleSources (ArArgumentBuilder *arg)
 Callback that handles the Sources keyword. More...
 
void invokeCallbackList (std::list< ArFunctor *> *cbList)
 
bool isDataTag (const char *line)
 
virtual bool mapInfoContains (const char *arg0Text)
 
void remFromCallbackList (ArFunctor *functor, std::list< ArFunctor *> *cbList)
 
bool remScansFromParser (bool isRemovePointsAndLinesKeywords=true)
 Removes all of the map's scan types from the current file parser.
 
void reset ()
 
void setChildObjects (const std::list< ArMapObject *> *mapObjects, bool isSortedObjects=false, ArMapChangeDetails *changeDetails=NULL)
 
bool setInactiveInfo (const char *infoName, const std::list< ArArgumentBuilder *> *infoList, ArMapChangeDetails *changeDetails=NULL)
 
void setInactiveObjects (const std::list< ArMapObject *> *mapObjects, bool isSortedObjects=false, ArMapChangeDetails *changeDetails=NULL)
 
virtual void updateMapCategory (const char *updatedInfoName=NULL)
 
void updateMapFileInfo (const char *realFileName)
 
void updateSummaryScan ()
 
void writeScanTypesToFunctor (ArFunctor1< const char *> *functor, const char *endOfLineChars)
 

Static Protected Member Functions

static int getNextFileNumber ()
 

Protected Attributes

std::string myBaseDirectory
 
ArMD5CalculatormyChecksumCalculator
 
ArMapObjects *const myChildObjects
 
ArRetFunctor1C< bool, ArMapSimple, ArArgumentBuilder * > myDataIntroCB
 
ArDataTagToScanTypeMap myDataTagToScanTypeMap
 
std::string myFileName
 
bool myIgnoreCase
 
bool myIgnoreEmptyFileName
 
ArMapInfo *const myInactiveInfo
 
ArMapObjects *const myInactiveObjects
 
bool myIsCancelRead
 
bool myIsQuiet
 
bool myIsReadInProgress
 
bool myIsWriteToTempFile
 
bool myLoadingDataStarted
 
std::string myLoadingDataTag
 
bool myLoadingGotMapCategory
 
bool myLoadingLinesAndDataStarted
 
ArFileParsermyLoadingParser
 
ArMapScanmyLoadingScan
 
std::string myMapCategory
 
ArRetFunctor1C< bool, ArMapSimple, ArArgumentBuilder * > myMapCategoryCB
 
std::list< std::string > myMapCategoryList
 
ArMapChangedHelpermyMapChangedHelper
 
ArMapId myMapId
 
ArMapInfo *const myMapInfo
 
std::map< std::string, ArArgumentBuilder *, ArStrCaseCmpOpmyMapObjectNameToParamsMap
 
ArMapObjects *const myMapObjects
 
ArMapSupplement *const myMapSupplement
 
ArMutex myMutex
 
std::list< ArFunctor * > myPostWriteCBList
 
std::list< ArFunctor * > myPreWriteCBList
 
struct stat myReadFileStat
 
std::list< ArArgumentBuilder * > myRemainderList
 List of map file lines that were not recognized.
 
ArRetFunctor1C< bool, ArMapSimple, ArArgumentBuilder * > myRemCB
 
std::list< std::string > myScanTypeList
 
ArRetFunctor1C< bool, ArMapSimple, ArArgumentBuilder * > mySourcesCB
 
ArMapScanmySummaryScan
 
std::string myTempDirectory
 
ArTime myTimeMapInfoChanged
 
ArTime myTimeMapObjectsChanged
 
ArTime myTimeMapScanChanged
 
ArTime myTimeMapSupplementChanged
 
ArTypeToScanMap myTypeToScanMap
 

Static Protected Attributes

static int ourTempFileNumber = 0
 const char *ArMapSimple::ourDefaultInactiveInfoNames[INFO_COUNT] = { "_MapInfo:", "_MetaInfo:", "_TaskInfo:", "_RouteInfo:", "_SchedTaskInfo:", "_SchedInfo:", "_CairnInfo:", "_CustomInfo:" };
 
static ArMutex ourTempFileNumberMutex
 

Additional Inherited Members

- Public Types inherited from ArMapInterface
enum  { MAX_MAP_NAME_LENGTH = 512 }
 
- Public Types inherited from ArMapInfoInterface
enum  { INFO_COUNT = LAST_INFO + 1 }
 
enum  InfoType {
  MAP_INFO, FIRST_INFO = MAP_INFO, META_INFO, TASK_INFO,
  ROUTE_INFO, SCHED_TASK_INFO, SCHED_INFO, CAIRN_INFO,
  CUSTOM_INFO, LAST_INFO = CUSTOM_INFO
}
 List of the standard Info categories defined for Aria maps. More...
 
- Static Public Attributes inherited from ArMapInterface
static const char * MAP_CATEGORY_2D = "2D-Map"
 
static const char * MAP_CATEGORY_2D_COMPOSITE = "2D-Map-Ex3"
 Superset of extended; includes group objects and parent maps.
 
static const char * MAP_CATEGORY_2D_EXTENDED = "2D-Map-Ex2"
 Superset of multi-sources; includes advanced Info types, CairnInfo and CustomInfo.
 
static const char * MAP_CATEGORY_2D_MULTI_SOURCES = "2D-Map-Ex"
 
- Static Public Attributes inherited from ArMapInfoInterface
static const char * CAIRN_INFO_NAME = "CairnInfo:"
 
static const char * CUSTOM_INFO_NAME = "CustomInfo:"
 
static const char * MAP_INFO_NAME = "MapInfo:"
 
static const char * META_INFO_NAME = "MetaInfo:"
 
static const char * ROUTE_INFO_NAME = "RouteInfo:"
 
static const char * SCHED_INFO_NAME = "SchedInfo:"
 
static const char * SCHED_TASK_INFO_NAME = "SchedTaskInfo:"
 
static const char * TASK_INFO_NAME = "TaskInfo:"
 

Detailed Description

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, 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.

Constructor & Destructor Documentation

◆ ArMapSimple()

ArMapSimple::ArMapSimple ( const char *  baseDirectory = "./",
const char *  tempDirectory = NULL,
const char *  overrideMutexName = NULL 
)

Constructor.

Parameters
baseDirectorythe name of the directory in which to search for map files that are not fully qualified
tempDirectorythe 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.
overrideMutexNamean optional name to be used for the map object's mutex; useful for debugging when multiple maps are active

Member Function Documentation

◆ addScansToParser()

bool ArMapSimple::addScansToParser ( )
protected

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.

Returns
bool true if the scans were successfully added to the current file parser

◆ createScans()

bool ArMapSimple::createScans ( const std::list< std::string > &  scanTypeList)
protected

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.

Parameters
scanTypeLista 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
Returns
bool true if the scans were successfully created; false otherwise

◆ findMapObjectParamInfo()

std::list< ArArgumentBuilder * >::iterator ArMapSimple::findMapObjectParamInfo ( const char *  mapObjectName,
std::list< ArArgumentBuilder *> &  cairnInfoList 
)
static

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.

Parameters
mapObjectNamethe ArMapObject for which to find the parameters
cairnInfoListthe list of ArArgumentBuilder *'s that contain the map object parameters (also may be set to the inactive section)
Returns
iterator that points to the parameter information for the map object, or cairnInfoList.end() if not found

◆ getReadFileStat()

struct stat ArMapSimple::getReadFileStat ( ) const
virtual

Java and Python Wrappers: Not available in Java or Python wrapper libraries.

Implements ArMapInterface.

◆ handleDataIntro()

bool ArMapSimple::handleDataIntro ( ArArgumentBuilder arg)
protected

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.

Parameters
arga pointer to the parsed ArArgumentBuilder; no arguments are expected

◆ handleMapCategory()

bool ArMapSimple::handleMapCategory ( ArArgumentBuilder arg)
protected

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.

Parameters
arga pointer to the parsed ArArgumentBuilder; no arguments are expected

◆ handleSources()

bool ArMapSimple::handleSources ( ArArgumentBuilder arg)
protected

Callback that handles the Sources keyword.

Parameters
arga pointer to the parsed ArArgumentBuilder; a list of string scan type arguments are expected

◆ reset()

void ArMapSimple::reset ( void  )
protected

HERE ///

END HERE ////

◆ setMapObjectParams()

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

ArMapObject *obj = myMap->findMapObject(objName); const ArArgumentBuilder *args = myMap->findMapObjectParams(objName);.

bool ok = true; int someNum = 0;

if ((args != NULL) && (args->getArgc() > 0)) {

someNum = args->getArgInt(0, &ok); }

if (ok) {

ArArgumentBuilder newArgs; char buf[128] snprintf(buf, sizeof(buf), "%i", someNum + 1); newArgs.add(buf);

Note that the newArgs will be copied, and that the original args pointer (above) will be invalidated by the following call. myMap->setMapObjectParams(objName, &newArgs); args = NULL; }

mapObjectList.remove(obj); myMap->setMapObjectParams(obj->getName(), NULL); myMap->setMapObjects(mapObjectList); delete obj;

Implements ArMapInterface.


The documentation for this class was generated from the following files: