TrinityCore
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
google::protobuf::RepeatedField< Element > Singleton Reference

#include <message.h>

Public Types

typedef Element * iterator
 
typedef const Element * const_iterator
 
typedef Element value_type
 
typedef value_typereference
 
typedef const value_typeconst_reference
 
typedef value_typepointer
 
typedef const value_typeconst_pointer
 
typedef int size_type
 
typedef ptrdiff_t difference_type
 
typedef std::reverse_iterator
< const_iterator
const_reverse_iterator
 
typedef std::reverse_iterator
< iterator
reverse_iterator
 

Public Member Functions

 RepeatedField ()
 
 RepeatedField (const RepeatedField &other)
 
template<typename Iter >
 RepeatedField (Iter begin, const Iter &end)
 
 ~RepeatedField ()
 
RepeatedFieldoperator= (const RepeatedField &other)
 
bool empty () const
 
int size () const
 
const Element & Get (int index) const
 
Element * Mutable (int index)
 
void Set (int index, const Element &value)
 
void Add (const Element &value)
 
Element * Add ()
 
void RemoveLast ()
 
void ExtractSubrange (int start, int num, Element *elements)
 
void Clear ()
 
void MergeFrom (const RepeatedField &other)
 
void CopyFrom (const RepeatedField &other)
 
void Reserve (int new_size)
 
void Truncate (int new_size)
 
void AddAlreadyReserved (const Element &value)
 
Element * AddAlreadyReserved ()
 
int Capacity () const
 
void Resize (int new_size, const Element &value)
 
Element * mutable_data ()
 
const Element * data () const
 
void Swap (RepeatedField *other)
 
void SwapElements (int index1, int index2)
 
iterator begin ()
 
const_iterator begin () const
 
iterator end ()
 
const_iterator end () const
 
reverse_iterator rbegin ()
 
const_reverse_iterator rbegin () const
 
reverse_iterator rend ()
 
const_reverse_iterator rend () const
 
int SpaceUsedExcludingSelf () const
 

Private Member Functions

void MoveArray (Element to[], Element from[], int size)
 
void CopyArray (Element to[], const Element from[], int size)
 

Private Attributes

Element * elements_
 
int current_size_
 
int total_size_
 

Static Private Attributes

static const int kInitialSize = 0
 

Member Typedef Documentation

template<typename Element>
typedef const Element* google::protobuf::RepeatedField< Element >::const_iterator
template<typename Element>
typedef const value_type* google::protobuf::RepeatedField< Element >::const_pointer
template<typename Element>
typedef const value_type& google::protobuf::RepeatedField< Element >::const_reference
template<typename Element>
typedef std::reverse_iterator<const_iterator> google::protobuf::RepeatedField< Element >::const_reverse_iterator
template<typename Element>
typedef ptrdiff_t google::protobuf::RepeatedField< Element >::difference_type
template<typename Element>
typedef Element* google::protobuf::RepeatedField< Element >::iterator
template<typename Element>
typedef value_type* google::protobuf::RepeatedField< Element >::pointer
template<typename Element>
typedef value_type& google::protobuf::RepeatedField< Element >::reference
template<typename Element>
typedef std::reverse_iterator<iterator> google::protobuf::RepeatedField< Element >::reverse_iterator
template<typename Element>
typedef int google::protobuf::RepeatedField< Element >::size_type
template<typename Element>
typedef Element google::protobuf::RepeatedField< Element >::value_type

Constructor & Destructor Documentation

template<typename Element >
google::protobuf::RepeatedField< Element >::RepeatedField ( )
inline
580  : elements_(NULL),
581  current_size_(0),
583 }
int total_size_
Definition: repeated_field.h:202
arena_t NULL
Definition: jemalloc_internal.h:624
Element * elements_
Definition: repeated_field.h:200
int current_size_
Definition: repeated_field.h:201
static const int kInitialSize
Definition: repeated_field.h:198
template<typename Element >
google::protobuf::RepeatedField< Element >::RepeatedField ( const RepeatedField< Element > &  other)
inline
587  : elements_(NULL),
588  current_size_(0),
590  CopyFrom(other);
591 }
int total_size_
Definition: repeated_field.h:202
arena_t NULL
Definition: jemalloc_internal.h:624
Element * elements_
Definition: repeated_field.h:200
int current_size_
Definition: repeated_field.h:201
static const int kInitialSize
Definition: repeated_field.h:198
void CopyFrom(const RepeatedField &other)
Definition: repeated_field.h:738

