ufe 5.5
Universal Front End is a DCC-agnostic component that will allow a DCC to browse and edit data in multiple data models
Ufe::PathComponent Class Reference

Constant string representation with fixed space and O(1) comparison. More...

#include <pathComponent.h>

Public Member Functions

 PathComponent (const std::string &aString)
 
 PathComponent ()
 Constructor to create a null PathComponent. More...
 
 ~PathComponent ()
 Destructor. More...
 
 operator bool () const
 
 PathComponent (const PathComponent &)=default
 Member-wise copy is fine. More...
 
PathComponentoperator= (const PathComponent &)
 
bool operator== (const PathComponent &rhs) const
 Equal operator overload. More...
 
bool operator!= (const PathComponent &rhs) const
 Not equal operator overload. More...
 
const std::string & string () const
 Access the underlying shared string, and its ID. A null PathComponent has an empty string and an ID of -1. More...
 
std::int64_t id () const
 Access the underlying shared string, and its ID. A null PathComponent has an empty string and an ID of -1. More...
 

Static Public Member Functions

static bool exists (const std::string &aString)
 
static std::vector< PathComponenttoComponents (const std::vector< std::string > &strings)
 
static std::size_t tableSize ()
 

Private Member Functions

void releaseSharedData ()
 

Private Attributes

std::shared_ptr< Data > fData
 

Detailed Description

Constant string representation with fixed space and O(1) comparison.

This class provides a representation for strings used as path components. Identical strings share a representation, and thus can be stored with low storage cost, and O(1) comparison cost. The shared strings are reference counted, so that when no copies remain, the shared representation is deleted.

Default member-wise copy construction is used.

Definition at line 33 of file pathComponent.h.

Constructor & Destructor Documentation

◆ PathComponent() [1/3]

Ufe::PathComponent::PathComponent ( const std::string &  aString)

Create a PathComponent from a string, adding it to the table if it does not exist.

Parameters
aStringString to create a PathComponent from.

◆ PathComponent() [2/3]

Ufe::PathComponent::PathComponent ( )

Constructor to create a null PathComponent.

◆ ~PathComponent()

Ufe::PathComponent::~PathComponent ( )

Destructor.

◆ PathComponent() [3/3]

Ufe::PathComponent::PathComponent ( const PathComponent )
default

Member-wise copy is fine.

Member Function Documentation

◆ exists()

static bool Ufe::PathComponent::exists ( const std::string &  aString)
static

Static method to verify if the given string exists in the table of strings.

Parameters
aStringString to check if is already in the table of strings.
Returns
True if the string already exists in the table of strings.

◆ id()

std::int64_t Ufe::PathComponent::id ( ) const

Access the underlying shared string, and its ID. A null PathComponent has an empty string and an ID of -1.

Referenced by std::hash< Ufe::PathComponent >::operator()().

Here is the caller graph for this function:

◆ operator bool()

Ufe::PathComponent::operator bool ( ) const
Returns
Whether the PathComponent is null.

◆ operator!=()

bool Ufe::PathComponent::operator!= ( const PathComponent rhs) const

Not equal operator overload.

◆ operator=()

PathComponent & Ufe::PathComponent::operator= ( const PathComponent )

◆ operator==()

bool Ufe::PathComponent::operator== ( const PathComponent rhs) const

Equal operator overload.

◆ releaseSharedData()

void Ufe::PathComponent::releaseSharedData ( )
private

◆ string()

const std::string & Ufe::PathComponent::string ( ) const

Access the underlying shared string, and its ID. A null PathComponent has an empty string and an ID of -1.

◆ tableSize()

static std::size_t Ufe::PathComponent::tableSize ( )
static
Returns
Number of shared strings in the table. Useful for testing and debugging.

◆ toComponents()

static std::vector< PathComponent > Ufe::PathComponent::toComponents ( const std::vector< std::string > &  strings)
static

Convenience static method to turn a vector of strings into a vector of Path Components.

Parameters
stringsA vector of strings.
Returns
A vector of PathComponents.

Member Data Documentation

◆ fData

std::shared_ptr<Data> Ufe::PathComponent::fData
private

Definition at line 86 of file pathComponent.h.


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