Карта сайта Kansoftware
НОВОСТИУСЛУГИРЕШЕНИЯКОНТАКТЫ
Разработка программного обеспечения

Class attribute_set

Boost , Chapter 1. Boost.Log v2 , Attributes

Boost C++ Libraries

...one of the most highly regarded and expertly designed C++ library projects in the world. Herb Sutter and Andrei Alexandrescu, C++ Coding Standards

PrevUpHomeNext

Class attribute_set

boost::log::attribute_set — An attribute set class.

Synopsis

// In header: <boost/log/attributes/attribute_set.hpp>

class attribute_set {
public:
  // types
  typedef attribute_name                           key_type;         // Key type. 
  typedef attribute                                mapped_type;      // Mapped attribute type. 
  typedef std::pair< const key_type, mapped_type > value_type;       // Value type. 
  typedef value_type &                             reference;        // Reference type. 
  typedef value_type const &                       const_reference;  // Const reference type. 
  typedef value_type *                             pointer;          // Pointer type. 
  typedef value_type const *                       const_pointer;    // Const pointer type. 
  typedef std::size_t                              size_type;        // Size type. 
  typedef std::ptrdiff_t                           difference_type;  // Difference type. 
  typedef implementation_defined                   iterator;       
  typedef implementation_defined                   const_iterator; 
  // construct/copy/destruct
  attribute_set();
  attribute_set(attribute_set const &);
  attribute_set(attribute_set &&) noexcept;
  attribute_set & operator=(attribute_set) noexcept;
  ~attribute_set();
  // public member functions
  void swap(attribute_set &) noexcept;
  iterator begin() noexcept;
  iterator end() noexcept;
  const_iterator begin() const noexcept;
  const_iterator end() const noexcept;
  size_type size() const noexcept;
  bool empty() const noexcept;
  iterator find(key_type) noexcept;
  const_iterator find(key_type) const noexcept;
  size_type count(key_type) const noexcept;
  unspecified operator[](key_type) noexcept;
  mapped_type operator[](key_type) const noexcept;
  std::pair< iterator, bool > insert(key_type, mapped_type const &);
  std::pair< iterator, bool > insert(const_reference);
  template<typename FwdIteratorT> void insert(FwdIteratorT, FwdIteratorT);
  template<typename FwdIteratorT, typename OutputIteratorT> 
    void insert(FwdIteratorT, FwdIteratorT, OutputIteratorT);
  size_type erase(key_type) noexcept;
  void erase(iterator) noexcept;
  void erase(iterator, iterator) noexcept;
  void clear() noexcept;
};

Description

Набор атрибутов представляет собой ассоциативный контейнер с именем атрибута в качестве ключа и указателем на атрибут в качестве отображенного значения. Контейнер позволяет хранить только один элемент для каждого отдельного ключевого значения. В большинстве случаев набор атрибутов контейнера обеспечивает интерфейс, аналогичный std::unordered_map. Однако существуют различия в семантике оператора и ряде оптимизаций в отношении итерации. Кроме того, имена атрибутов сохраняются только для чтения attribute_name вместо std::string, что экономит память и время процессора.

attribute_set public types

  1. typedef implementation_defined iterator;

    Iterator type. Итератор соответствует двунаправленным требованиям итератора.

  2. typedef implementation_defined const_iterator;

    Constant iterator type. Итератор соответствует двунаправленным требованиям итератора с возможностями только для чтения.

