TSDuck v3.40-4033
MPEG Transport Stream Toolkit
Loading...
Searching...
No Matches
ts::xml::JSONConverter Class Reference

XML-to-JSON converter. More...

#include <tsxmlJSONConverter.h>

Inheritance diagram for ts::xml::JSONConverter:
Collaboration diagram for ts::xml::JSONConverter:

Public Member Functions

 JSONConverter (Report &report=(ts::NullReport::Instance()))
 Default constructor.
 
virtual ~JSONConverter () override
 Destructor.
 
size_t childrenCount () const
 Get the number of children.
 
virtual void clear ()
 Clear the content of the node.
 
virtual Nodeclone () const override
 Clone the content of the node in a dynamically allocated object.
 
json::ValuePtr convertToJSON (const Document &source, bool force_root=false) const
 Convert an XML document into a JSON object.
 
bool convertToXML (const json::Value &source, Document &destination, bool auto_validate) const
 Convert a JSON object into an XML document.
 
UString debug () const
 Build a debug string for the node.
 
size_t depth () const
 Get the depth of an XML element.
 
Documentdocument ()
 Get the document into which the node is located.
 
const Documentdocument () const
 Get the document into which the node is located.
 
NodefirstChild ()
 Get the first child of a node.
 
const NodefirstChild () const
 Get the first child of a node.
 
ElementfirstChildElement ()
 Get the first child Element of a node.
 
const ElementfirstChildElement () const
 Get the first child Element of a node.
 
bool hasChildren () const
 Check if the node has children.
 
Elementinitialize (const UString &rootName, const UString &declaration=UString())
 Initialize the document.
 
NodelastChild ()
 Get the last child.
 
const NodelastChild () const
 Get the last child.
 
size_t lineNumber () const
 Get the line number in input document.
 
bool load (const UString &fileName, bool search=true)
 Load and parse an XML file.
 
bool load (std::istream &strm)
 Load and parse an XML file.
 
void move (Node *newSibling, bool before)
 Move the node before or after another node, potentially to a new parent.
 
void moveAfter (Node *newSibling)
 Move the node after another node, potentially to a new parent.
 
void moveBefore (Node *newSibling)
 Move the node before another node, potentially to a new parent.
 
NodenextSibling ()
 Get the next sibling node.
 
const NodenextSibling () const
 Get the next sibling node.
 
ElementnextSiblingElement ()
 Find the next sibling element.
 
const ElementnextSiblingElement () const
 Find the next sibling element.
 
virtual UString oneLiner () const
 Format the value as a one-liner XML text.
 
Nodeparent ()
 Get the parent's node.
 
const Nodeparent () const
 Get the parent's node.
 
bool parse (const UString &text)
 Parse an XML document.
 
bool parse (const UStringList &lines)
 Parse an XML document.
 
bool preserveSpace () const
 Check if the node or one of its ancestors has attribute xml:space="preserve".
 
NodepreviousSibling ()
 Get the previous sibling node.
 
const NodepreviousSibling () const
 Get the previous sibling node.
 
ElementpreviousSiblingElement ()
 Find the previous sibling element.
 
const ElementpreviousSiblingElement () const
 Find the previous sibling element.
 
virtual void print (TextFormatter &output, bool keepNodeOpen=false) const override
 Format the node for an output XML document.
 
virtual void printClose (TextFormatter &output, size_t levels=std::numeric_limits< size_t >::max()) const override
 Print the closing tags for the node.
 
void removeComments (bool recurse)
 Remove all comments in the XML node.
 
void reparent (Node *newParent, bool last=true)
 Attach the node to a new parent.
 
Reportreport () const
 Get a reference to the report object for the XML node.
 
bool ringAlone () const
 Check if the node is alone in its own ring.
 
void ringInsertAfter (RingNode *o)
 Insert this object in a ring after the specified node.
 
void ringInsertBefore (RingNode *o)
 Insert this object in a ring before the specified node.
 
template<typename T >
T * ringNext ()
 Get the next node in the ring.
 
template<typename T >
const T * ringNext () const
 Get the next node in the ring.
 
template<typename T >
T * ringPrevious ()
 Get the previous node in the ring.
 
template<typename T >
const T * ringPrevious () const
 Get the previous node in the ring.
 
void ringRemove ()
 Remove the node from the ring it belongs to and creates its own ring.
 
