omni::graph::core::ogn::string
Defined in omni/graph/core/ogn/string.h
Inheritance Relationships
Base Type
public omni::graph::core::ogn::base_string< char, AttributeDataHandle >
(omni::graph::core::ogn::base_string)
-
class string : public omni::graph::core::ogn::base_string<char, AttributeDataHandle>
std::string_view-like class for string output attribute data in the Ogn Database.
It operates by using the Fabric interface to interact with string data it has stored. This non-const version of the string wrapper should be used for output attributes, whose data will be changed.
Public Types
-
using parent_t = base_string<char, AttributeDataHandle>
Type of the parent class.
-
using ConstBaseDataType = const typename std::remove_const<BaseDataType>::type
const version of the BaseDataType
-
using this_t = base_array<BaseDataType, HandleType>
Type definition of this class.
-
using iterator = typename gsl::span<BaseDataType>::iterator
Iterator over the array contents.
-
using reverse_iterator = typename gsl::span<BaseDataType>::reverse_iterator
Reverse iterator over the array contents.
Public Functions
-
string() = default
Default constructor to start pointing to nothing.
-
inline void resize(size_t newCount)
Set the size of the array data to a new value.
This may or may not relocate memory. If anything is holding a raw pointer from contents() that pointer should be refreshed by calling contents() again when this method returns.
- Parameters
newCount – [in] New element count of the array.
-
inline char *data()
- Returns
Non-const pointer to the raw string data
-
inline char &operator[](size_t index)
Access a specific character in the string.
No bounds checking is performed.
- Parameters
index – [in] Element index into the string
- Returns
Reference to the index’th character of the string
-
inline char &at(size_t index)
Access a specific character in the string.
Bounds checking is performed.
- Parameters
index – [in] Element index into the string
- Returns
Reference to the index’th character of the string
-
inline string &assign(char const *dataToCopy, size_t charCount)
Assignment of a raw sized string to this object, used by all variations.
This will create a duplicate of all string members and reset the references into the Fabric, leaving the context and the handle unchanged.
- Parameters
dataToCopy – [in] The string being copied in
charCount – [in] The number of characters in the string being copied
- Returns
Pointer to this
-
template<typename StringType>
inline string &operator=(StringType &rhs) Generic string assignment operator.
This template handles all compatible string types with a data() and size() method. At minimum ogn::string, ogn::const_string, std::string, const std::string
- Parameters
rhs – [in] The string being copied in
- Returns
Pointer to this
-
inline string &operator=(const char *rhs)
const char* assignment operator (avoids alloc, and disambiguates between std::string and ogn::const_string)
This will create a duplicate of all string members and reset the references into the Fabric, leaving the context and the handle unchanged.
- Parameters
rhs – [in] The string being copied in
- Returns
Pointer to this
-
inline void clear()
Standard method to clear a string, i.e.
assign the empty string to it. Since the null terminator is not needed in fabric the string truly is empty
-
inline size_t length() const
- Returns
The number of elements in the currently managed array
-
inline operator std::string() const
Cast the string data to a std::string.
After you do this the string data is now a copy of the original so you can manipulate it without affecting the original, however it means you must reassign it back to a writable ogn::string if you do want to change the string.
- Returns
String containing a copy of the internal raw string data
-
inline bool operator==(const IterableStringType &rhs) const
See if two strings are equal.
These simple comparison operators avoid extra conversions to std::string, to help minimize allocations
- Template Parameters
IterableStringType – String variant that supports iteration for comparison
- Parameters
rhs – [in] String to compare against - just requires iterability
- Returns
True if the strings have the same contents
-
inline bool operator!=(const IterableStringType &rhs) const
See if two strings are not equal.
These simple comparison operators avoid extra conversions to std::string, to help minimize allocations
- Template Parameters
IterableStringType – String variant that supports iteration for comparison
- Parameters
rhs – [in] String to compare against - just requires iterability
- Returns
True if the strings do not have the same contents
-
inline bool operator<(const IterableStringType &rhs) const
See if this string is lexicographically less than the provided one.
These simple comparison operators avoid extra conversions to std::string, to help minimize allocations
- Template Parameters
IterableStringType – String variant that supports iteration for comparison
- Parameters
rhs – [in] String to compare against - just requires iterability
- Returns
True if this string is lexicographically less than the provided one
-
inline bool operator>(const IterableStringType &rhs) const
See if this string is lexicographically greater than the provided one.
These simple comparison operators avoid extra conversions to std::string, to help minimize allocations
- Template Parameters
IterableStringType – String variant that supports iteration for comparison
- Parameters
rhs – [in] String to compare against - just requires iterability
- Returns
True if this string is lexicographically greater than the provided one
-
inline bool operator<=(const IterableStringType &rhs) const
See if this string is lexicographically less than or equal to the provided one.
These simple comparison operators avoid extra conversions to std::string, to help minimize allocations
- Template Parameters
IterableStringType – String variant that supports iteration for comparison
- Parameters
rhs – [in] String to compare against - just requires iterability
- Returns
True if this string is lexicographically less than or equal to the provided one
-
inline bool operator>=(const IterableStringType &rhs) const
See if this string is lexicographically greater than or equal to the provided one.
These simple comparison operators avoid extra conversions to std::string, to help minimize allocations
- Template Parameters
IterableStringType – String variant that supports iteration for comparison
- Parameters
rhs – [in] String to compare against - just requires iterability
- Returns
True if this string is lexicographically greater than or equal to the provided one
-
inline bool isValid() const
Confirm that the data values are safe for accessing.
- Returns
true if the context and attribute handle values are both valid
-
inline size_t size() const
- Returns
The number of elements in the currently managed array
-
inline bool empty() const
- Returns
Is the currently managed array empty?
-
inline ConstBaseDataType *data() const
- Returns
Pointer to the raw data in the array (first element)
-
inline const reverse_iterator rbegin() const
- Returns
Iterator pointing to the end of the array
-
inline const reverse_iterator rend() const
- Returns
Iterator pointing before the beginning of the array
-
inline ConstBaseDataType &operator[](size_t index) const
Access a specific element of the array.
No bounds checking is performed.
- Parameters
index – [in] Element index into the array
- Returns
Reference to the index’th element of the array
-
inline ConstBaseDataType &at(size_t index) const
Access a specific element of the array with bounds checking.
- Parameters
index – [in] Element index into the array
- Throws
std::out_of_range – if there is no data for the given index
- Returns
Reference to the index’th element of the array
-
inline gsl::span<BaseDataType> const &span() const
Access the underlying span that allows to access the array data.
- Returns
A reference to the underlying span
-
inline GraphContextObj const *context() const
Access the context to which this array belongs.
- Returns
Pointer to the context to which this array belongs
-
inline HandleType const &handle() const
Access the attribute handle used to access the array data in Fabric.
- Returns
Pointer to the attribute handle used to access the array data in Fabric
-
inline void setDirty() const
Flag the span data as not being up2Date.
-
inline void adjustHandle(size_t idx)
In a vectorized context, move forward the current handle.
- Parameters
idx – [in] The amount of instance(s) to offset the current handle
Protected Functions
-
inline void reset()
Reset the internal span to point to new data.
-
inline BaseDataType **getData(const IAttributeData &iData, ConstAttributeDataHandle const &hdl)
Get a pointer to the array data from a specific const data handle.
- Parameters
iData – Interface class containing the accessor functions
hdl – Handle to the attribute data whose value is being retrieved
- Returns
BaseDataType** Pointer to the array of retrieved data
-
inline BaseDataType **getData(const IAttributeData &iData, AttributeDataHandle const &hdl)
Get a pointer to the array data from a specific mutable data handle.
- Parameters
iData – Interface class containing the accessor functions
hdl – Handle to the attribute data whose value is being retrieved
- Returns
BaseDataType** Pointer to the array of retrieved data
-
inline void setContext(const GraphContextObj &context)
Set the context.
This is done to allow the same wrapper class to be used for multiple evaluations in different contexts.
- Parameters
context – [in] The graph context to which the array belongs
-
inline void setHandle(HandleType handle)
Set the attribute handle.
This is done to allow the same wrapper class to be used for multiple evaluations in different contexts.
- Parameters
handle – [in] Handle to the attribute to which the array belongs
-
using parent_t = base_string<char, AttributeDataHandle>