Ocean
Ocean::Media::FrameCollection Class Reference

This class implements a simple buffer holding several frames combined with their timestamps and optional camera calibrations. More...

Public Member Functions

 FrameCollection ()=default
 Creates an empty frame collection able to hold one frame. More...
 
 FrameCollection (FrameCollection &&frameCollection)=default
 Move constructor. More...
 
 FrameCollection (const FrameCollection &frameCollection)=default
 Copy constructor. More...
 
 FrameCollection (const size_t capacity)
 Creates a new frame collection. More...
 
 ~FrameCollection ()
 Destructs a frame collection. More...
 
size_t capacity () const
 Returns the capacity of this frame collection object. More...
 
FrameRef recent (SharedAnyCamera *anyCamera=nullptr) const
 Returns the most recent frame. More...
 
FrameRef get (const Timestamp timestamp, SharedAnyCamera *anyCamera=nullptr) const
 Returns the frame with a specific timestamp. More...
 
bool has (const Timestamp timestamp) const
 Returns whether a frame with specific timestamp is currently stored inside the frame collection. More...
 
FrameRef set (const Frame &frame, SharedAnyCamera anyCamera=nullptr)
 Sets a new frame and overwrites the oldest frame. More...
 
FrameRef set (Frame &&frame, SharedAnyCamera anyCamera=nullptr)
 Sets a new frame and overwrites the oldest frame. More...
 
bool setCapacity (const size_t capacity)
 Sets or changes the capacity of this frame collection. More...
 
bool isNull () const
 Returns whether the frame collection is empty. More...
 
void clear ()
 Removes all frames from this frame collection. More...
 
 operator bool () const
 Returns whether the frame collection is not empty. More...
 
FrameCollectionoperator= (FrameCollection &&frameCollection)=default
 Default move operator. More...
 
FrameCollectionoperator= (const FrameCollection &frameCollection)=default
 Default assign operator. More...
 

Protected Types

using FrameCameraPair = std::pair< FrameRef, SharedAnyCamera >
 Definition of a pair combining a frame with a camera profile. More...
 
using RingMap = RingMapT< Timestamp, FrameCameraPair, true, true >
 Definition of a ring map mapping timestamps to frame pairs. More...
 

Protected Attributes

RingMap ringMap_ = RingMap(1)
 The ring map mapping timestamps to frame/camera pairs. More...
 

Detailed Description

This class implements a simple buffer holding several frames combined with their timestamps and optional camera calibrations.

Member Typedef Documentation

◆ FrameCameraPair

Definition of a pair combining a frame with a camera profile.

◆ RingMap

Definition of a ring map mapping timestamps to frame pairs.

Constructor & Destructor Documentation

◆ FrameCollection() [1/4]

Ocean::Media::FrameCollection::FrameCollection ( )
default

Creates an empty frame collection able to hold one frame.

◆ FrameCollection() [2/4]

Ocean::Media::FrameCollection::FrameCollection ( FrameCollection &&  frameCollection)
default

Move constructor.

Parameters
frameCollectionFrame collection to move

◆ FrameCollection() [3/4]

Ocean::Media::FrameCollection::FrameCollection ( const FrameCollection frameCollection)
default

Copy constructor.

Parameters
frameCollectionFrame collection to copy

◆ FrameCollection() [4/4]

Ocean::Media::FrameCollection::FrameCollection ( const size_t  capacity)
explicit

Creates a new frame collection.

Parameters
capacityNumber of maximal frames this object can store [1, infinity)

◆ ~FrameCollection()

Ocean::Media::FrameCollection::~FrameCollection ( )

Destructs a frame collection.

Member Function Documentation

◆ capacity()

size_t Ocean::Media::FrameCollection::capacity ( ) const
inline

Returns the capacity of this frame collection object.

Returns
The frame collection object's capacity, with range [0, infinity)

◆ clear()

void Ocean::Media::FrameCollection::clear ( )

Removes all frames from this frame collection.

The capacity will be kept.

◆ get()

FrameRef Ocean::Media::FrameCollection::get ( const Timestamp  timestamp,
SharedAnyCamera anyCamera = nullptr 
) const

Returns the frame with a specific timestamp.

If no frame with the given timestamp exists, the most recent frame will be returned.

Parameters
timestampThe timestamp of the frame to return
anyCameraOptional resulting camera if known; nullptr if not of interest
Returns
Frame with the specific timestamp

◆ has()

bool Ocean::Media::FrameCollection::has ( const Timestamp  timestamp) const

Returns whether a frame with specific timestamp is currently stored inside the frame collection.

Parameters
timestampThe timestamp to be checked
Returns
True, if so

◆ isNull()

bool Ocean::Media::FrameCollection::isNull ( ) const
inline

Returns whether the frame collection is empty.

Returns
True, if so

◆ operator bool()

Ocean::Media::FrameCollection::operator bool ( ) const
inlineexplicit

Returns whether the frame collection is not empty.

Returns
True, if so

◆ operator=() [1/2]

FrameCollection& Ocean::Media::FrameCollection::operator= ( const FrameCollection frameCollection)
default

Default assign operator.

Parameters
frameCollectionFrame collection to assign

◆ operator=() [2/2]

FrameCollection& Ocean::Media::FrameCollection::operator= ( FrameCollection &&  frameCollection)
default

Default move operator.

Parameters
frameCollectionFrame collection to move

◆ recent()

FrameRef Ocean::Media::FrameCollection::recent ( SharedAnyCamera anyCamera = nullptr) const

Returns the most recent frame.

Parameters
anyCameraOptional resulting camera if known; nullptr if not of interest
Returns
Most recent frame

◆ set() [1/2]

FrameRef Ocean::Media::FrameCollection::set ( const Frame frame,
SharedAnyCamera  anyCamera = nullptr 
)

Sets a new frame and overwrites the oldest frame.

Parameters
frameThe frame to set, a copy will be created
anyCameraOptional camera profile associated with the given frame, nullptr if unknown
Returns
Reference to the stored frame, if succeeded

◆ set() [2/2]

FrameRef Ocean::Media::FrameCollection::set ( Frame &&  frame,
SharedAnyCamera  anyCamera = nullptr 
)

Sets a new frame and overwrites the oldest frame.

Parameters
frameThe frame to set
anyCameraOptional camera profile associated with the given frame, nullptr if unknown
Returns
Reference to the stored frame, if succeeded

◆ setCapacity()

bool Ocean::Media::FrameCollection::setCapacity ( const size_t  capacity)

Sets or changes the capacity of this frame collection.

In case the capacity is reduced, the oldest frames will be removed

Parameters
capacityThe capacity to set, with range [1, infinity)
Returns
True, if succeeded

Field Documentation

◆ ringMap_

RingMap Ocean::Media::FrameCollection::ringMap_ = RingMap(1)
protected

The ring map mapping timestamps to frame/camera pairs.


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