size_t ringSize () const
 Count the number of element in the ring.
 
void ringSwap (RingNode *o)
 Swap this object and another one in their rings.
 
ElementrootElement ()
 Get the root element of the document.
 
const ElementrootElement () const
 Get the root element of the document.
 
bool save (const fs::path &fileName, size_t indent=2)
 Save an XML file.
 
void setTweaks (const Tweaks &tw)
 Set the global XML parsing and formatting tweaks for the document.
 
void setValue (const UString &value)
 Set the value of the node.
 
virtual bool stickyOutput () const
 Check if the text shall be stuck to other elements in XML output.
 
virtual UString toString () const override
 Convert to a string object.
 
virtual const Tweakstweaks () const override
 Get a constant reference to the global XML parsing and formatting tweaks for the document.
 
virtual UString typeName () const override
 Return a node type name, mainly for debug purpose.
 
bool validate (const Document &doc) const
 Validate an XML document.
 
const UStringvalue () const
 Get the value of the node.
 

Static Public Member Functions

static UString DisplayFileName (const UString &name, bool stdInputIfEmpty=false)
 Get a suitable display name for an XML file name or inline content.
 
static bool IsInlineXML (const UString &name)
 Check if a "file name" is in fact inline XML content instead of a file name.
 

Static Public Attributes

static const UString HashName
 The string "#name" which is used to hold the name of an XML element in a JSON object.
 
static const UString HashNodes
 The string "#nodes" which is used to hold the children of an XML element in a JSON object.
 
static const UString HashUnnamed
 The string "_unnamed" which is used for reverse JSON-toXML conversion for unnamed objects.
 

Protected Member Functions

const ElementfindModelElement (const Element *elem, const UString &name) const
 Find a child element by name in an XML model element.
 
NodeidentifyNextNode (TextParser &parser)
 Identify the next token in the document.
 
virtual bool parseChildren (TextParser &parser)
 Parse children nodes and add them to the node.
 
virtual bool parseNode (TextParser &parser, const Node *parent) override
 Parse the node.
 
void setPreserveSpace (bool on)
 Called by the subclass when its spaces shall be preserved.
 

Detailed Description

XML-to-JSON converter.

An XML-to-JSON converter is a model document which is used to convert an XML document into a JSON object.

In this class, the XML model is not used to validate the XML document. The model is optional (it can be empty). It is only used as a hint to infer the type of XML attributes and text nodes in the source document.

There is no standard way to convert XML to JSON. Several tools exist and each of them has its own conversion rules. Here, we use the following rules:

  • Each XML element is converted to a JSON object {...}.
  • The name of the XML element is an attribute "#name" inside the object. Note that it was not possible to transform '<foo .../>' into '"foo" : {...}' because several XML element with the same name can appear in the same block. Consequently, '<foo .../>' is converted to '{"#name" : "foo", ...}'.
  • All attributes of the XML element are directly mapped into the JSON object.
    • By default, attribute values are converted to JSON strings.
    • If the model has a value for this attribute and if this model value starts with "int" or "uint" and the attribute value can be successfully converted to an integer, then the value becomes a JSON number.
    • Similarly, if the model value starts with "bool" and the value can be successfully converted to a boolean, then the value becomes a JSON True or False.
  • The children nodes inside an element are placed in a JSON array with name "#nodes". Consequently, '<foo> <bar/> <baz/> </foo>' is converted to '{"#name" : "foo", "#nodes" : [{"#name" : "bar"}, {"#name" : "baz"}]}'.
  • Each XML text node is converted to a JSON string. If the model has a value for this text node and if this model value starts with "hexa", then all spaces are collapsed inside the string.
  • XML declarations, comments and "unknown" nodes are dropped.

Constructor & Destructor Documentation

◆ JSONConverter()

ts::xml::JSONConverter::JSONConverter ( Report report = (ts::NullReport::Instance()))

Default constructor.

Parameters
[in,out]reportWhere to report errors.

Member Function Documentation

◆ convertToJSON()

json::ValuePtr ts::xml::JSONConverter::convertToJSON ( const Document source,
bool  force_root = false 
) const

Convert an XML document into a JSON object.

Parameters
[in]sourceThe source XML document to convert.
[in]force_rootIf true, force the option --x2j-include-root.
Returns
A safe pointer to the converted JSON object. Never null. Point to a JSON Null on error.

