Regina Calculation Engine
Public Types | Public Member Functions | List of all members
regina::XMLTreeResolver Class Reference

Provides a mechanism to resolve dangling packet references after a complete packet tree has been read from an XML data file. More...

#include <packet/xmltreeresolver.h>

Public Types

typedef std::map< std::string, Packet * > IDMap
 A type that maps internal IDs from the data file to the corresponding packets. More...
 

Public Member Functions

 XMLTreeResolver ()
 Constructs a resolver with no tasks queued. More...
 
 ~XMLTreeResolver ()
 Destroys any tasks that were queued but not performed. More...
 
void queueTask (XMLTreeResolutionTask *task)
 Queues a task for processing. More...
 
void storeID (const std::string &id, Packet *packet)
 Stores the fact that the given packet is stored in the data file using the given internal ID. More...
 
const IDMapids () const
 Returns the map from internal IDs to packets, as stored in the data file. More...
 
void resolve ()
 Calls XMLTreeResolutionTask::resolve() for all queued tasks. More...
 
 XMLTreeResolver (const XMLTreeResolver &)=delete
 
XMLTreeResolveroperator= (const XMLTreeResolver &)=delete
 

Detailed Description

Provides a mechanism to resolve dangling packet references after a complete packet tree has been read from an XML data file.

There are situations in which, when reading an XML data file, the data stored in an individual packet cannot be fully constructed until after the entire data file has been read. For instance, a packet might need to store pointers or references to other packets that could appear later in the packet tree (e.g., a script storing pointers to its variables).

This problem is solved by the XMLTreeResolver class. The complete process of reading an XML data file works as follows:

Each task should be an instance of a subclass of XMLTreeResolutionTask, whose virtual resolve() function is overridden to perform whatever "fleshing out" work is required for the type of packet under consideration.


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

Copyright © 1999-2020, The Regina development team
This software is released under the GNU General Public License, with some additional permissions; see the source code for details.
For further information, or to submit a bug or other problem, please contact Ben Burton (bab@maths.uq.edu.au).