ONE - On-device Neural Engine
Loading...
Searching...
No Matches
souschef::ExplicitUint4DataChef Class Referencefinal

#include <Explicit.h>

Collaboration diagram for souschef::ExplicitUint4DataChef:

Public Member Functions

 ExplicitUint4DataChef ()
 
std::vector< uint8_t > generate (int32_t count) const override
 Generate a sequence of 'count' elements as a byte sequence.
 
void insert (const uint8_t &value)
 
- Public Member Functions inherited from souschef::DataChef
virtual ~DataChef ()=default
 

Detailed Description

Definition at line 168 of file Explicit.h.

Constructor & Destructor Documentation

◆ ExplicitUint4DataChef()

souschef::ExplicitUint4DataChef::ExplicitUint4DataChef ( )
inline

Definition at line 171 of file Explicit.h.

172 {
173 // DO NOTHING
174 }

Member Function Documentation

◆ generate()

std::vector< uint8_t > souschef::ExplicitUint4DataChef::generate ( int32_t  count) const
overridevirtual

Generate a sequence of 'count' elements as a byte sequence.

Let D be the return value of generate(N). Then, D.size() == N * sizeof(T) where T is the element type.

Implements souschef::DataChef.

Definition at line 116 of file Explicit.cpp.

117{
118 std::vector<uint8_t> res;
119
120 for (uint32_t n = 0; n < count; ++n)
121 {
122 uint8_t const value = (n < _values.size()) ? _values.at(n) : 0;
123 if (15 < value)
124 throw std::runtime_error("Explicit value out of range.");
125
126 res.emplace_back(value);
127 }
128
129 return res;
130}

◆ insert()

void souschef::ExplicitUint4DataChef::insert ( const uint8_t &  value)
inline

Definition at line 180 of file Explicit.h.

180{ _values.emplace_back(value); }

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