+ Here is the call graph for this function:

template<typename Element >
template<typename Iter >
google::protobuf::RepeatedField< Element >::RepeatedField ( Iter  begin,
const Iter &  end 
)
inline
596  : elements_(NULL),
597  current_size_(0),
599  int reserve = internal::CalculateReserve(begin, end);
600  if (reserve != -1) {
601  Reserve(reserve);
602  for (; begin != end; ++begin) {
604  }
605  } else {
606  for (; begin != end; ++begin) {
607  Add(*begin);
608  }
609  }
610 }
Element * Add()
Definition: repeated_field.h:690
int total_size_
Definition: repeated_field.h:202
arena_t NULL
Definition: jemalloc_internal.h:624
Element * elements_
Definition: repeated_field.h:200
int current_size_
Definition: repeated_field.h:201
iterator end()
Definition: repeated_field.h:789
static const int kInitialSize
Definition: repeated_field.h:198
void Reserve(int new_size)
Definition: repeated_field.h:806
Element * AddAlreadyReserved()
Definition: repeated_field.h:647
int CalculateReserve(Iter begin, Iter end, std::forward_iterator_tag)
Definition: repeated_field.h:81
iterator begin()
Definition: repeated_field.h:779

+ Here is the call graph for this function:

template<typename Element >
google::protobuf::RepeatedField< Element >::~RepeatedField ( )
613  {
614  delete [] elements_;
615 }
Element * elements_
Definition: repeated_field.h:200

Member Function Documentation

template<typename Element>
void google::protobuf::RepeatedField< Element >::Add ( const Element &  value)
inline
684  {
687 }
int total_size_
Definition: repeated_field.h:202
Element * elements_
Definition: repeated_field.h:200
int current_size_
Definition: repeated_field.h:201
void Reserve(int new_size)
Definition: repeated_field.h:806
const FieldDescriptor value
Definition: descriptor.h:1522

+ Here is the caller graph for this function:

template<typename Element>
Element * google::protobuf::RepeatedField< Element >::Add ( )
inline
690  {
692  return &elements_[current_size_++];
693 }
int total_size_
Definition: repeated_field.h:202
Element * elements_
Definition: repeated_field.h:200
int current_size_
Definition: repeated_field.h:201
void Reserve(int new_size)
Definition: repeated_field.h:806

+ Here is the caller graph for this function:

template<typename Element>
void google::protobuf::RepeatedField< Element >::AddAlreadyReserved ( const Element &  value)
inline
641  {
644 }
Element * elements_
Definition: repeated_field.h:200
int size() const
Definition: repeated_field.h:631
int current_size_
Definition: repeated_field.h:201
#define GOOGLE_DCHECK_LT
Definition: common.h:755
int Capacity() const
Definition: repeated_field.h:636
const FieldDescriptor value
Definition: descriptor.h:1522

+ Here is the caller graph for this function:

template<typename Element>
Element * google::protobuf::RepeatedField< Element >::AddAlreadyReserved ( )
inline
647  {
649  return &elements_[current_size_++];
650 }
Element * elements_
Definition: repeated_field.h:200
int size() const
Definition: repeated_field.h:631
int current_size_
Definition: repeated_field.h:201
#define GOOGLE_DCHECK_LT
Definition: common.h:755
int Capacity() const
Definition: repeated_field.h:636

+ Here is the caller graph for this function:

template<typename Element >
RepeatedField< Element >::iterator google::protobuf::RepeatedField< Element >::begin ( )
inline
779  {
780  return elements_;
781 }
Element * elements_
Definition: repeated_field.h:200

+ Here is the caller graph for this function:

template<typename Element >
RepeatedField< Element >::const_iterator google::protobuf::RepeatedField< Element >::begin ( ) const
inline
784  {
785  return elements_;
786 }
Element * elements_
Definition: repeated_field.h:200
template<typename Element >
int google::protobuf::RepeatedField< Element >::Capacity ( ) const
inline
636  {
637  return total_size_;
638 }
int total_size_
Definition: repeated_field.h:202

+ Here is the caller graph for this function:

template<typename Element >
void google::protobuf::RepeatedField< Element >::Clear ( )
inline
723  {
724  current_size_ = 0;
725 }
int current_size_
Definition: repeated_field.h:201

+ Here is the caller graph for this function:

template<typename Element>
void google::protobuf::RepeatedField< Element >::CopyArray ( Element  to[],
const Element  from[],
int  size 
)
inlineprivate
833  {
834  internal::ElementCopier<Element>()(to, from, array_size);
835 }
template<typename Element >
void google::protobuf::RepeatedField< Element >::CopyFrom ( const RepeatedField< Element > &  other)
inline
738  {
739  if (&other == this) return;
740  Clear();
741  MergeFrom(other);
742 }
void Clear()
Definition: repeated_field.h:723
void MergeFrom(const RepeatedField &other)
Definition: repeated_field.h:728

+ Here is the caller graph for this function:

template<typename Element >
const Element * google::protobuf::RepeatedField< Element >::data ( ) const
inline
750  {
751  return elements_;
752 }
Element * elements_
Definition: repeated_field.h:200
template<typename Element >
bool google::protobuf::RepeatedField< Element >::empty ( ) const
inline
626  {
627  return current_size_ == 0;
628 }
int current_size_
Definition: repeated_field.h:201
template<typename Element >
RepeatedField< Element >::iterator google::protobuf::RepeatedField< Element >::end ( )
inline
789  {
790  return elements_ + current_size_;
791 }
Element * elements_
Definition: repeated_field.h:200
int current_size_
Definition: repeated_field.h:201

+ Here is the caller graph for this function:

template<typename Element >
RepeatedField< Element >::const_iterator google::protobuf::RepeatedField< Element >::end ( ) const
inline
794  {
795  return elements_ + current_size_;
796 }
Element * elements_
Definition: repeated_field.h:200
int current_size_
Definition: repeated_field.h:201
template<typename Element>
void google::protobuf::RepeatedField< Element >::ExtractSubrange ( int  start,
int  num,
Element *  elements 
)
703  {
704  GOOGLE_DCHECK_GE(start, 0);
705  GOOGLE_DCHECK_GE(num, 0);
706  GOOGLE_DCHECK_LE(start + num, this->size());
707 
708  // Save the values of the removed elements if requested.
709  if (elements != NULL) {
710  for (int i = 0; i < num; ++i)
711  elements[i] = this->Get(i + start);
712  }
713 
714  // Slide remaining elements down to fill the gap.
715  if (num > 0) {
716  for (int i = start + num; i < this->size(); ++i)
717  this->Set(i - num, this->Get(i));
718  this->Truncate(this->size() - num);
719  }
720 }
arena_t NULL
Definition: jemalloc_internal.h:624
void Truncate(int new_size)
Definition: repeated_field.h:820
int size() const
Definition: repeated_field.h:631
#define GOOGLE_DCHECK_GE
Definition: common.h:758
#define GOOGLE_DCHECK_LE
Definition: common.h:756
const Element & Get(int index) const
Definition: repeated_field.h:663
void Set(int index, const Element &value)
Definition: repeated_field.h:677
template<typename Element >
const Element & google::protobuf::RepeatedField< Element >::Get ( int  index) const
inline
663  {
664  GOOGLE_DCHECK_GE(index, 0);
665  GOOGLE_DCHECK_LT(index, size());
666  return elements_[index];
667 }
Element * elements_
Definition: repeated_field.h:200
int size() const
Definition: repeated_field.h:631
#define GOOGLE_DCHECK_GE
Definition: common.h:758
#define GOOGLE_DCHECK_LT
Definition: common.h:755

+ Here is the caller graph for this function:

template<typename Element >
void google::protobuf::RepeatedField< Element >::MergeFrom ( const RepeatedField< Element > &  other)
inline
728  {
729  GOOGLE_CHECK_NE(&other, this);
730  if (other.current_size_ != 0) {
731  Reserve(current_size_ + other.current_size_);
732  CopyArray(elements_ + current_size_, other.elements_, other.current_size_);
733  current_size_ += other.current_size_;
734  }
735 }
Element * elements_
Definition: repeated_field.h:200
void CopyArray(Element to[], const Element from[], int size)
Definition: repeated_field.h:832
int current_size_
Definition: repeated_field.h:201
#define GOOGLE_CHECK_NE(A, B)
Definition: common.h:717
void Reserve(int new_size)
Definition: repeated_field.h:806
template<typename Element>
void google::protobuf::RepeatedField< Element >::MoveArray ( Element  to[],
Element  from[],
int  size 
)
inlineprivate
827  {
828  CopyArray(to, from, array_size);
829 }
void CopyArray(Element to[], const Element from[], int size)
Definition: repeated_field.h:832
template<typename Element >
Element * google::protobuf::RepeatedField< Element >::Mutable ( int  index)
inline
670  {
671  GOOGLE_DCHECK_GE(index, 0);
672  GOOGLE_DCHECK_LT(index, size());
673  return elements_ + index;
674 }
Element * elements_
Definition: repeated_field.h:200
int size() const
Definition: repeated_field.h:631
#define GOOGLE_DCHECK_GE
Definition: common.h:758
#define GOOGLE_DCHECK_LT
Definition: common.h:755
template<typename Element >
Element * google::protobuf::RepeatedField< Element >::mutable_data ( )
inline
745  {
746  return elements_;
747 }
Element * elements_
Definition: repeated_field.h:200

+ Here is the caller graph for this function:

template<typename Element >
RepeatedField< Element > & google::protobuf::RepeatedField< Element >::operator= ( const RepeatedField< Element > &  other)
inline
619  {
620  if (this != &other)
621  CopyFrom(other);
622  return *this;
623 }
void CopyFrom(const RepeatedField &other)
Definition: repeated_field.h:738
template<typename Element>
reverse_iterator google::protobuf::RepeatedField< Element >::rbegin ( )
inline
180  {
181  return reverse_iterator(end());
182  }
std::reverse_iterator< iterator > reverse_iterator
Definition: repeated_field.h:179
iterator end()
Definition: repeated_field.h:789
template<typename Element>
const_reverse_iterator google::protobuf::RepeatedField< Element >::rbegin ( ) const
inline
183  {
184  return const_reverse_iterator(end());
185  }
iterator end()
Definition: repeated_field.h:789
std::reverse_iterator< const_iterator > const_reverse_iterator
Definition: repeated_field.h:178
template<typename Element >
void google::protobuf::RepeatedField< Element >::RemoveLast ( )
inline
696  {
698  --current_size_;
699 }
int current_size_
Definition: repeated_field.h:201
#define GOOGLE_DCHECK_GT
Definition: common.h:757
template<typename Element>
reverse_iterator google::protobuf::RepeatedField< Element >::rend ( )
inline
186  {
187  return reverse_iterator(begin());
188  }
std::reverse_iterator< iterator > reverse_iterator
Definition: repeated_field.h:179
iterator begin()
Definition: repeated_field.h:779
template<typename Element>
const_reverse_iterator google::protobuf::RepeatedField< Element >::rend ( ) const
inline
189  {
190  return const_reverse_iterator(begin());
191  }
std::reverse_iterator< const_iterator > const_reverse_iterator
Definition: repeated_field.h:178
iterator begin()
Definition: repeated_field.h:779
template<typename Element >
void google::protobuf::RepeatedField< Element >::Reserve ( int  new_size)
806  {
807  if (total_size_ >= new_size) return;
808 
809  Element* old_elements = elements_;
811  max(total_size_ * 2, new_size));
812  elements_ = new Element[total_size_];
813  if (old_elements != NULL) {
814  MoveArray(elements_, old_elements, current_size_);
815  delete [] old_elements;
816  }
817 }
int total_size_
Definition: repeated_field.h:202
arena_t NULL
Definition: jemalloc_internal.h:624
Element * elements_
Definition: repeated_field.h:200
int current_size_
Definition: repeated_field.h:201
T max(const T &x, const T &y)
Definition: g3dmath.h:320
void MoveArray(Element to[], Element from[], int size)
Definition: repeated_field.h:826
static const int kMinRepeatedFieldAllocationSize
Definition: repeated_field.h:75

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

