2022-Robot
Robot code for 2022 FRC Season by Argos, FRC team #1756
Loading...
Searching...
No Matches
FSHomingStorage< T > Class Template Reference

Saves and loads home positions from filesystem. More...

#include <homing_storage_interface.h>

Inheritance diagram for FSHomingStorage< T >:
HomingStorageInterface< T >

Public Member Functions

 FSHomingStorage (const fs::path &homeFilePath)
 Construct a new FSHomingStorage object. More...
 
bool Save (const T &homePosition) override
 Save home position to persistent storage. More...
 
std::optional< T > Load () override
 Load home position from persistent storage. More...
 
virtual bool Save (const T &homePosition)=0
 Save home position to persistent storage. More...
 
virtual std::optional< T > Load ()=0
 Load home position from persistent storage. More...
 

Private Member Functions

fs::path GetFilePath ()
 

Private Attributes

const fs::path m_homesPath
 

Detailed Description

template<class T>
class FSHomingStorage< T >

Saves and loads home positions from filesystem.

Template Parameters
TType of the home position. Should be a units type

Constructor & Destructor Documentation

◆ FSHomingStorage()

template<class T >
FSHomingStorage< T >::FSHomingStorage ( const fs::path &  homeFilePath)
inlineexplicit

Construct a new FSHomingStorage object.

Parameters
homeFilePathPath to save homes to relative to internally-managed root directory

Member Function Documentation

◆ GetFilePath()

template<class T >
fs::path FSHomingStorage< T >::GetFilePath ( )
inlineprivate

◆ Load()

template<class T >
std::optional< T > FSHomingStorage< T >::Load ( )
inlineoverridevirtual

Load home position from persistent storage.

Returns
Poisition from persistent storage or std::nullopt if load failed or no positions were previously stored

Implements HomingStorageInterface< T >.

◆ Save()

template<class T >
bool FSHomingStorage< T >::Save ( const T &  homePosition)
inlineoverridevirtual

Save home position to persistent storage.

Parameters
homePositionPosition to store
Returns
true Save successful
false Error saving

Implements HomingStorageInterface< T >.

Member Data Documentation

◆ m_homesPath

template<class T >
const fs::path FSHomingStorage< T >::m_homesPath
private

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