libptpmgmt 2.0
libptpmgmt library that provides the functionality of linuxptp pmc
Loading...
Searching...
No Matches
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
25class 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);
37 ~Buf();
43 bool alloc(size_t size);
48 void *get() const;
53 void *operator()() const {return get();}
58 size_t size() const;
63 bool isAlloc() const;
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 */
Definition buf.h:26
Buf(size_t size)
bool alloc(size_t size)
size_t size() const
void * get() const
bool isAlloc() const
void * operator()() const
Definition buf.h:53
Define name space.