libptpmgmt
1.3
libptpmgmt library that provides the functionality of linuxptp pmc
pub
buf.h
Go to the documentation of this file.
1
/* SPDX-License-Identifier: LGPL-3.0-or-later
2
SPDX-FileCopyrightText: Copyright © 2021 Erez Geva <ErezGeva2@gmail.com> */
3
12
#ifndef __PTPMGMT_BUF_H
13
#define __PTPMGMT_BUF_H
14
15
#ifdef __cplusplus
16
#include "
name.h
"
17
18
__PTPMGMT_NAMESPACE_BEGIN
19
25
class
Buf
26
{
27
private
:
28
void
*m_buf =
nullptr
;
29
size_t
m_size = 0;
30
public
:
31
Buf
() =
default
;
36
Buf
(
size_t
size
) {
alloc
(
size
);}
37
~
Buf
();
43
bool
alloc
(
size_t
size
);
48
void
*
get
()
const
{
return
m_buf;}
53
void
*
operator()
()
const
{
return
m_buf;}
58
size_t
size
()
const
{
return
m_size;}
63
bool
isAlloc
()
const
{
return
m_size > 0;}
64
};
65
66
__PTPMGMT_NAMESPACE_END
67
#else
/* __cplusplus */
68
#error "this header is for C++ and scripts use only, NOT for C"
69
#endif
/* __cplusplus */
70
71
#endif
/* __PTPMGMT_BUF_H */
Buf
Definition:
buf.h:26
Buf::Buf
Buf(size_t size)
Definition:
buf.h:36
Buf::alloc
bool alloc(size_t size)
Buf::size
size_t size() const
Definition:
buf.h:58
Buf::isAlloc
bool isAlloc() const
Definition:
buf.h:63
Buf::get
void * get() const
Definition:
buf.h:48
Buf::operator()
void * operator()() const
Definition:
buf.h:53
name.h
Define name space.
Generated by
1.9.1