Class LidarScanSet
Defined in File lidar_scan_set.h
Class Documentation
-
class LidarScanSet
Container of lidar scans that allows storing collection-associated fields that cannot be referenced back to any individual lidar scan.
Internal resources are kept under shared pointers so copying the set returns a shallow copy. Use LidarScanSet::clone() if necessary.
Public Functions
-
LidarScanSet()
The default constructor creates an empty set.
Initialize a LidarScanSet with a vector of lidar scans.
- Parameters:
scans[in] – vector of lidar scan shared pointers.
Initialize a LidarScanSet with a vector of lidar scans.
- Parameters:
scans[in] – vector of lidar scan shared pointers to steal.
Initialize a LidarScanSet with an initializer list.
- Parameters:
scans[in] – initializer list of lidar scan shared pointers.
-
std::vector<std::shared_ptr<LidarScan>>::iterator begin()
- Returns:
iterator to the beginning of the lidar scans
-
std::vector<std::shared_ptr<LidarScan>>::iterator end()
- Returns:
iterator past the end of the lidar scans
-
std::vector<std::shared_ptr<LidarScan>>::const_iterator begin() const
- Returns:
const iterator to the beginning of the lidar scans
-
std::vector<std::shared_ptr<LidarScan>>::const_iterator end() const
- Returns:
const iterator past the end of the lidar scans
-
inline ValidObjectIterator<LidarScan> valid_scans()
- Returns:
an iterator over valid (non-null) lidar scans
-
inline ValidObjectConstIterator<LidarScan> valid_scans() const
- Returns:
a const iterator over valid (non-null) lidar scans
-
inline ValidIndexIterator<LidarScan> valid_indices()
- Returns:
an iterator that yields the indices of valid (non-null) lidar scans
-
inline ValidIndexConstIterator<LidarScan> valid_indices() const
- Returns:
a const iterator that yields the indices of valid (non-null) lidar scans
-
const std::shared_ptr<LidarScan> &operator[](int index) const
Returns nth scan in the LidarScanSet.
- Parameters:
index[in] – index of the scan to return
- Returns:
shared ptr of scan at the given index
-
std::shared_ptr<LidarScan> &operator[](int index)
Returns nth scan in the LidarScanSet.
- Parameters:
index[in] – index of the scan to return
- Returns:
shared ptr of scan at the given index
-
size_t size() const
Returns number of lidar scans stored in the LidarScanSet.
- Returns:
number of lidar scans
-
Field &add_field(const std::string &name, FieldDescriptor desc)
Add a new zero-filled field to LidarScanSet.
- Throws:
std::invalid_argument – if key duplicates a preexisting field
- Parameters:
name – [in] string key of the field to add
desc – [in] descriptor of the field to add
- Returns:
field
-
Field del_field(const std::string &name)
Release the field and remove it from LidarScanSet.
- Throws:
std::invalid_argument – if field under key does not exist
- Parameters:
name – [in] string key of the field to remove
- Returns:
field The deleted field.
-
bool has_field(const std::string &name) const
Check if a field exists.
- Parameters:
name[in] – string key of the field to check
- Returns:
true if the LidarScanSet has the field, else false
-
Field &field(const std::string &name)
- Parameters:
name[in] – string key of the field to access
- Returns:
Field reference of the requested field
-
const Field &field(const std::string &name) const
- Parameters:
name[in] – string key of the field to access
- Returns:
Field reference of the requested field
-
std::unordered_map<std::string, Field> &fields()
Reference to the internal fields map.
- Returns:
The unordered map of field type and field.
-
const std::unordered_map<std::string, Field> &fields() const
Reference to the internal fields map.
- Returns:
The unordered map of field type and field.
-
std::vector<std::shared_ptr<LidarScan>> &scans()
Reference to the internal vector of scans.
- Returns:
The vector of shared pointers to lidar scans.
-
const std::vector<std::shared_ptr<LidarScan>> &scans() const
Reference to the internal vector of scans.
- Returns:
The vector of shared pointers to lidar scans.
-
void swap(LidarScanSet &other) noexcept
Swaps two LidarScanSets.
- Parameters:
other[in] – LidarScanSet to swap resources with
-
LidarScanSet clone() const
Get a deep copy of a LidarScanSet.
- Returns:
deep copy
-
LidarScanSet()