Mapper  0.9.0
API documentation
Classes | Public Types | Public Member Functions | List of all members
OcdEntityIndex< F, T > Class Template Reference

A template class for dealing with OCD entity indices. More...

#include <ocd_types.h>

Classes

struct  value_type
 

Public Types

using FileFormat = F
 The actual file format version type, reexported. More...
 
using EntityType = T
 The actual entity type. More...
 
using EntryType = typename T::IndexEntryType
 The index entry type for the entity type. More...
 
using IndexBlock = Ocd::IndexBlock< EntryType >
 The index block type. More...
 
using const_iterator = OcdEntityIndexIterator< value_type >
 The index iterator type. More...
 

Public Member Functions

 OcdEntityIndex (OcdFile< F > &file) noexcept
 Constructs an entity index object. More...
 
 OcdEntityIndex (const OcdEntityIndex &)=delete
 
OcdEntityIndexoperator= (const OcdEntityIndex &)=delete
 
 ~OcdEntityIndex ()=default
 Destroys the object. More...
 
const_iterator begin () const
 Returns a forward iterator to the beginning of the index. More...
 
const_iterator end () const noexcept
 Returns a forward iterator to the end. More...
 
EntryTypeinsert (const QByteArray &entity_data, const EntryType &entry)
 Inserts an object with the given entry prototype. More...
 
EntryTypeinsert (const QByteArray &entity_data)
 Inserts a symbol. More...
 
EntryTypeinsert (qint32 string_type, const QByteArray &string_data)
 Inserts a parameter string with the given type number. More...
 

Detailed Description

template<class F, class T>
class OcdEntityIndex< F, T >

A template class for dealing with OCD entity indices.

Instances of this data do not actually copy any data, but rather provide an STL container like interface for raw data. The interfaces allows for forward iterating over the index for the given entity type.

Parameters
Fthe type defining the file format version type
Tthe entity type (string, symbol, object)

Member Typedef Documentation

◆ const_iterator

template<class F, class T>
using OcdEntityIndex< F, T >::const_iterator = OcdEntityIndexIterator<value_type>

The index iterator type.

◆ EntityType

template<class F, class T>
using OcdEntityIndex< F, T >::EntityType = T

The actual entity type.

◆ EntryType

template<class F, class T>
using OcdEntityIndex< F, T >::EntryType = typename T::IndexEntryType

The index entry type for the entity type.

◆ FileFormat

template<class F, class T>
using OcdEntityIndex< F, T >::FileFormat = F

The actual file format version type, reexported.

◆ IndexBlock

template<class F, class T>
using OcdEntityIndex< F, T >::IndexBlock = Ocd::IndexBlock<EntryType>

The index block type.

Constructor & Destructor Documentation

◆ OcdEntityIndex() [1/2]

template<class F, class T >
OcdEntityIndex< F, T >::OcdEntityIndex ( OcdFile< F > &  file)
noexcept

Constructs an entity index object.

◆ OcdEntityIndex() [2/2]

template<class F, class T>
OcdEntityIndex< F, T >::OcdEntityIndex ( const OcdEntityIndex< F, T > &  )
delete

◆ ~OcdEntityIndex()

template<class F, class T>
OcdEntityIndex< F, T >::~OcdEntityIndex ( )
default

Destroys the object.

Member Function Documentation

◆ begin()

template<class F , class T >
OcdEntityIndex< F, T >::const_iterator OcdEntityIndex< F, T >::begin ( ) const

Returns a forward iterator to the beginning of the index.

◆ end()

template<class F , class T >
OcdEntityIndex< F, T >::const_iterator OcdEntityIndex< F, T >::end ( ) const
noexcept

Returns a forward iterator to the end.

◆ insert() [1/3]

template<class F , class T >
OcdEntityIndex< F, T >::EntryType & OcdEntityIndex< F, T >::insert ( const QByteArray entity_data,
const EntryType entry 
)

Inserts an object with the given entry prototype.

In order to update the create index entry after insertion, pay attention to capture the result as reference, not as copy:

auto& object_entry = object_index.insert(ocd_object, prototype);
Todo:
Throw exception

◆ insert() [2/3]

template<class F , class T >
OcdEntityIndex< F, T >::EntryType & OcdEntityIndex< F, T >::insert ( const QByteArray entity_data)

Inserts a symbol.

◆ insert() [3/3]

template<class F , class T >
OcdEntityIndex< F, T >::EntryType & OcdEntityIndex< F, T >::insert ( qint32  string_type,
const QByteArray string_data 
)

Inserts a parameter string with the given type number.

The string_data is expected to have the trailing '\0' maintained by QByteArray at size(), i.e. it must not be constructed using QByteArray::fromRawData().

◆ operator=()

template<class F, class T>
OcdEntityIndex& OcdEntityIndex< F, T >::operator= ( const OcdEntityIndex< F, T > &  )
delete

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