#include <ArMapInterface.h>
Inheritance diagram for ArMapInterface:
The methods in ArMapInterface can be broadly categorized as follows:
TODO:
Public Types | |
enum | { MAX_MAP_NAME_LENGTH = 512 } |
Public Member Functions | |
virtual void | addMapChangedCB (ArFunctor *functor, ArListPos::Pos position=ArListPos::LAST)=0 |
Adds a callback that is invoked when the map has been changed. | |
virtual void | addPostWriteFileCB (ArFunctor *functor, ArListPos::Pos position=ArListPos::LAST)=0 |
Adds a callback to be invoked after the map file is written. | |
virtual void | addPreMapChangedCB (ArFunctor *functor, ArListPos::Pos position=ArListPos::LAST)=0 |
Adds a callback called before the map changed callbacks are called. | |
virtual void | addPreWriteFileCB (ArFunctor *functor, ArListPos::Pos position=ArListPos::LAST)=0 |
Adds a callback to be invoked before the map file is written. | |
ArMapInterface () | |
Constructor. | |
virtual bool | calculateChecksum (unsigned char *md5DigestBuffer, size_t md5DigestBufferLen)=0 |
Calculates the checksum of the map. | |
virtual void | clear ()=0 |
Clears the map, removing all info, objects and data points and lines. | |
virtual ArMapInterface * | clone ()=0 |
Creates a new map that is "equivalent" to this map. | |
virtual std::string | createRealFileName (const char *fileName)=0 |
Prepends the appropriate directory information on the given filename. | |
virtual ArArgumentBuilder * | findMapObjectParams (const char *mapObjectName)=0 |
Returns the optional parameters associated with a map object, or NULL if none. | |
virtual const char * | getBaseDirectory (void) const =0 |
Gets the base directory. | |
virtual const char * | getFileName (void) const =0 |
Gets the fileName that was loaded. | |
virtual bool | getIgnoreCase (void)=0 |
Gets whether we ignore case or not. | |
virtual bool | getIgnoreEmptyFileName (void)=0 |
Gets whether we ignore empty file names or fail if we encounter one. | |
virtual ArMapInfoInterface * | getInactiveInfo ()=0 |
Provides direct access to the inactive map info. | |
virtual ArMapObjectsInterface * | getInactiveObjects ()=0 |
Provides direct access to the inactive map objects. | |
virtual ArLog::LogLevel | getMapChangedLogLevel (void)=0 |
Returns the level at which information about the map changed callbacks is logged. | |
virtual bool | getMapId (ArMapId *mapIdOut, bool isInternalCall=false)=0 |
Retrieves the map ID. | |
virtual struct stat | getReadFileStat () const =0 |
Returns information about the map file that was read. | |
virtual std::list< ArArgumentBuilder * > * | getRemainder ()=0 |
Returns a list of the map file lines that were not recognized. | |
virtual std::list< std::string > | getScanTypes () const =0 |
Returns a list of the scan types that are defined for this map. | |
virtual const char * | getTempDirectory (void) const =0 |
Gets the temp directory. | |
virtual bool | isLoadingDataStarted ()=0 |
virtual bool | isLoadingLinesAndDataStarted ()=0 |
virtual int | lock ()=0 |
Lock the map instance. | |
virtual void | mapChanged (void)=0 |
Function that will call the map changed CBs if needed. | |
virtual bool | parseLine (char *line)=0 |
Parses a map line. | |
virtual void | parsingComplete (void)=0 |
Says that the parsing by lines is done and to use the parsed data. | |
virtual bool | readFile (const char *fileName, char *errorBuffer=NULL, size_t errorBufferLen=0, unsigned char *md5DigestBuffer=NULL, size_t md5DigestBufferLen=0)=0 |
Reads the map from the specified file. | |
virtual bool | refresh ()=0 |
Determines whether the map file needs to be re-read. | |
virtual void | remMapChangedCB (ArFunctor *functor)=0 |
Removes a callback called when the map has been changed. | |
virtual void | remPostWriteFileCB (ArFunctor *functor)=0 |
Removes the given callback from the list of post-write callbacks. | |
virtual void | remPreMapChangedCB (ArFunctor *functor)=0 |
Removes the specified "pre-map-changed callback". | |
virtual void | remPreWriteFileCB (ArFunctor *functor)=0 |
Removes the given callback from the list of pre-write callbacks. | |
virtual bool | set (ArMapInterface *other)=0 |
Sets this map to be "equivalent" to the given other map. | |
virtual void | setBaseDirectory (const char *baseDirectory)=0 |
Sets the base directory. | |
virtual void | setIgnoreCase (bool ignoreCase=false)=0 |
Sets whether we ignore case or not. | |
virtual void | setIgnoreEmptyFileName (bool ignore)=0 |
Sets whether we ignore empty file names or fail if we encounter one. | |
virtual void | setMapChangedLogLevel (ArLog::LogLevel level)=0 |
Sets the level at which to log information about the map changed callbacks. | |
virtual bool | setMapObjectParams (const char *mapObjectName, ArArgumentBuilder *params, ArMapChangeDetails *changeDetails=NULL)=0 |
Sets the optional parameters associated with a map object. | |
virtual void | setQuiet (bool isQuiet)=0 |
Turn on this flag to reduce the number of verbose log messages. | |
virtual bool | setScanTypes (const std::list< std::string > &scanTypeList)=0 |
Sets the scan types that are defined for this map. | |
virtual void | setSourceFileName (const char *sourceName, const char *fileName, bool isInternalCall=false)=0 |
Sets the name of the source and the file from which the map was loaded. | |
virtual void | setTempDirectory (const char *tempDirectory)=0 |
Sets the temp directory. | |
virtual int | tryLock ()=0 |
Try to lock the map instance without blocking. | |
virtual int | unlock ()=0 |
Unlock the map instance. | |
virtual bool | writeFile (const char *fileName, bool internalCall=false, unsigned char *md5DigestBuffer=NULL, size_t md5DigestBufferLen=0, time_t fileTimestamp=-1)=0 |
Writes the map to the specified file. | |
virtual void | writeObjectsToFunctor (ArFunctor1< const char * > *functor, const char *endOfLineChars, bool isOverrideAsSingleScan=false, const char *maxCategory=NULL)=0 |
Writes the map header information and objects to a text-based functor. | |
virtual void | writeToFunctor (ArFunctor1< const char * > *functor, const char *endOfLineChars)=0 |
Writes all of the map to the given text-based functor. | |
virtual | ~ArMapInterface (void) |
Destructor. | |
Static Public Member Functions | |
static std::string | createRealFileName (const char *baseDirectory, const char *fileName, bool isIgnoreCase) |
Helper method creates a full file path name from the given components. | |
Static Public Attributes | |
static const char * | MAP_CATEGORY_2D = "2D-Map" |
static const char * | MAP_CATEGORY_2D_EXTENDED = "2D-Map-Ex2" |
Superset of multi-sources; includes advanced Info types. | |
static const char * | MAP_CATEGORY_2D_MULTI_SOURCES = "2D-Map-Ex" |
|
|
|
Adds a callback that is invoked when the map has been changed. The given functor should assume that the map has been lock()-ed when it is invoked. It should also not attempt to make changes to the mapChanged() callback list during the invoke method. This method is not thread-safe.
|
|
Adds a callback to be invoked after the map file is written.
|
|
Adds a callback called before the map changed callbacks are called. The "pre-map-changed callbacks" are invoked *after* the map has been changed, but before the other "map-changed callbacks" are invoked. This method is not thread-safe.
|
|
Adds a callback to be invoked before the map file is written.
|
|
Calculates the checksum of the map.
|
|
Creates a new map that is "equivalent" to this map. Creates a new map that is effectively a copy of this map. Note, however, that the returned map may not be of exactly the same class (so the term "clone" is being used somewhat loosely). In particular, if the active ArMap that is associated with the robot configuration is cloned, then the resulting map will be simpler and not associated with the robot configuration.
|
|
Helper method creates a full file path name from the given components. Determines what system file path to use based on the contents of baseDirectory, fileName and isIgnoreCase. If fileName is not an absolute path and baseDirectory is not null and not empty, then it is combined with baseDirectory to form a full path. An absolute path starts with the '/' or '\' character, or on Windows, with "X:\" where X is any upper or lower case alphabetic character A-Z or a-z. |
|
Returns the optional parameters associated with a map object, or NULL if none. The Aria map provides an advanced feature that allows a parameter list to be defined for custom map object types. (Refer to the ArMap MapFileFormat for more information.) This convenience method provides access to the parameter values for a specified map object. It is basically a shortcut for searching and parsing the CairnInfo argument list. Unlike the CairnInfo arguments (which also include an introduction and map object name), the argument builder returned by this method only contains the parameter values. Also note that if the argument builder contains string parameters, then they may be surrounded by quotes. The returned pointer should not be stored, modified, or deleted. See setMapObjectParams for important information about changing the parameter values or the associated map object. This method is not thread-safe. (The call and use of the returned ArArgumentBuilder should be surrounded by calls to lock()/unlock().)
|
|
Gets whether we ignore case or not. This method is primarily applicable to the active Aria map that is associated with the robot configuration. |
|
Gets whether we ignore empty file names or fail if we encounter one. This method is primarily applicable to the active Aria map that is associated with the robot configuration. |
|
Provides direct access to the inactive map info. The "inactive" info is a section of the Aria map that applications may use to store "_XInfo:" lines that are not currently active or applicable. The inactive info will be written to the map file, but it will not be included in any of the inherited ArMapInfoInterface calls (e.g. getInfo(type)). This is primarily intended for advanced specialized use where something needs to be removed from the map file, but it may be necessary to restore it later. This method is not thread-safe.
|
|
Provides direct access to the inactive map objects. The "inactive" objects is a section of the Aria map that applications may use to store "_Cairn" lines that are not currently active or applicable. The inactive objects will be written to the map file, but they will not be included in any of the inherited ArMapObjectsInterface calls (e.g. getMapObjects()). This is primarily intended for advanced specialized use where an object needs to be removed from the map file, but it may be necessary to restore it later. This method is not thread-safe.
|
|
Retrieves the map ID. The map ID is a unique identifier based on the map file name and the checksum data. (Perhaps more accurately, it is highly likely to be unique during normal usage.)
|
|
Returns information about the map file that was read. Java and Python Wrappers: Not available in Java or Python wrapper libraries. Implemented in ArMap, and ArMapSimple. |
|
Returns a list of the map file lines that were not recognized. Ideally, the returned list should be empty. The remainder list is primarily used to determine whether the editor is up-to-date for the current map version and to try to minimize lost data. Note that this method returns a pointer to the actual list that is stored in the map object. It is not safe to store this pointer. This method is not thread-safe. |
|
Returns a list of the scan types that are defined for this map. This method is not thread-safe.
|
|
This value returns true once the first DATA tag has been reached. The rest of the map contains data points. |
|
This value returns true once the first LINES tag has been reached. The rest of the map contains data lines and points. |
|
Function that will call the map changed CBs if needed. Users of Aria maps should invoke this method after making any changes to the map. It causes the installed map changed handlers to be invoked. This method is not thread-safe. It should be surrounded by calls to lock() and unlock(). For example:
Note that this method is automatically invoked under some circumstances (such as when the map file is re-read following a change to the robot configuration). Also note that this method will not invoke any callbacks if the map has not been modified via an explicit call to a set method.
|
|
Parses a map line. Public for ArQMapProducer |
|
Reads the map from the specified file. If the file is successfully read into the map, then this method calls mapChanged() afterwards to invoke the installed callbacks. This method automatically calls lock() and unlock() during operation. Do not call this method if the map is already locked.
Implemented in ArMap. |
|
Determines whether the map file needs to be re-read. This method is primarily applicable to the active Aria map that is associated with the robot configuration. It checks to see if the map file has been modified since it was read, and re-reads it if necessary. The method may do nothing for "simpler" maps. |
|
Removes a callback called when the map has been changed. This method is not thread-safe.
|
|
Removes the given callback from the list of post-write callbacks.
|
|
Removes the specified "pre-map-changed callback". This method is not thread-safe.
|
|
Removes the given callback from the list of pre-write callbacks.
|
|
Sets this map to be "equivalent" to the given other map. Modifies this map so that is effectively a copy of the given map. All info, objects, and data points and lines in the other map are copied and stored in this map.
|
|
Sets whether we ignore case or not. This method is primarily applicable to the active Aria map that is associated with the robot configuration. |
|
Sets whether we ignore empty file names or fail if we encounter one. This method is primarily applicable to the active Aria map that is associated with the robot configuration. |
|
Sets the optional parameters associated with a map object. This method sets the parameter values for the specified map object. It should be used only for custom map object types that have a parameter list defined in the MapInfo. (Refer to the ArMap MapFileFormat for more information.) Like findMapObjectParams(), this is basically a convenience method that simplifies access to the data stored in the CairnInfo argument list. If the given params is non-NULL, then it is copied and stored in the map. (Note that this deletes the pointer previously returned by findMapObjectParams(mapObjectName). Do not store that pointer.) It is entirely the caller's responsibility to ensure that the params arg count and types are correct. If the given params is NULL, then the parameter information for the map object is cleared. If a mapObjectWithParams is to be deleted, then setMapObjectParams(mapObjectWithParams->getName(), NULL) must be called first.
Implemented in ArMapSimple. |
|
Sets the scan types that are defined for this map. This method clears all of the exisiting scans (i.e. point and line data). This method is not thread-safe.
|
|
Sets the name of the source and the file from which the map was loaded. This method is primarily used to track when a map has been received from the central server or another robot. The source and file name can be retrieved from the map ID.
|
|
Writes the map to the specified file. By default, this method automatically calls lock() and unlock() during its operation. If the map is already locked when the file needs to be written, then set the internalCall parameter to true to override the default locking behavior
Implemented in ArMap. |
|
Writes the map header information and objects to a text-based functor. This method writes all of the map scan headers, the info arguments, and the Cairn map objects to the given functor. It does not write the actual scan point or line segment data (nor the header lines that introduce the data). This method is not thread-safe.
|
|
Writes all of the map to the given text-based functor. This method is not thread-safe
|