GTIRB  v2.1.0
GrammaTech Intermediate Representation for Binaries: C++ API
Classes | Namespaces | Typedefs | Functions
AuxDataContainer.hpp File Reference

Class gtirb::AuxDataContainer. More...

#include <gtirb/AuxData.hpp>
#include <gtirb/Node.hpp>
#include <boost/iterator/transform_iterator.hpp>
#include <boost/range/iterator_range.hpp>
#include <type_traits>
Include dependency graph for AuxDataContainer.hpp:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  gtirb::AuxDataContainer
 Contains the AuxData Tables and serves as a base class. More...
 
struct  AuxDataRaw
 An interface for accessing the serialized form of an AuxData instance. More...
 
struct  gtirb::AuxDataContainer::AuxDataRaw
 An interface for accessing the serialized form of an AuxData instance. More...
 

Namespaces

 gtirb
 Main namespace for the GTIRB API.
 

Typedefs

using AuxDataSet = std::map< std::string, std::unique_ptr< gtirb::AuxData > >
 

Functions

gtirb::AuxDataContainer Node gtirb::AuxDataContainer (Context &C, Kind knd)
 
 gtirb::AuxDataContainer (Context &C, Kind knd, const UUID &U)
 

AuxData Properties

template<typename Schema >
void addAuxData (typename Schema::Type &&X)
 Add a new AuxData, transferring ownership. More...
 
const_aux_data_range aux_data () const
 Return a constant range of the auxiliary data (AuxData). More...
 
const_aux_data_iterator aux_data_begin () const
 Return a constant iterator to the first AuxData. More...
 
const_aux_data_iterator aux_data_end () const
 Return a constant iterator to the element following the last AuxData. More...
 
void clearAuxData ()
 Clear all AuxData from the IR. More...
 
using const_aux_data_iterator = boost::transform_iterator< AccessRawData, AuxDataSet::const_iterator >
 An iterator type for traversing the AuxData in this container. More...
 
using const_aux_data_range = boost::iterator_range< const_aux_data_iterator >
 
template<typename Schema >
Schema::Type * getAuxData ()
 Get a reference to the underlying type stored in the AuxData by name. More...
 
template<typename Schema >
const Schema::Type * getAuxData () const
 Get a reference to the underlying type stored in the AuxData by name. More...
 
bool getAuxDataEmpty () const
 Check: Is the number of AuxData objects in this IR zero? More...
 
size_t getAuxDataSize () const
 Get the total number of AuxData objects in this IR. More...
 
template<typename Schema >
bool removeAuxData ()
 Remove an AuxData by schema. More...
 
bool removeAuxData (std::string Name)
 Remove an AuxData by name. More...
 

Detailed Description

Class gtirb::AuxDataContainer.

Typedef Documentation

◆ AuxDataSet

using AuxDataSet = std::map<std::string, std::unique_ptr<gtirb::AuxData> >

◆ const_aux_data_iterator

using const_aux_data_iterator = boost::transform_iterator<AccessRawData, AuxDataSet::const_iterator>

An iterator type for traversing the AuxData in this container.

The value type for this iterator is AuxDataRaw. The iterator provides access to the serialized form of all AuxData in this container (regardless of whether or not the AuxData's type is registered.) Note that the content is only valid with respect to the most recent unserialization operation. Entries for new or modified AuxData entities will contain empty or stale content.

◆ const_aux_data_range

using const_aux_data_range = boost::iterator_range<const_aux_data_iterator>

Function Documentation

◆ addAuxData()

template<typename Schema >
void AuxDataContainer::addAuxData ( typename Schema::Type &&  X)

Add a new AuxData, transferring ownership.

Parameters
XThe data itself.
Returns
void

◆ aux_data()

const_aux_data_range AuxDataContainer::aux_data ( ) const

Return a constant range of the auxiliary data (AuxData).

◆ aux_data_begin()

const_aux_data_iterator AuxDataContainer::aux_data_begin ( ) const

Return a constant iterator to the first AuxData.

◆ aux_data_end()

const_aux_data_iterator AuxDataContainer::aux_data_end ( ) const

Return a constant iterator to the element following the last AuxData.

◆ clearAuxData()

void AuxDataContainer::clearAuxData ( )

Clear all AuxData from the IR.

Returns
void

◆ getAuxData() [1/2]

template<typename Schema >
Schema::Type* AuxDataContainer::getAuxData ( )

Get a reference to the underlying type stored in the AuxData by name.

Returns
A non-owning pointer to the data if found, nullptr otherwise.

Note that this function can only be used for AuxData for which a type has been registered with registerAuxDataType().

◆ getAuxData() [2/2]

template<typename Schema >
const Schema::Type* AuxDataContainer::getAuxData ( ) const

Get a reference to the underlying type stored in the AuxData by name.

Returns
A non-owning pointer to the data if found, nullptr otherwise.

Note that this function can only be used for AuxData for which a type has been registered with registerAuxDataType().

◆ getAuxDataEmpty()

bool AuxDataContainer::getAuxDataEmpty ( ) const

Check: Is the number of AuxData objects in this IR zero?

Returns
true if this IR does not contain any AuxData, otherwise false

◆ getAuxDataSize()

size_t AuxDataContainer::getAuxDataSize ( ) const

Get the total number of AuxData objects in this IR.

Returns
The total number of AuxData objects.

◆ removeAuxData() [1/2]

template<typename Schema >
bool AuxDataContainer::removeAuxData ( )

Remove an AuxData by schema.

This will invalidate any pointers that may have been held externally.

Returns
true on success, false otherwise.

Note that this function can only be used for AuxData for which a type has been registered with registerAuxDataType().

◆ removeAuxData() [2/2]

bool AuxDataContainer::removeAuxData ( std::string  Name)

Remove an AuxData by name.

This will invalidate any pointers that may have been held externally.

Returns
true on success, false otherwise.

Note that this function can be used for any AuxData regardless of whether or not it has a registered schema.