gz/physics/CompositeData.hh
This struct is the return type of the various Insert...<T>() functions. It returns a reference to the...
Definition: gz/physics/CompositeData.hh:106
bool exists
If the data exists in the CompositeData, this will be true, otherwise it is false.
Definition: gz/physics/CompositeData.hh:558
InsertResult & operator=(const InsertResult &)=delete
Data * Query(const QueryMode _mode=QueryMode::NORMAL)
Query this CompositeData for a Data-type entry. If it contains a Data-type object,...
CompositeData & Merge(const CompositeData &_other, const bool _mergeRequirements=false)
Merge the data from _other into this CompositeData. If there are any conflicting data entries,...
static constexpr bool Expects()
When called from a generic CompositeData type, this always returns false. More highly specified Compo...
Struct that describes the status of data.
Definition: gz/physics/CompositeData.hh:554
@ SILENT
Performing the operation has no effect on whether data is marked as queried.
bool Unquery() const
Returns true if this CompositeData has a Data-type object which was marked as queried,...
std::set< std::string > AllEntries() const
Get an ordered set of all data entries in this CompositeData. Runs with O(N) complexity.
const bool inserted
True if the operation resulted in inserting a new data entry.
Definition: gz/physics/CompositeData.hh:118
CompositeData()
Default constructor. Creates an empty CompositeData object.
std::size_t UnqueriedEntryCount() const
Check how many data entries in this CompositeData have not been queried. See UnqueriedEntries() for m...
std::size_t numQueries
Total number of unique queries which have been performed since either construction or the last call t...
Definition: gz/physics/CompositeData.hh:980
bool Has() const
Returns true if this CompositeData has an object of type Data, otherwise returns false....
@ NORMAL
Performing the operation will cause an unqueried Data's status to flip to queried....
std::set< std::string > UnqueriedEntries() const
Get an ordered (alphabetical) set of the data entries in this CompositeData which have not been queri...
Data & Get()
Get a reference to a Data object. If an object of the Data type does not already exist in this Compos...
DataStatus()
Default constructor. Initializes everything to false.
bool Remove()
This will remove a Data-type object from this CompositeData and delete it if one is present....
DataStatus StatusOf() const
Returns a DataStatus object that describes the status of the requested data type.
InsertResult< Data > InsertOrAssign(Args &&... _args)
Attempt to insert a Data-type entry. If a Data-type entry did not already exist, it will be construct...
static constexpr bool AlwaysRequires()
When called from a generic CompositeData type, this always returns false. Static (Always) requirement...
The CompositeData class allows arbitrary data structures to be composed together, copied,...
Definition: gz/physics/CompositeData.hh:43
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 m...
std::size_t numEntries
Total number of data entries currently in this CompositeData. Note that this may differ from the size...
Definition: gz/physics/CompositeData.hh:976
MapOfData dataMap
Map from the label of a data object type to its entry.
Definition: gz/physics/CompositeData.hh:970
CompositeData & operator=(const CompositeData &_other)
Copy operator. Same as Copy(_other).
void ResetQueries() const
Reset the query flags on all data entries. This will make it appear as though no entries have ever be...
Data & MakeRequired(Args &&..._args)
Marks the specified type of Data as required, creates one with the given arguments if it did not exis...
bool Requires() const
Returns true if the specified Data type is required by this CompositeData object. Otherwise,...
Data & data
A reference to the Data entry within the CompositeData object.
Definition: gz/physics/CompositeData.hh:110
bool required
If the data is marked as required, this will be true, otherwise it is false.
Definition: gz/physics/CompositeData.hh:567
InsertResult< Data > Insert(Args &&..._args)
This will attempt to insert a new Data entry into the CompositeData object, forwarding _args to the c...
QueryMode
Use these flags in Query(), Has(), and StatusOf() to change their effects on the meta info of the dat...
Definition: gz/physics/CompositeData.hh:359
std::size_t EntryCount() const
Check how many data entries are in this CompositeData. Runs with O(1) complexity.
bool queried
If the data was marked as queried BEFORE calling StatusOf (regardless of what QueryMode is used),...
Definition: gz/physics/CompositeData.hh:563