|
| ExpectData () |
| Default constructor. More...
|
|
| ExpectData (const ExpectData &_other) |
| Copy constructor. The copy constructor of the base class, CompositeData, is called before this copy constructor and it does the actual copying of the data contained in the MapData object of _other . Thus, this copy constructor simply calls the default constructor to initialize the MapData iterator of this object to point the appropriate iterator in the newly copied MapData. More...
|
|
virtual | ~ExpectData ()=default |
| Virtual destructor. More...
|
|
template<typename Data > |
Data & | Get () |
| Provides extremely high-speed access to expected data types and normal access to unexpected data types. More...
|
|
template<typename Data > |
bool | Has () const |
| Provides extremely high-speed access for checking the existence of expected data types and normal access for unexpected data types. More...
|
|
template<typename Data , typename... Args> |
InsertResult< Data > | Insert (Args &&... _args) |
| Provides extremely high-speed access to getting or creating expected data types and normal access to unexpected data types. More...
|
|
template<typename Data , typename... Args> |
InsertResult< Data > | InsertOrAssign (Args &&... _args) |
| Provides extremely high-speed access to creating expected data types and normal access to unexpected data types. More...
|
|
template<typename Data , typename... Args> |
Data & | MakeRequired (Args &&... _args) |
| Provides extremely high-speed access for making expected data types required and normal access for unexpected data types. More...
|
|
ExpectData & | operator= (const ExpectData &_other)=default |
| Copy assignment operator. More...
|
|
template<typename Data > |
Data * | Query (const QueryMode _mode=QueryMode::NORMAL) |
| Provides extremely high-speed access for querying expected data types and normal access for unexpected data types. More...
|
|
template<typename Data > |
const Data * | Query (const QueryMode _mode=QueryMode::NORMAL) const |
| Const-qualified version of Query<Data> More...
|
|
template<typename Data > |
bool | Remove () |
| Provides extremely high-speed access for removing expected data types and normal access for unexpected data types. More...
|
|
template<typename Data > |
bool | Requires () const |
| Provides extremely high-speed access for checking whether expected data types are required and normal access for unexpected data types. More...
|
|
template<typename Data > |
DataStatus | StatusOf () const |
| Provides extremely high-speed access to the status of expected data types and normal access for unexpected data types. More...
|
|
template<typename Data > |
bool | Unquery () const |
| Provides extremely high-speed access for unquerying expected data types and normal access for unexpected data types. More...
|
|
| CompositeData () |
| Default constructor. Creates an empty CompositeData object. More...
|
|
| CompositeData (CompositeData &&_other) |
| Move constructor. Same as Copy(_other). More...
|
|
| CompositeData (const CompositeData &_other) |
| Copy constructor. Same as Copy(_other). More...
|
|
virtual | ~CompositeData ()=default |
| Virtual destructor. More...
|
|
std::set< std::string > | AllEntries () const |
| Get an ordered set of all data entries in this CompositeData. Runs with O(N) complexity. More...
|
|
CompositeData & | Copy (CompositeData &&_other, const bool _mergeRequirements=false) |
| An alternative to Copy(const CompositeData &, bool) that takes advantage of move semantics. More...
|
|
CompositeData & | Copy (const CompositeData &_other, const bool _mergeRequirements=false) |
| Make this CompositeData a copy of _other. However, any data entries in this CompositeData which are marked as required will not be removed. More...
|
|
std::size_t | EntryCount () const |
| Check how many data entries are in this CompositeData. Runs with O(1) complexity. More...
|
|
template<typename Data > |
Data & | Get () |
| Get a reference to a Data object. If an object of the Data type does not already exist in this CompositeData, then create one using its default constructor. This function will fail to compile if a default constructor is not available for the Data type. More...
|
|
template<typename Data > |
bool | Has () const |
| Returns true if this CompositeData has an object of type Data, otherwise returns false. This is literally equivalent to (nullptr != Query<Data>(QueryMode::SILENT)). More...
|
|
template<typename Data , typename... Args> |
InsertResult< Data > | Insert (Args &&..._args) |
| This will attempt to insert a new Data entry into the CompositeData object, forwarding _args to the constructor of the entry. If an entry already exists for this Data type, then nothing will be inserted. More...
|
|
template<typename Data , typename... Args> |
InsertResult< Data > | InsertOrAssign (Args &&... _args) |
| Attempt to insert a Data-type entry. If a Data-type entry did not already exist, it will be constructed by copying (or moving) the given arguments. If a Data-type entry already existed, the existing entry will be assigned the value of Data(_args...). More...
|
|
template<typename Data , typename... Args> |
Data & | MakeRequired (Args &&..._args) |
| Marks the specified type of Data as required, creates one with the given arguments if it did not exist, and returns a reference to it. More...
|
|
CompositeData & | Merge (CompositeData &&_other, const bool _mergeRequirements=false) |
| An alternative to Merge(const CompositeData &, bool) that takes advantage of move semantics. More...
|
|
CompositeData & | Merge (const CompositeData &_other, const bool _mergeRequirements=false) |
| Merge the data from _other into this CompositeData. If there are any conflicting data entries, the entry from _other will take precedence. More...
|
|
CompositeData & | operator= (CompositeData &&_other) |
| Move operator. Same as Copy(_other). More...
|
|
CompositeData & | operator= (const CompositeData &_other) |
| Copy operator. Same as Copy(_other). More...
|
|
template<typename Data > |
Data * | Query (const QueryMode _mode=QueryMode::NORMAL) |
| Query this CompositeData for a Data-type entry. If it contains a Data-type object, it gets returned as a Data*. Otherwise, a nullptr is returned. More...
|
|
template<typename Data > |
const Data * | Query (const QueryMode mode=QueryMode::NORMAL) const |
| Const-qualified version of Query. This can be used to retrieve data from a const CompositeData . More...
|
|
template<typename Data > |
bool | Remove () |
| This will remove a Data-type object from this CompositeData and delete it if one is present. Otherwise, it will do nothing. Data-types that are marked as required will not (and cannot) be removed. More...
|
|
template<typename Data > |
bool | Requires () const |
| Returns true if the specified Data type is required by this CompositeData object. Otherwise, returns false. More...
|
|
void | ResetQueries () const |
| Reset the query flags on all data entries. This will make it appear as though no entries have ever been queried. See UnqueriedEntries() for more information about the "queried" flag. More...
|
|
template<typename Data > |
DataStatus | StatusOf () const |
| Returns a DataStatus object that describes the status of the requested data type. More...
|
|
std::set< std::string > | UnqueriedEntries () const |
| Get an ordered (alphabetical) set of the data entries in this CompositeData which have not been queried (Get, Insert, InsertOrAssign, Query, and MakeRequired all perform querying) since the data was implicitly created (e.g. by a copy or move operation) or since the last call to ResetQueries(), whichever is more recent. Runs with O(N) complexity. More...
|
|
std::size_t | UnqueriedEntryCount () const |
| Check how many data entries in this CompositeData have not been queried. See UnqueriedEntries() for more information about the "queried" flag. Runs with O(1) complexity. More...
|
|
template<typename Data > |
bool | Unquery () const |
| Returns true if this CompositeData has a Data-type object which was marked as queried, and that object is now marked as unqueried. If an object of that type does not exist or it was already unqueried, this returns false. More...
|
|
template<typename Expected>
class gz::physics::ExpectData< Expected >
ExpectData is an extension of CompositeData which indicates that the composite expects to be operating on the data types listed in its template arguments. All of the expected types will benefit from very high-speed operations when being accessed from an object of type ExpectData<Expected>. The ordinary CompositeData class needs to perform a map lookup on the data type whenever one of its functions is called, but an ExpectData<T> object does not need to perform any map lookup when performing an operation on T (e.g. .Get<T>(), .Insert<T>(), .Query<T>(), .Has<T>(), etc).
Note that there is no guarantee that any of the types listed in its template arguments will exist in the underlying CompositeData, but it will still provide very high-speed access for creating and querying them even if they are not yet present.
This template specialization implements ExpectData for a single type, but the ExpectData template can accept any number of types, e.g. ExpectData<T, U, V, W>.