Poco::FastInfoset

template < class T >

class Vocabulary

File Information

Library: FastInfoset
Package: FastInfoset
Header: Poco/FastInfoset/Vocabulary.h

Description

A Vocabulary allows to map values to indices and vice versa. New values are automatically enqueued and assigned an index.

Member Summary

Member Functions: clone, empty, exists, index, size, subtract, value

Types

Index

typedef VerbTable < T > Index;

Constructors

Vocabulary inline

Vocabulary();

Creates the Vocabulary.

Vocabulary protected inline

Vocabulary(
    const Vocabulary & voc
);

Destructor

~Vocabulary virtual inline

virtual ~Vocabulary();

Destroys the Vocabulary.

Member Functions

clone virtual

virtual Vocabulary * clone() const = 0;

Deep-copies the vocabulary

empty virtual

virtual bool empty() const = 0;

Returns true iff the vocabulary is empty.

exists virtual

virtual Poco::UInt32 exists(
    const T & value,
    bool & valueExisted
) const = 0;

Returns the index for the given value. Sets valueExisted to false if the value did not exist and returns Utility::INVALIDINDEX

index virtual

virtual Poco::UInt32 index(
    const T & value,
    bool & valueExisted
) = 0;

Returns the index for the given value. Automatically appends the value and assigns it a new index if the value does not exist yet. Query valueExisted to find out if the value already existed.

index inline

const Index & index() const;

size virtual

virtual std::size_t size() const = 0;

Returns the vocabulary's size.

subtract virtual

virtual Vocabulary * subtract(
    const Vocabulary & other
) const = 0;

Returns a new Vocabulary containing all entries that are contained in this Vocabulary, but not in the given other.

value virtual

virtual const T & value(
    Poco::UInt32 idx
) const = 0;

Returns the value for the given index. Throws an exception if the idx is out of range.

Variables

_index protected

Index _index;

Securely control IoT edge devices from anywhere   Connect a Device