template<typename Element>
void google::protobuf::RepeatedField< Element >::Resize ( int  new_size,
const Element &  value 
)
inline
653  {
654  GOOGLE_DCHECK_GE(new_size, 0);
655  if (new_size > size()) {
656  Reserve(new_size);
657  std::fill(&elements_[current_size_], &elements_[new_size], value);
658  }
659  current_size_ = new_size;
660 }
Element * elements_
Definition: repeated_field.h:200
int size() const
Definition: repeated_field.h:631
int current_size_
Definition: repeated_field.h:201
#define GOOGLE_DCHECK_GE
Definition: common.h:758
void Reserve(int new_size)
Definition: repeated_field.h:806
const FieldDescriptor value
Definition: descriptor.h:1522

+ Here is the caller graph for this function:

template<typename Element>
void google::protobuf::RepeatedField< Element >::Set ( int  index,
const Element &  value 
)
inline
677  {
678  GOOGLE_DCHECK_GE(index, 0);
679  GOOGLE_DCHECK_LT(index, size());
680  elements_[index] = value;
681 }
Element * elements_
Definition: repeated_field.h:200
int size() const
Definition: repeated_field.h:631
#define GOOGLE_DCHECK_GE
Definition: common.h:758
#define GOOGLE_DCHECK_LT
Definition: common.h:755
const FieldDescriptor value
Definition: descriptor.h:1522

+ Here is the caller graph for this function:

template<typename Element >
int google::protobuf::RepeatedField< Element >::size ( ) const
inline
631  {
632  return current_size_;
633 }
int current_size_
Definition: repeated_field.h:201

+ Here is the caller graph for this function:

template<typename Element >
int google::protobuf::RepeatedField< Element >::SpaceUsedExcludingSelf ( ) const
inline
799  {
800  return (elements_ != NULL) ? total_size_ * sizeof(elements_[0]) : 0;
801 }
int total_size_
Definition: repeated_field.h:202
arena_t NULL
Definition: jemalloc_internal.h:624
Element * elements_
Definition: repeated_field.h:200
template<typename Element >
void google::protobuf::RepeatedField< Element >::Swap ( RepeatedField< Element > *  other)
756  {
757  if (this == other) return;
758  Element* swap_elements = elements_;
759  int swap_current_size = current_size_;
760  int swap_total_size = total_size_;
761 
762  elements_ = other->elements_;
763  current_size_ = other->current_size_;
764  total_size_ = other->total_size_;
765 
766  other->elements_ = swap_elements;
767  other->current_size_ = swap_current_size;
768  other->total_size_ = swap_total_size;
769 }
int total_size_
Definition: repeated_field.h:202
Element * elements_
Definition: repeated_field.h:200
int current_size_
Definition: repeated_field.h:201
template<typename Element >
void google::protobuf::RepeatedField< Element >::SwapElements ( int  index1,
int  index2 
)
772  {
773  using std::swap; // enable ADL with fallback
774  swap(elements_[index1], elements_[index2]);
775 }
Element * elements_
Definition: repeated_field.h:200
template<typename Element >
void google::protobuf::RepeatedField< Element >::Truncate ( int  new_size)
inline
820  {
821  GOOGLE_DCHECK_LE(new_size, current_size_);
822  current_size_ = new_size;
823 }
int current_size_
Definition: repeated_field.h:201
#define GOOGLE_DCHECK_LE
Definition: common.h:756

+ Here is the caller graph for this function:

Member Data Documentation

template<typename Element>
int google::protobuf::RepeatedField< Element >::current_size_
private
template<typename Element>
Element* google::protobuf::RepeatedField< Element >::elements_
private
template<typename Element>
const int google::protobuf::RepeatedField< Element >::kInitialSize = 0
staticprivate
template<typename Element>
int google::protobuf::RepeatedField< Element >::total_size_
private

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