Arcane  4.1.12.0
Developer documentation
Loading...
Searching...
No Matches
Arcane::ParameterOptionAddr Class Reference

Class representing a data set option address. This address must be in the form: "tag/tag[index]/tag" Address parts without an index will have the default index (=1). More...

#include <arcane/utils/internal/ParameterOption.h>

Collaboration diagram for Arcane::ParameterOptionAddr:

Public Member Functions

 ParameterOptionAddr (StringView addr_str_view)
 Constructor.
void addAddrPart (ParameterOptionAddrPart *part)
 Method allowing a part to be added to the end of the current address.
ParameterOptionAddrPartaddrPart (const Integer index_of_part) const
 Method allowing a part of the address to be retrieved. If the address ends with an ANY_TAG[ANY_INDEX], all indices given in the parameter greater than the number of parts of the address will return the last element of the address ("ANY_TAG[ANY_INDEX]").
ParameterOptionAddrPartlastAddrPart () const
Integer nbAddrPart () const
 Method allowing the number of parts of the address to be retrieved. Parts equal to "ANY_TAG[ANY_INDEX]" are counted.
bool getIndexInAddr (const ParameterOptionAddr &addr_with_get_index, ArrayView< Integer > indexes) const
 Method allowing one or more indices to be retrieved in the address.
Integer nbIndexToGetInAddr () const
 Method allowing the number of "GET_INDEX" in the address to be known.
bool operator== (const ParameterOptionAddr &other) const
 Equality operator. This operator takes into account ANY_TAG / ANY_INDEX. The address "aaa[1]/bbb[2]/ANY_TAG[ANY_INDEX]" will be equal to the address "aaa[1]/bbb[2]/ccc[5]/ddd[7]" or to the address "aaa[1]/bbb[ANY_INDEX]/ccc[5]/ddd[7]" or to the address "aaa[1]/bbb[2]" but not to the address "aaa[1]".
bool operator!= (const ParameterOptionAddr &other) const

Private Attributes

UniqueArray< Ref< ParameterOptionAddrPart > > m_parts

Detailed Description

Class representing a data set option address. This address must be in the form: "tag/tag[index]/tag" Address parts without an index will have the default index (=1).

This address must comply with certain rules:

  • it must not be empty,
  • it must not represent all options ("/"),
  • its tags can be empty if the index is empty (see below),
  • the special index ANY_INDEX can only be present if the tag is not empty,
  • the address can end with an attribute ("\@name"),
  • the address given to the constructor cannot end with an ANY_TAG (but ANY_TAG can be added later with the addAddrPart() method),

In a character string:

  • the pattern ANY_TAG[ANY_INDEX] can be defined with "//": -> "tag/tag//tag" will be converted as: "tag[1]/tag[1]/ANY_TAG[ANY_INDEX]/tag[1]".
  • the ANY_INDEX can be defined with an empty index "[]": -> "tag/tag[]/\@attr" will be converted as: "tag[1]/tag[ANY_INDEX]/\@attr[1]", -> the pattern "tag/[]/tag" is forbidden.

Definition at line 128 of file ParameterOption.h.

Constructor & Destructor Documentation

◆ ParameterOptionAddr()

Arcane::ParameterOptionAddr::ParameterOptionAddr ( StringView addr_str_view)
explicit

Constructor.

Parameters
addr_str_viewThe address to convert.

Definition at line 150 of file ParameterOption.cc.

References ARCANE_FATAL, Arcane::StringView::bytes(), Arcane::makeRef(), Arcane::SpanImpl< T, SizeType, Extent >::size(), and Arcane::StringView::subView().

Referenced by getIndexInAddr(), and operator==().

Here is the call graph for this function:
Here is the caller graph for this function:

Member Function Documentation

◆ addAddrPart()

void Arcane::ParameterOptionAddr::addAddrPart ( ParameterOptionAddrPart * part)

Method allowing a part to be added to the end of the current address.

Parameters
partA pointer to the new part. Note that we take ownership of the object (we manage the delete).

Definition at line 241 of file ParameterOption.cc.

References Arcane::makeRef().

Referenced by Arcane::ParameterCaseOption::count(), Arcane::ParameterCaseOption::existAnyIndex(), Arcane::ParameterCaseOption::getParameterOrNull(), Arcane::ParameterCaseOption::getParameterOrNull(), Arcane::ParameterCaseOption::indexesInParam(), and Arcane::ParameterCaseOption::indexesInParam().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ addrPart()

