libptpmgmt  1.4
libptpmgmt library that provides the functionality of linuxptp pmc
Public Member Functions | List of all members
PtpSample_v Class Reference

#include <vecDef.h>

Public Member Functions

 PtpSample_v ()
 
 PtpSample_v (size_t size)
 
 PtpSample_v (size_t size, const PtpSample_t &value)
 
 PtpSample_v (const PtpSample_v &container)
 
size_t size () const
 
bool empty () const
 
void clear ()
 
void push (const PtpSample_t &value)
 
PtpSample_t pop ()
 
void pop_back ()
 
PtpSample_t back ()
 
PtpSample_t front ()
 
PtpSample_tget (size_t position) const
 
void set (size_t position, PtpSample_t &value)
 
PtpSample_toperator[] (size_t position)
 
size_t capacity () const
 
void reserve (size_t new_cap)
 
size_t max_size () const
 

Detailed Description

class to handle std::vector<PtpSample_t> in scripts

Constructor & Destructor Documentation

◆ PtpSample_v() [1/4]

PtpSample_v::PtpSample_v ( )

Initiate a new empty container

Note
Go do not use constructor and destructors, call
NewPtpSample_v()
and
DeletePtpSample_v()
explicitly.

◆ PtpSample_v() [2/4]

PtpSample_v::PtpSample_v ( size_t  size)

Initiate a new container with size elements

Parameters
[in]sizeof the new container
Note
Elements holds default value!
Go do not use constructor and destructors, call
NewPtpSample_v(int64(size))
size_t size() const
and
DeletePtpSample_v()
explicitly.

◆ PtpSample_v() [3/4]

PtpSample_v::PtpSample_v ( size_t  size,
const PtpSample_t value 
)

Initiate a new container with size elements and copy value to all elements

Parameters
[in]sizeof the new container
[in]valuefor all elements in new container
Note
This constructor is not available in PHP and in Go.

◆ PtpSample_v() [4/4]

PtpSample_v::PtpSample_v ( const PtpSample_v container)

Copy constructor

Parameters
[in]containerto copy
Note
Go do not use constructor and destructors, call
NewPtpSample_v(container)
and
DeletePtpSample_v()
explicitly.

Member Function Documentation

◆ back()

PtpSample_t PtpSample_v::back ( )

Get last element from container

Attention
initiate exception if container is empty!
Note
This function available in Python, Ruby and Lua.

◆ capacity()

size_t PtpSample_v::capacity ( ) const

Get current container capacity

Note
This function available in Python, Ruby, PHP and Go.
The function is named
Capacity()
in Go.

◆ clear()

void PtpSample_v::clear ( )

Remove all elements from container

Note
Call std::vector<PtpSample_t>::clear()
The function is named
Clear()
in Go.

◆ empty()

bool PtpSample_v::empty ( ) const

Query if container is empty

Returns
true if size is zero
Note
The function is named
is_empty()
in PHP,
bool empty() const
in Ruby. and
IsEmpty()
in Go.

◆ front()

PtpSample_t PtpSample_v::front ( )

Get first element from container

Attention
initiate exception if container is empty!
Note
This function available in Python, Ruby and Lua.

◆ get()

PtpSample_t& PtpSample_v::get ( size_t  position) const

Get element from the container

Parameters
[in]positionof element to get
Returns
the element
Attention
initiate exception if out of range!
Note
This function is available in Perl, Tcl and PHP. Ruby, Python and Lua use operator[].
The function is named
Get()
in Go.

◆ max_size()

size_t PtpSample_v::max_size ( ) const

Get system limitation to container size

Note
This function available in Lua only.

◆ operator[]()

PtpSample_t& PtpSample_v::operator[] ( size_t  position)

Fetch an element from the container The operator can be used for retrieving and setting!

Parameters
[in]positionof the element
Returns
the element
Attention
initiate exception if out of range!
Note
This function is available for Ruby, Python and Lua. Perl, Tcl and PHP should use
get(), set()
PtpSample_t & get(size_t position) const
void set(size_t position, PtpSample_t &value)
. Go use
Get(), Set()
.
To set use
variable[index] = new_value

◆ pop()

PtpSample_t PtpSample_v::pop ( )

Get last element and removes it from the container

Returns
last element
Attention
initiate exception if container is empty!
Note
Call std::vector<PtpSample_t>::back() and std::vector<PtpSample_t>::pop_back()
This function is not available in Lua and Go. Lua have the 'back()' and 'pop_back()' functions.

◆ pop_back()

void PtpSample_v::pop_back ( )

Removes last element from the container

Attention
initiate exception if container is empty!
Note
This function available in Python and Lua only.

◆ push()

void PtpSample_v::push ( const PtpSample_t value)

Push a copy of element at the end of the container

Parameters
[in]valueto push
Note
Call std::vector<PtpSample_t>::push_back()
The function is named
push_back()
in Python and Lua, and
Add()
in Go.

◆ reserve()

void PtpSample_v::reserve ( size_t  new_cap)

Reserve more space for further elements

Note
This function available in Python, Ruby, PHP and Go.
The function is named
Reserve()
in Go.

◆ set()

void PtpSample_v::set ( size_t  position,
PtpSample_t value 
)

Replace element value in the container

Parameters
[in]positionof element to set
[in]valueelement with new value
Attention
initiate exception if out of range!
Note
This function is available in Perl, Tcl, PHP and Go. Ruby, Python and Lua use operator[].
The function is named
Set()
in Go.

◆ size()

size_t PtpSample_v::size ( ) const

Get the number of elements in container

Returns
number of elements in container
Note
The function is named
Size()
in Go.

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