Regina Calculation Engine
Public Types | Public Member Functions | Protected Member Functions | List of all members
regina::ListOnCall< T > Class Template Referenceabstract

Offers a hard-coded list of expensive objects that should only be created if they are required. More...

#include <utilities/listoncall.h>

Public Types

typedef std::list< const T * >::const_iterator iterator
 An iterator over this list. More...
 

Public Member Functions

 ListOnCall ()
 Creates a new list structure. More...
 
virtual ~ListOnCall ()
 Destroys this list and all of the items it contains. More...
 
iterator begin () const
 Returns an iterator pointing to the first item in this list. More...
 
iterator end () const
 Returns an iterator pointing past the end of this list (i.e., just after the last item). More...
 
 ListOnCall (const ListOnCall &)=delete
 
ListOnCalloperator= (const ListOnCall &)=delete
 

Protected Member Functions

void insert (T *item)
 Adds the given item to the end of this list. More...
 
virtual void initialise ()=0
 Fills this list with items. More...
 

Detailed Description

template<typename T>
class regina::ListOnCall< T >

Offers a hard-coded list of expensive objects that should only be created if they are required.

An example might include a large hard-coded list of triangulations (which are expensive to construct) that will only be required in special scenarios, and not in everyday use of the software.

A particular hard-coded list should be defined by a subclass of ListOnCall. The list should be filled within the pure virtual routine initialise(), which must be overridden.

A static list of this type is relatively cheap to create. The list will not actually be filled (and the expensive objects will not be created) until the first time the list is traversed. Specifically, the list will be filled on the first call to begin().

Only an extremely simple form of list traversal is offered: Routines begin() and end() are defined, which return forward iterators that can be used to run through the list contents.

Lists of this type are designed to be constant. Aside from the initial list population in the initialise() routine and the final list destruction (in which all of the stored objects will also be destroyed), the list and its objects should never be changed. Because of this, the iterator type returns only constant pointers to list objects.

Note that T is the expensive object type, not a pointer type to such an object.

Python
Not present.

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

Copyright © 1999-2021, 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).