attribute_set public construct/copy/destruct

  1. attribute_set;

    Конструктор по умолчанию.

    Постусловия:

    пустота() == истинно

  2. attribute_set&, что;;

    размер() && std::equal(begin(), end(), that.begin() == true

  • attribute_set(attribute_set &&, что, , за исключением ;

    Двигайтесь конструктором

  • attribute_set attribute_set, что, ;

  • , размер() && std::равный(начало(), конец(), что.begin() == истинный

  • ~attribute_set();

    Destructor. Все сохраненные ссылки на атрибуты выпускаются.

  • attribute_set public member functions

    1. voidswap(attribute_set&, что)за исключением;

      Смены двух экземпляров контейнера.

      Броски:Ничего.

    2. iterator begin();

      <<

      Возврат:

      Iterator to the first element of the container.

      [ORIG_END] -->
    3. iterator end() ;

      <<

      Возврат:

      Iterator to the after-the-last element of the container.

      [ORIG_END] -->
    4. const_iteratorbegin()не исключая ;

      Возврат:

      Constant iterator to the first element of the container.

      [ORIG_END] -->
    5. const_iterator end() const noexcept;

      Возврат:

      Constant iterator to the after-the-last element of the container.

    6. size_typesize()const;

      Возврат:

      Number of elements in the container.

      [ORIG_END] -->
    7. boolempty()const, за исключением ;

      Возврат:

      true if there are no elements in the container, false otherwise.

      [ORIG_END] -->
    8. iteratorfind(key_type key)за исключением;

      Метод находит атрибут по имени.

      Параметры:18>Параметры:

      Параметры:

      ключевой

      Имя атрибута.

      Возврат:

      Iterator to the found element or end() if the attribute with such name is not found.

    [ORIG_END] -->
  • const_iterator findkey_type key) const;

    Метод находит атрибут по имени.

    Параметры:20>

    Параметры:2>

    Параметры:

    ключевой

    Имя атрибута.

    Возврат:

    Iterator to the found element or end() if the attribute with such name is not found.

    [ORIG_END] -->
  • size_type count(key_type key) const no except;

    Способ подсчитывает количество встречающихся атрибутов в контейнере. Поскольку может быть только один атрибут с конкретным ключом, способ всегда возвращает 0 или 1.

    Параметры:

    Параметры:

    Параметры:

    ключевой

    Имя атрибута.

    Возврат:

    The number of times the attribute is found in the container.

    [ORIG_END] -->
  •  неуточненныйоператор[](ключ_типключ)за исключением;

    Комбинированный оператор поиска/вставки. Семантика оператора зависит от дальнейшего использования возвращаемой ссылки.

    • Если ссылка используется в качестве цели назначения, выражение назначения эквивалентно вставке элемента, где элемент состоит из второго аргумента оператора [] в качестве ключа и второго аргумента назначения в качестве отображенного значения.

    • Если возвращенная ссылка используется в контексте, где требуется преобразование в отображенный тип, результат преобразования эквивалентен отображенному значению, найденному со вторым аргументом оператора[] в качестве ключа, если такой элемент существует в контейнере, или по умолчанию построенное отображенное значение, если элемент не существует в контейнере.

    Параметры:

    ключевой

    Имя атрибута.

    Возврат:

    Умный опорный объект неопределенного типа.

  • mapped_typeоператорключ_типключ>констнет, кроме ;

    Параметры:24>Параметры:

    Параметры:

    ключевой

    Имя атрибута.

    Возврат:

    If an element with the corresponding attribute name is found in the container, its mapped value is returned. Otherwise a default-constructed mapped value is returned.

    [ORIG_END] -->
  • std::iterator,  bool key_type,  mapped_type,  const &;;;

    Параметры:Параметры:

    Параметры:

    data

    Pointer to the attribute. Must not be NULL.

    key

    Имя атрибута.

    Возврат:

    A pair of values. If second is true, the insertion succeeded and the first component points to the inserted element. Otherwise the first component points to the element that prevents insertion.

  • [ORIG_END] -->
  • std::iterator,  bool > inertconst_reference значение ;;

    Параметры:

    Параметры:

    Параметры:

    value

    An element to be inserted.

    Возврат:

    A pair of values. If second is true, the insertion succeeded and the first component points to the inserted element. Otherwise the first component points to the element that prevents insertion.

    [ORIG_END] -->
  • template<typename FwdIteratorT> voidinsert(FwdIteratorTFwdIteratorT end;

    Массовая вставка метод.

    Параметры:

    Параметры:

    Параметры:

    begin

    A forward iterator that points to the first element to be inserted.

    end

    A forward iterator that points to the after-the-last element to be inserted.

    [ORIG_END] -->
  • templatetypename typename OutputIteratorT> voidinsert,FwdIteratorT end, OutputIteratorT out;

    Параметр:

    <-- [ORIG_BEGIN]

    Параметры:

    Параметры:

    begin

    A forward iterator that points to the first element to be inserted.

    end

    A forward iterator that points to the after-the-last element to be inserted.

    out

    An output iterator that receives results of insertion of the elements

    [ORIG_END] -->
  • Параметры:

    key

    Атрибут.

    Почтовые условия:

    Все итераторы к стертым элементам становятся недействительными.

    Возвращение:

    Количество стертых элементов

    Параметры:

    ключевой

    Имя атрибута.

    Postconditions:

    All iterators to the erased elements become invalid.

    Возврат:

    Tne number of erased elements

    [ORIG_END] -->
  • void erase(iterator it) noexcept;

    The method erases the specified attribute

    Параметры:

    it

    A valid iterator to the element to be erased.

    Postconditions:

    All iterators to the erased element become invalid.

    Возврат:

    Tne number of erased elements

  • Параметры:

    begin

    Итератор, который указывает на первый элемент, который будет стерт.

    end

    Итератор, указывающий на после-последний элемент, который должен быть стерт.

    Требования:

    end доступен из begin с ограниченным количеством наклонностей.

    Почтовые условия:

    Все итераторы к стертым элементам становятся недействительными.

    Параметры:

    begin

    An iterator that points to the first element to be erased.

    end

    An iterator that points to the after-the-last element to be erased.

    Requires:

    end is reachable from begin with a finite number of increments.

    Postconditions:

    All iterators to the erased elements become invalid.

    [ORIG_END] -->
  • voidclear;

    Способ удаляет все элементы из контейнера

    Постусловия:

    empty() == true


  • PrevUpHomeNext

    Статья Class attribute_set раздела Chapter 1. Boost.Log v2 Attributes может быть полезна для разработчиков на c++ и boost.




    Материалы статей собраны из открытых источников, владелец сайта не претендует на авторство. Там где авторство установить не удалось, материал подаётся без имени автора. В случае если Вы считаете, что Ваши права нарушены, пожалуйста, свяжитесь с владельцем сайта.



    :: Главная :: Attributes ::


    реклама


    ©KANSoftWare (разработка программного обеспечения, создание программ, создание интерактивных сайтов), 2007
    Top.Mail.Ru

    Время компиляции файла: 2024-08-30 11:47:00
    2025-05-20 03:09:51/0.0087308883666992/1