Dawn Framework 1.0
Universal data acquisition framework for embedded systems
uname.hxx
1// dawn/include/dawn/io/uname.hxx
2//
3// SPDX-License-Identifier: Apache-2.0
4//
5
6#pragma once
7
8#include <mutex>
9
10#include "dawn/io/common.hxx"
11#include "dawn/porting/config.hxx"
12
13namespace dawn
14{
22class CIOUname : public CIOCommon
23{
24public:
25 explicit CIOUname(CDescObject &desc)
26 : CIOCommon(desc)
27 , dim(getDataDim(getCls()))
28 {
29 }
30
31 ~CIOUname() override = default;
32
33#ifdef CONFIG_DAWN_OBJECT_HAS_NAME
34 const char *getClassNameStr() const override
35 {
36 return "hostname";
37 }
38#endif
39
40 int init() override;
41 int getDataImpl(IODataCmn &data, size_t len) override;
42 int setDataImpl(IODataCmn &data) override;
43 size_t getDataSize() const override;
44 size_t getDataDim() const override;
45
46 bool isRead() const override
47 {
48 return true;
49 };
50
51 bool isWrite() const override
52 {
53 return false;
54 };
55
56 bool isNotify() const override
57 {
58 return false;
59 };
60
61 bool isBatch() const override
62 {
63 return false;
64 };
65
66 constexpr static SObjectId::ObjectId objectIdHostname()
67 {
70 }
71
72private:
73 size_t dim;
74
75 size_t getDataDim(uint16_t cls) const;
76};
77} // Namespace dawn
Descriptor wrapper for individual object configuration.
Base class for all I/O objects.
Definition common.hxx:27
@ IO_CLASS_SYSTEM_HOSTNAME
System hostname.
Definition common.hxx:155
System identification I/O providing hostname and version info.
Definition uname.hxx:23
int setDataImpl(IODataCmn &data)
Set data implementation (override in derived classes).
Definition uname.cxx:80
size_t getDataSize() const
Get data size in bytes.
Definition uname.cxx:87
int init()
One-time initialize object after bindings are resolved.
Definition uname.cxx:12
bool isNotify() const
Check if IO supports notifications.
Definition uname.hxx:56
int getDataImpl(IODataCmn &data, size_t len)
Get data implementation (override in derived classes).
Definition uname.cxx:45
bool isRead() const
Check if IO supports read operations.
Definition uname.hxx:46
size_t getDataDim() const
Get data vector dimension.
Definition uname.cxx:23
bool isWrite() const
Check if IO supports write operations.
Definition uname.hxx:51
bool isBatch() const
Check if IO supports batch operations.
Definition uname.hxx:61
uint16_t getCls() const
Get object class field.
Definition object.cxx:170
Out-of-tree user-extension hooks for Dawn.
Definition bindable.hxx:13
Base interface for I/O data buffers (static and dynamic).
Definition idata.hxx:21
@ OBJTYPE_IO
Input/Output object type.
Definition objectid.hxx:184
@ DTYPE_CHAR
Character/string type (null-terminated, 4-byte aligned).
Definition objectid.hxx:144
uint32_t ObjectId
ObjectID type - single 32-bit value.
Definition objectid.hxx:44
static ObjectId objectId(uint8_t type, uint16_t cls, uint8_t dtype, uint8_t flags, uint16_t priv)
Construct 32-bit ObjectID from component fields.
Definition objectid.hxx:290