UltraGrid
UltraGrid Low-Latency High-Resolution Transmission System
Loading...
Searching...
No Matches
SSRC_container< T, Ts_type > Class Template Reference

#include <ssrc_container.hpp>

Inheritance diagram for SSRC_container< T, Ts_type >:
Inheritance graph
Collaboration diagram for SSRC_container< T, Ts_type >:
Collaboration graph

Classes

struct  Holder
 

Public Member Functions

void clear ()
 
const std::vector< Holder > & get () const
 
void insert (uint32_t ssrc, const T &item, Ts_type timestamp)
 
void remove_timed_out (Ts_type timeout, Ts_type now)
 

Private Attributes

std::vector< Holder > items
 

Detailed Description

template<typename T, typename Ts_type>
class SSRC_container< T, Ts_type >

Definition at line 7 of file ssrc_container.hpp.

Member Function Documentation

◆ clear()

template<typename T , typename Ts_type >
void SSRC_container< T, Ts_type >::clear ( )
inline

Definition at line 18 of file ssrc_container.hpp.

18{ items.clear(); }
std::vector< Holder > items

References SSRC_container< T, Ts_type >::items.

◆ get()

template<typename T , typename Ts_type >
const std::vector< Holder > & SSRC_container< T, Ts_type >::get ( ) const
inline

Definition at line 16 of file ssrc_container.hpp.

16{ return items; }

References SSRC_container< T, Ts_type >::items.

◆ insert()

template<typename T , typename Ts_type >
void SSRC_container< T, Ts_type >::insert ( uint32_t ssrc,
const T & item,
Ts_type timestamp )
inline

Definition at line 25 of file ssrc_container.hpp.

25 {
26 Holder *h = nullptr;
27 for(auto& i : items){
28 if(i.ssrc == ssrc){
29 h = &i;
30 }
31 }
32
33 if(!h){
34 Holder newItem = {};
35 newItem.ssrc = ssrc;
36 items.push_back(newItem);
37 h = &items.back();
38 }
39
40 h->item = item;
41 h->timestamp = timestamp;
42}
Definition hd-rum.c:27

References SSRC_container< T, Ts_type >::Holder::item, SSRC_container< T, Ts_type >::Holder::ssrc, and SSRC_container< T, Ts_type >::Holder::timestamp.

◆ remove_timed_out()

template<typename T , typename Ts_type >
void SSRC_container< T, Ts_type >::remove_timed_out ( Ts_type timeout,
Ts_type now )
inline

Definition at line 45 of file ssrc_container.hpp.

45 {
46 auto endIt = std::remove_if(items.begin(), items.end(),
47 [now, timeout](const Holder& h){ return now - h.timestamp > timeout; });
48
49 items.erase(endIt, items.end());
50}

Member Data Documentation

◆ items

template<typename T , typename Ts_type >
std::vector<Holder> SSRC_container< T, Ts_type >::items
private

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