◆ convertToXML()

bool ts::xml::JSONConverter::convertToXML ( const json::Value source,
Document destination,
bool  auto_validate 
) const

Convert a JSON object into an XML document.

Not all JSON values can be converted. Basically, only JSON objects which were previously converted from XML are guaranteed to be converted back. For other values, a best-effort conversion is applied, without guarantee.

Parameters
[in]sourceThe source JSON value to convert. If this is a JSON object, it becomes the root of the XML document. If this is an array, the XML root is taken from the model and the array elements are converted inside that root.
[out]destinationThe converted XML document.
[in]auto_validateIf true, the converted document is validated according to the modeL.
Returns
True if the JSON source is converted without error and is correctly validated.

◆ validate()

bool ts::xml::ModelDocument::validate ( const Document doc) const
inherited

Validate an XML document.

Parameters
[in]docThe document to validate according to the model.
Returns
True if doc matches the model in this object, false if it does not.

◆ findModelElement()

const Element * ts::xml::ModelDocument::findModelElement ( const Element elem,
const UString name 
) const
protectedinherited

Find a child element by name in an XML model element.

Parameters
[in]elemAn XML element in a model document.
[in]nameName of the child element to search.
Returns
Address of the child model or zero if not found.

◆ parse() [1/2]

bool ts::xml::Document::parse ( const UStringList lines)
inherited

Parse an XML document.

Parameters
[in]linesList of text lines forming the XML document.
Returns
True on success, false on error.

◆ parse() [2/2]

bool ts::xml::Document::parse ( const UString text)
inherited

Parse an XML document.

Parameters
[in]textThe XML document.
Returns
True on success, false on error.

◆ load() [1/2]

bool ts::xml::Document::load ( const UString fileName,
bool  search = true 
)
inherited

Load and parse an XML file.

Parameters
[in]fileNameName of the XML file to load. If fileName is empty or "-", read the standard input. If fileName starts with "<?xml", this is considered as "inline XML content". The document is loaded from this string instead of reading a file.
[in]searchIf true, search the XML file in the TSDuck configuration directories if fileName is not found and does not contain any directory part.
Returns
True on success, false on error.
See also
SearchConfigurationFile()

◆ load() [2/2]

bool ts::xml::Document::load ( std::istream &  strm)
inherited

Load and parse an XML file.

Parameters
[in,out]strmA standard text stream in input mode.
Returns
True on success, false on error.

◆ save()

bool ts::xml::Document::save ( const fs::path &  fileName,
size_t  indent = 2 
)
inherited

Save an XML file.

Parameters
[in]fileNameName of the XML file to save. If fileName is empty or "-", writes to the standard output.
[in]indentIndentation width of each level.
Returns
True on success, false on error.

◆ IsInlineXML()

static bool ts::xml::Document::IsInlineXML ( const UString name)
staticinherited

Check if a "file name" is in fact inline XML content instead of a file name.

Parameters
[in]nameA file name string.
Returns
True if name contains inline XML content, false otherwise.

◆ DisplayFileName()

static UString ts::xml::Document::DisplayFileName ( const UString name,
bool  stdInputIfEmpty = false 
)
staticinherited

Get a suitable display name for an XML file name or inline content.

Parameters
[in]nameA file name string.
[in]stdInputIfEmptyIf true and if fileName is empty, reads the standard input.
Returns
A suitable string to display.

◆ rootElement() [1/2]

const Element * ts::xml::Document::rootElement ( ) const
inlineinherited

Get the root element of the document.

Returns
The root element of the document or a null pointer if there is none.

◆ rootElement() [2/2]

Element * ts::xml::Document::rootElement ( )
inlineinherited

Get the root element of the document.

Returns
The root element of the document or or a null pointer if there is none.

◆ initialize()

Element * ts::xml::Document::initialize ( const UString rootName,
const UString declaration = UString() 
)
inherited

Initialize the document.

The initial declaration and root are created.

Parameters
[in]rootNameName of the root element to create.
[in]declarationOptional XML declaration. When omitted, the standard declaration is used, specifying UTF-8 as format.
Returns
New root element of the document or null on error.

◆ tweaks()

virtual const Tweaks & ts::xml::Document::tweaks ( ) const
overridevirtualinherited

Get a constant reference to the global XML parsing and formatting tweaks for the document.

