Autonomy Software C++ 24.5.1
Welcome to the Autonomy Software repository of the Mars Rover Design Team (MRDT) at Missouri University of Science and Technology (Missouri S&T)! API reference contains the source code and other resources for the development of the autonomy software for our Mars rover. The Autonomy Software project aims to compete in the University Rover Challenge (URC) by demonstrating advanced autonomous capabilities and robust navigation algorithms.
Loading...
Searching...
No Matches
containers::DataFetchContainer< T > Struct Template Reference

This struct is used to carry references to any datatype for scheduling and copying. It is constructed so that a reference to the data object is passed into the container and the pointer to that reference is stored internally. Then a shared_pointer to a new std::promise<bool> is created, which allows the programmer to return a future from whatever method created this container. The future can then be waited on before the data is used. The future will return a true or false. More...

#include <FetchContainers.hpp>

Public Member Functions

 DataFetchContainer (T &tData)
 Construct a new Frame Fetch Container object.
 
 DataFetchContainer (const DataFetchContainer &stOtherDataContainer)
 Copy Construct a new Frame Fetch Container object.
 
DataFetchContaineroperator= (const DataFetchContainer &stOtherDataContainer)
 Operator equals for FrameFetchContainer. Shallow Copy.
 

Public Attributes

T * pData
 
std::shared_ptr< std::promise< bool > > pCopiedDataStatus
 

Detailed Description

template<typename T>
struct containers::DataFetchContainer< T >

This struct is used to carry references to any datatype for scheduling and copying. It is constructed so that a reference to the data object is passed into the container and the pointer to that reference is stored internally. Then a shared_pointer to a new std::promise<bool> is created, which allows the programmer to return a future from whatever method created this container. The future can then be waited on before the data is used. The future will return a true or false.

The idea is that any threads that call a grab/retrieve method of an object (which also runs in a different thread) will have the data reference that they passed in be put into the called objects queues and then the grab/retrieve method will immediately return. This allows BOTH threads to continue processing other things or request multiple data copies non-sequentially/serially.

Template Parameters
T- The type of data object that this struct will be containing.
Author
ClayJay3 (clayt.nosp@m.onra.nosp@m.ycowe.nosp@m.n@gm.nosp@m.ail.c.nosp@m.om)
Date
2023-09-10

Constructor & Destructor Documentation

◆ DataFetchContainer() [1/2]

template<typename T >
containers::DataFetchContainer< T >::DataFetchContainer ( T &  tData)
inline

Construct a new Frame Fetch Container object.

Parameters
tTata- A reference to the data object to store.
Author
ClayJay3 (clayt.nosp@m.onra.nosp@m.ycowe.nosp@m.n@gm.nosp@m.ail.c.nosp@m.om)
Date
2023-09-09
176: pData(&tData), pCopiedDataStatus(std::make_shared<std::promise<bool>>()) {}

◆ DataFetchContainer() [2/2]

template<typename T >
containers::DataFetchContainer< T >::DataFetchContainer ( const DataFetchContainer< T > &  stOtherDataContainer)
inline

Copy Construct a new Frame Fetch Container object.

Parameters
stOtherDataContainer- DataFetchContainer to copy pointers and values from.
Author
clayjay3 (clayt.nosp@m.onra.nosp@m.ycowe.nosp@m.n@gm.nosp@m.ail.c.nosp@m.om)
Date
2023-09-26
186 :
187 pData(stOtherDataContainer.pData), pCopiedDataStatus(stOtherDataContainer.pCopiedDataStatus)
188 {}

Member Function Documentation

◆ operator=()

template<typename T >
DataFetchContainer & containers::DataFetchContainer< T >::operator= ( const DataFetchContainer< T > &  stOtherDataContainer)
inline

Operator equals for FrameFetchContainer. Shallow Copy.

Parameters
stOtherDataContainer- DataFetchContainer to copy pointers and values from.
Returns
DataFetchContainer& - A reference to this object.
Author
clayjay3 (clayt.nosp@m.onra.nosp@m.ycowe.nosp@m.n@gm.nosp@m.ail.c.nosp@m.om)
Date
2023-09-26
200 {
201 // Check if the passed in container is the same as this one.
202 if (this != &stOtherDataContainer)
203 {
204 // Copy struct attributes.
205 this->pData = stOtherDataContainer.pData;
206 this->pCopiedDataStatus = stOtherDataContainer.pCopiedDataStatus;
207 }
208
209 // Return pointer to this object which now contains the copied values.
210 return *this;
211 }

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