ParameterOptionAddrPart * Arcane::ParameterOptionAddr::addrPart ( const Integer index_of_part) const

Method allowing a part of the address to be retrieved. If the address ends with an ANY_TAG[ANY_INDEX], all indices given in the parameter greater than the number of parts of the address will return the last element of the address ("ANY_TAG[ANY_INDEX]").

Parameters
index_of_partThe index of the part to retrieve.
Returns
The part of the address.

Definition at line 250 of file ParameterOption.cc.

References ARCANE_FATAL.

Referenced by getIndexInAddr(), and operator==().

Here is the caller graph for this function:

◆ getIndexInAddr()

bool Arcane::ParameterOptionAddr::getIndexInAddr ( const ParameterOptionAddr & addr_with_get_index,
ArrayView< Integer > indexes ) const

Method allowing one or more indices to be retrieved in the address.

The functioning of this method is simple. We have the following address: "aaa[1]/bbb[2]/ccc[4]/@name[1]". The address in the parameter is the following: "aaa[1]/bbb[GET_INDEX]/ccc[4]/@name[1]". The index added in the parameter view will be 2.

If the address in the parameter is: "aaa[1]/bbb[GET_INDEX]/ccc[GET_INDEX]/@name[1]". The indices added in the view will be 2 and 4.

Conversely, a "GET_INDEX" cannot be used on an "ANY_INDEX" (returns false). Example: if we have: "aaa[1]/bbb[ANY_INDEX]/ccc[4]/@name[1]". And if the address in the parameter is: "aaa[1]/bbb[GET_INDEX]/ccc[GET_INDEX]/@name[1]". The returned boolean will be false.

To get the correct size of the view, a call to the method "nbIndexToGetInAddr()" can be made.

Parameters
addr_with_get_indexThe address containing "GET_INDEX" indices.
indexes[OUT] The view where the index or indices will be added (the size must be correct).
Returns
true if the view could be filled correctly.

Definition at line 283 of file ParameterOption.cc.

References addrPart(), nbAddrPart(), nbIndexToGetInAddr(), ParameterOptionAddr(), and Arcane::ArrayView< T >::size().

Here is the call graph for this function:

◆ lastAddrPart()

ParameterOptionAddrPart * Arcane::ParameterOptionAddr::lastAddrPart ( ) const

Definition at line 265 of file ParameterOption.cc.

◆ nbAddrPart()

Integer Arcane::ParameterOptionAddr::nbAddrPart ( ) const

Method allowing the number of parts of the address to be retrieved. Parts equal to "ANY_TAG[ANY_INDEX]" are counted.

Returns
The number of parts of the address.

Definition at line 274 of file ParameterOption.cc.

Referenced by getIndexInAddr(), and operator==().

Here is the caller graph for this function:

◆ nbIndexToGetInAddr()

Integer Arcane::ParameterOptionAddr::nbIndexToGetInAddr ( ) const

Method allowing the number of "GET_INDEX" in the address to be known.

Returns
The number of "GET_INDEX".

Definition at line 306 of file ParameterOption.cc.

Referenced by getIndexInAddr(), and Arcane::ParameterOptionElementsCollection::getIndexInAddr().

Here is the caller graph for this function:

◆ operator!=()

bool Arcane::ParameterOptionAddr::operator!= ( const ParameterOptionAddr & other) const

Definition at line 349 of file ParameterOption.cc.

◆ operator==()

bool Arcane::ParameterOptionAddr::operator== ( const ParameterOptionAddr & other) const

Equality operator. This operator takes into account ANY_TAG / ANY_INDEX. The address "aaa[1]/bbb[2]/ANY_TAG[ANY_INDEX]" will be equal to the address "aaa[1]/bbb[2]/ccc[5]/ddd[7]" or to the address "aaa[1]/bbb[ANY_INDEX]/ccc[5]/ddd[7]" or to the address "aaa[1]/bbb[2]" but not to the address "aaa[1]".

Definition at line 321 of file ParameterOption.cc.

References addrPart(), Arcane::ParameterOptionAddrPart::isAny(), nbAddrPart(), and ParameterOptionAddr().

Here is the call graph for this function:

Member Data Documentation

◆ m_parts

UniqueArray<Ref<ParameterOptionAddrPart> > Arcane::ParameterOptionAddr::m_parts
private

Definition at line 220 of file ParameterOption.h.


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