Returns
A constant reference to the global XML tweaks.

Reimplemented from ts::xml::Node.

◆ setTweaks()

void ts::xml::Document::setTweaks ( const Tweaks tw)
inlineinherited

Set the global XML parsing and formatting tweaks for the document.

Parameters
[in]twThe new global XML tweaks.

◆ toString()

virtual UString ts::xml::Document::toString ( ) const
overridevirtualinherited

Convert to a string object.

Returns
This object, converted as a string.

Implements ts::StringifyInterface.

◆ clone()

virtual Node * ts::xml::Document::clone ( ) const
overridevirtualinherited

Clone the content of the node in a dynamically allocated object.

This virtual method must be implemented by subclasses to allocate a object of the right class.

Returns
The address of a new XML node of the same class as this object, same content, same structure.

Implements ts::xml::Node.

◆ typeName()

virtual UString ts::xml::Document::typeName ( ) const
overridevirtualinherited

Return a node type name, mainly for debug purpose.

Returns
Node type name.

Implements ts::xml::Node.

◆ print()

virtual void ts::xml::Document::print ( TextFormatter output,
bool  keepNodeOpen = false 
) const
overridevirtualinherited

Format the node for an output XML document.

Parameters
[in,out]outputThe output object to format the XML document.
[in]keepNodeOpenIf true, keep the node open so that children may be printed later.

Implements ts::xml::Node.

◆ printClose()

virtual void ts::xml::Document::printClose ( TextFormatter output,
size_t  levels = std::numeric_limits< size_t >::max() 
) const
overridevirtualinherited

Print the closing tags for the node.

Typically used after print() when keepNodeOpen was true. The default implementation is to do nothing. Subclasses may replace this.

Parameters
[in,out]outputThe output object to format the XML document.
[in]levelsNumber of levels to close. By default, close the complete document. If zero, no output is produced.

Reimplemented from ts::xml::Node.

◆ parseNode()

virtual bool ts::xml::Document::parseNode ( TextParser parser,
const Node parent 
)
overrideprotectedvirtualinherited

Parse the node.

Parameters
[in,out]parserThe document parser. On input, the current position of the parser after the tag which identified the node ("<?", "<!- -", etc.) On output, it must be after the last character of the node.
[in]parentCandidate parent node, for information only, do not modify. Can be null.
Returns
True on success, false on error.

Implements ts::xml::Node.

◆ lineNumber()

size_t ts::xml::Node::lineNumber ( ) const
inlineinherited

Get the line number in input document.

Returns
The line number in input document, zero if the node was built programmatically.

◆ clear()

virtual void ts::xml::Node::clear ( )
virtualinherited

Clear the content of the node.

The node becomes empty but remains attached to its parent.

Reimplemented in ts::xml::Element.

◆ reparent()

void ts::xml::Node::reparent ( Node newParent,
bool  last = true 
)
inherited

Attach the node to a new parent.

The node is first detached from its previous parent.

Parameters
[in,out]newParentNew parent. If zero, the node becomes orphan. In that case, the node will no longer be freed by its parent and must be explicitly deleted.
[in]lastIf true, the child is added at the end of the list of children. If false, it is added at the beginning.

◆ moveBefore()

void ts::xml::Node::moveBefore ( Node newSibling)
inlineinherited

Move the node before another node, potentially to a new parent.

Parameters
[in,out]newSiblingA new sibling. The node will be moved before this one.

◆ moveAfter()

void ts::xml::Node::moveAfter ( Node newSibling)
inlineinherited

Move the node after another node, potentially to a new parent.

Parameters
[in,out]newSiblingA new sibling. The node will be moved after this one.

◆ move()

void ts::xml::Node::move ( Node newSibling,
bool  before 
)
inherited

Move the node before or after another node, potentially to a new parent.

Parameters
[in,out]newSiblingA new sibling. The node will be moved before or after this one.
[in]beforeIf true, move the node before newSibling, after it otherwise.

◆ parent() [1/2]

const Node * ts::xml::Node::parent ( ) const
inlineinherited

Get the parent's node.

Returns
The parent's node or a null pointer if this is a top-level document.

◆ parent() [2/2]

Node * ts::xml::Node::parent ( )
inlineinherited

Get the parent's node.

Returns
The parent's node or zero if this is a top-level document.

