Boost C++ Libraries Home Libraries People FAQ More

PrevUpHomeNext

Struct template ordered_inserter

boost::time_series::ordered_inserter — A wrapper for an OrderedInserter which itself satisfies the OrderedInserter concept and that provides some conveniences for efficiently populating a Mutable_TimeSeries.

Synopsis

// In header: <boost/time_series/ordered_inserter.hpp>

template<typename Series> 
struct ordered_inserter {
  // types
  typedef concepts::Mutable_TimeSeries< Series > series_concept;
  typedef series_concept::value_type             value_type;    
  typedef series_concept::run_type               run_type;      
  typedef series_concept::offset_type            offset_type;   
  typedef series_concept::ordered_inserter_type  inserter_type; 

  // construct/copy/destruct
  ordered_inserter(Series &);
  ordered_inserter(Series &, offset_type);
  ordered_inserter& operator=(ordered_inserter const &);
  ordered_inserter& operator=(value_type const &);
  template<typename Value, typename Offset> 
    ordered_inserter& operator=(std::pair< Value, Offset > const &);
  template<typename Value, typename Offset> 
    ordered_inserter& operator=(compressed_pair< Value, Offset > const &);
  template<typename Value, typename Offset> 
    ordered_inserter& operator=(tuple< Value, Offset > const &);
  template<typename Value, typename Offset> 
    ordered_inserter& operator=(tuple< Value, Offset, Offset > const &);

  // public member functions
  ordered_inserter & operator*() ;
  ordered_inserter & operator++() ;
  ordered_inserter & operator++(int) ;
  ordered_inserter & operator()(value_type const &) ;
  ordered_inserter & operator()(value_type const &, offset_type) ;
  ordered_inserter & operator()(value_type const &, offset_type, offset_type) ;
  void commit() ;
  offset_type offset_;  // For exposition only. 
  inserter_type inserter_;  // For exposition only. 
};

Description

A wrapper for an OrderedInserter which itself satisfies the OrderedInserter concept and that provides some conveniences for efficiently populating a Mutable_TimeSeries.

Since ordered_inserter<> satisfies the OrderedInserter concept, it can be used anywhere an OrderedInserter is required; for example, when calling any of the RangeRunStorage algorithms.

An ordered_inserter<> also overloads the function call operator so that runs can be inserted using the following convenient syntax: inserter(value, offset, end_offset). The return value of the predeeding call is a reference to the inserter object, so successive insertion operations can be chained.

An ordered_inserter<> is also a valid STL output iterator.

ordered_inserter public construct/copy/destruct

  1. ordered_inserter(Series & series);

    Initializes this->inserter_ to range_run_storage::ordered_inserter(series)

    Parameters:
    series

    The series into which this inserter writes.

    Postconditions:

    this->offset_ == -inf

    Notes:

    implicit

  2. ordered_inserter(Series & series, offset_type offset);

    Initializes this->inserter_ to range_run_storage::ordered_inserter(series)

    Parameters:
    offset

    The offset of the first run written into this inserter, if the offset of that run is not otherwise specified.

    series

    The series into which this inserter writes.

    Postconditions:

    this->offset_ == offset

  3. ordered_inserter& operator=(ordered_inserter const &);

    Returns:

    *this

  4. ordered_inserter& operator=(value_type const & value);

    Same as (*this)(value)

    Returns:

    *this

  5. template<typename Value, typename Offset> 
      ordered_inserter& operator=(std::pair< Value, Offset > const & tup);

    Same as (*this)(tup.first, tup.second)

    Requires:

    Value is implicitly convertible to value_type

    Offset is implicitly convertible to offset_type

    Returns:

    *this

  6. template<typename Value, typename Offset> 
      ordered_inserter& operator=(compressed_pair< Value, Offset > const & tup);

    Same as (*this)(tup.first(), tup.second())

    Requires:

    Value is implicitly convertible to value_type

    Offset is implicitly convertible to offset_type

    Returns:

    *this

  7. template<typename Value, typename Offset> 
      ordered_inserter& operator=(tuple< Value, Offset > const & tup);

    Same as (*this)(get<0>(tup), get<1>(tup))

    Requires:

    Value is implicitly convertible to value_type

    Offset is implicitly convertible to offset_type

    Returns:

    *this

  8. template<typename Value, typename Offset> 
      ordered_inserter& operator=(tuple< Value, Offset, Offset > const & tup);

    Same as (*this)(get<0>(tup), get<1>(tup), get<2>(tup))

    Requires:

    Value is implicitly convertible to value_type

    Offset is implicitly convertible to offset_type

    Returns:

    *this

ordered_inserter public member functions

  1. ordered_inserter & operator*() ;

    Returns:

    *this

  2. ordered_inserter & operator++() ;

    Returns:

    *this

  3. ordered_inserter & operator++(int) ;

    Returns:

    *this

  4. ordered_inserter & operator()(value_type const & value) ;

    Calls range_run_storage::set_at(this->inserter_, run_type(this->offset_, this->offset_ + 1), value)

    Requires:

    -inf != this->offset_

    Postconditions:

    this->offset_ is greater by 1.

    Returns:

    *this

  5. ordered_inserter & operator()(value_type const & value, offset_type offset) ;

    Calls range_run_storage::set_at(this->inserter_, run_type(offset, offset + 1), value)

    Requires:

    offset >= this->offset_

    Postconditions:

    this->offset_ == offset + 1

    Returns:

    *this

  6. ordered_inserter & 
    operator()(value_type const & value, offset_type offset, offset_type endoff) ;

    Calls range_run_storage::set_at(this->inserter_, std::make_pair(offset, endoff), value)

    Requires:

    offset >= this->offset_

    Postconditions:

    this->offset_ == endoff

    Returns:

    *this

  7. void commit() ;

    Calls range_run_storage::commit(this->inserter_)


PrevUpHomeNext