◆ document() [1/2]

const Document * ts::xml::Node::document ( ) const
inlineinherited

Get the document into which the node is located.

Returns
The node's document or zero if there is no document.

◆ document() [2/2]

Document * ts::xml::Node::document ( )
inherited

Get the document into which the node is located.

Returns
The node's document or zero if there is no document.

◆ depth()

size_t ts::xml::Node::depth ( ) const
inherited

Get the depth of an XML element.

Returns
The depth of the element, ie. the number of ancestors.

◆ preserveSpace()

bool ts::xml::Node::preserveSpace ( ) const
inherited

Check if the node or one of its ancestors has attribute xml:space="preserve".

Returns
True if spaces shall be preserved.

◆ hasChildren()

bool ts::xml::Node::hasChildren ( ) const
inlineinherited

Check if the node has children.

Returns
True if the node has children.

◆ childrenCount()

size_t ts::xml::Node::childrenCount ( ) const
inlineinherited

Get the number of children.

Returns
The number of children.

◆ firstChild() [1/2]

const Node * ts::xml::Node::firstChild ( ) const
inlineinherited

Get the first child of a node.

Returns
The first child of the node or zero if there is no children.

◆ firstChild() [2/2]

Node * ts::xml::Node::firstChild ( )
inlineinherited

Get the first child of a node.

Returns
The first child of the node or zero if there is no children.

◆ lastChild() [1/2]

const Node * ts::xml::Node::lastChild ( ) const
inlineinherited

Get the last child.

Returns
The last child or zero if there is none.

◆ lastChild() [2/2]

Node * ts::xml::Node::lastChild ( )
inlineinherited

Get the last child.

Returns
The last child or nullptr if there is none.

◆ nextSibling() [1/2]

const Node * ts::xml::Node::nextSibling ( ) const
inlineinherited

Get the next sibling node.

Returns
The next sibling node or zero if the node is the last child.

◆ nextSibling() [2/2]

Node * ts::xml::Node::nextSibling ( )
inherited

Get the next sibling node.

Returns
The next sibling node or zero if the node is the last child.

◆ previousSibling() [1/2]

const Node * ts::xml::Node::previousSibling ( ) const
inlineinherited

Get the previous sibling node.

Returns
The previous sibling node or zero if the node is the first child.

◆ previousSibling() [2/2]

Node * ts::xml::Node::previousSibling ( )
inherited

Get the previous sibling node.

Returns
The previous sibling node or zero if the node is the first child.

◆ firstChildElement() [1/2]

const Element * ts::xml::Node::firstChildElement ( ) const
inlineinherited

Get the first child Element of a node.

Returns
The first child Element of the node or zero if there is no child Element.

◆ firstChildElement() [2/2]

Element * ts::xml::Node::firstChildElement ( )
inherited

Get the first child Element of a node.

Returns
The first child Element of the node or zero if there is no child Element.

◆ nextSiblingElement() [1/2]

const Element * ts::xml::Node::nextSiblingElement ( ) const
inlineinherited

Find the next sibling element.

Returns
Element address or zero if not found.

◆ nextSiblingElement() [2/2]

Element * ts::xml::Node::nextSiblingElement ( )
inherited

Find the next sibling element.

Returns
Element address or zero if not found.

◆ previousSiblingElement() [1/2]

const Element * ts::xml::Node::previousSiblingElement ( ) const
inlineinherited

Find the previous sibling element.

Returns
Element address or zero if not found.

◆ previousSiblingElement() [2/2]

Element * ts::xml::Node::previousSiblingElement ( )
inherited

Find the previous sibling element.

Returns
Element address or zero if not found.

◆ value()

const UString & ts::xml::Node::value ( ) const
inlineinherited

Get the value of the node.

The semantic of the value depends on the node subclass:

  • Comment: Content of the comment, without "<!--" and "-->".
  • Declaration: Content of the declaration, without "<?" and "?>".
  • Document: Empty.
  • Element: Name of the element.
  • Text: Text content of the element, including spaces and new-lines.
  • Unknown: Content of the tag, probably an uninterpreted DTD.
Returns
A constant reference to the node value, as a string.

◆ setValue()

void ts::xml::Node::setValue ( const UString value)
inlineinherited

Set the value of the node.

Parameters
[in]valueNew value to set.
See also
value()

◆ removeComments()

void ts::xml::Node::removeComments ( bool  recurse)
inherited

Remove all comments in the XML node.

Parameters
[in]recurseIf true, apply recursively to all children nodes.

◆ oneLiner()

virtual UString ts::xml::Node::oneLiner ( ) const
virtualinherited

Format the value as a one-liner XML text.

Returns
The formatted one-line XML text.

◆ stickyOutput()

virtual bool ts::xml::Node::stickyOutput ( ) const
virtualinherited

Check if the text shall be stuck to other elements in XML output.

Returns
True if the text shall be stuck to other elements. False by default.

Reimplemented in ts::xml::Text.

◆ debug()

UString ts::xml::Node::debug ( ) const
inherited

Build a debug string for the node.

Returns
A debug string for the node.

◆ report()

Report & ts::xml::Node::report ( ) const
inlineinherited

Get a reference to the report object for the XML node.

Returns
A reference to the report object for the XML node.

◆ identifyNextNode()

Node * ts::xml::Node::identifyNextNode ( TextParser parser)
protectedinherited

Identify the next token in the document.

Parameters
[in,out]parserThe document parser.
Returns
A new node or zero either at end of document or before a "</" sequence. The returned node, when not zero, is not yet linked to its parent and siblings. When the returned node is not zero, the parser is located after the tag which identified the node ("<?", "<!- -", etc.)

◆ parseChildren()

virtual bool ts::xml::Node::parseChildren ( TextParser parser)
protectedvirtualinherited

Parse children nodes and add them to the node.

Stop either at end of document or before a "</" sequence or on error.

Parameters
[in,out]parserThe document parser.
Returns
True on success, false on error.

◆ setPreserveSpace()

void ts::xml::Node::setPreserveSpace ( bool  on)
inlineprotectedinherited

Called by the subclass when its spaces shall be preserved.

Typically called when xml:space="preserve" is encountered.

Parameters
[in]onTrue is spaces shall be preserved.

◆ ringAlone()

bool ts::RingNode::ringAlone ( ) const
inlineinherited

Check if the node is alone in its own ring.

Returns
True if the node is alone in its own ring.

◆ ringInsertAfter()

void ts::RingNode::ringInsertAfter ( RingNode o)
inherited

Insert this object in a ring after the specified node.

Parameters
[in]oA node of a ring. This object is inserted after o in the ring.

◆ ringInsertBefore()

void ts::RingNode::ringInsertBefore ( RingNode o)
inherited

Insert this object in a ring before the specified node.

Parameters
[in]oA node of a ring. This object is inserted before o in the ring.

◆ ringSwap()

void ts::RingNode::ringSwap ( RingNode o)
inherited

Swap this object and another one in their rings.

If the two objects belong to the same ring, their positions are swapped. If they belong to distinct rings, they also move to each other's ring.

Parameters
[in]oThe node to swap with.

◆ ringNext() [1/2]

template<typename T >
T * ts::RingNode::ringNext ( )
inlineinherited

Get the next node in the ring.

Template Parameters
TA superclass of RingNode, the expected type of the next object in the ring.
Returns
Address of the next node in the ring or zero if the next node is not a subclass of T.

◆ ringNext() [2/2]

template<typename T >
const T * ts::RingNode::ringNext ( ) const
inlineinherited

Get the next node in the ring.

Template Parameters
TA superclass of RingNode, the expected type of the next object in the ring.
Returns
Address of the next node in the ring or zero if the next node is not a subclass of T.

◆ ringPrevious() [1/2]

template<typename T >
T * ts::RingNode::ringPrevious ( )
inlineinherited

Get the previous node in the ring.

Template Parameters
TA superclass of RingNode, the expected type of the previous object in the ring.
Returns
Address of the previous node in the ring or zero if the previous node is not a subclass of T.

◆ ringPrevious() [2/2]

template<typename T >
const T * ts::RingNode::ringPrevious ( ) const
inlineinherited

Get the previous node in the ring.

Template Parameters
TA superclass of RingNode, the expected type of the previous object in the ring.
Returns
Address of the previous node in the ring or zero if the previous node is not a subclass of T.

◆ ringSize()

size_t ts::RingNode::ringSize ( ) const
inherited

Count the number of element in the ring.

Warning: This method has a linear response time, avoid using it when possible.

Returns
The number of nodes in the ring.

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