Go to the documentation of this file.
47 #ifndef __SYSTEMC_EXT_UTIL_SC_VECTOR_HH__
48 #define __SYSTEMC_EXT_UTIL_SC_VECTOR_HH__
56 #include "../core/sc_module.hh"
57 #include "../core/sc_object.hh"
65 #if __cplusplus >= 201103L
68 using std::remove_const;
74 template<
bool Cond,
typename T=
void>
79 struct enable_if<true, T>
90 struct remove_const<const T>
95 template <
typename T,
typename U>
98 static const bool value =
false;
100 template <
typename T>
103 static const bool value =
true;
106 template <
typename T>
111 template <
typename T>
114 static const bool value =
true;
119 template <
typename CT,
typename T>
122 static const bool value =
131 template <
typename T>
135 template <
typename T>
141 #define SC_RPTYPE_(Type) \
142 ::sc_gem5::remove_special_fptr< \
143 ::sc_gem5::special_result & (*) Type>::type::value
145 #define SC_ENABLE_IF_(Cond) \
146 typename ::sc_gem5::enable_if<SC_RPTYPE_(Cond)>::type * = NULL
153 template <
typename T,
typename MT>
156 template <
typename T>
159 template <
typename T,
typename MT>
161 sc_vector<T> &, MT(T::* member_ptr));
170 virtual const char *
kind()
const {
return "sc_vector"; }
193 void reportEmpty(
const char *kind_,
bool empty_dest)
const;
202 template <
typename Element>
217 template <
typename U>
233 template <
typename Element,
typename Access>
237 template <
typename,
typename>
260 template <
typename Element,
263 public std::iterator<std::random_access_iterator_tag,
264 typename AccessPolicy::Type>,
269 typedef typename AccessPolicy::Policy
Policy;
280 template <
typename,
typename>
282 template <
typename,
typename>
285 typedef std::iterator<std::random_access_iterator_tag, AccessType>
291 template <
typename U>
296 template <
typename U>
324 template <
typename It>
439 template <
typename T>
440 class sc_vector :
public sc_vector_base
453 template <
typename Creator>
457 init(_size, creator);
472 template <
typename Creator>
496 return *
static_cast<const T *
>(objs[
index]);
502 this->checkIndex(
index);
503 return *
static_cast<T *
>(objs[
index]);
508 this->checkIndex(
index);
509 return *
static_cast<const T *
>(objs[
index]);
519 template <
typename ContainerType,
typename ArgumentType>
523 return bind(
c.begin(),
c.end());
526 template <
typename BindableContainer>
530 return bind(
c.begin(),
c.end());
533 template <
typename BindableIterator>
535 bind(BindableIterator first, BindableIterator last)
540 template <
typename BindableIterator>
544 if (!size() || from ==
end() || first == last)
545 reportEmpty(kind(), from ==
end());
547 while (from !=
end() && first != last)
548 (*from++).
bind(*first++);
552 template <
typename ContainerType,
typename ArgumentType>
556 return (*
this)(
c.begin(),
c.end());
559 template <
typename ArgumentContainer>
563 return (*
this)(
c.begin(),
c.end());
566 template <
typename ArgumentIterator>
570 return (*
this)(first, last, this->
begin());
573 template <
typename ArgumentIterator>
577 if (!size() || from ==
end() || first == last)
578 reportEmpty(kind(), from ==
end());
580 while (from !=
end() && first != last)
594 delete static_cast<T *
>(obj);
597 template <
typename,
typename>
603 return implicitCast(
static_cast<T *
>(ptr));
607 template <
typename T,
typename MT>
608 class sc_vector_assembly
611 friend sc_vector_assembly<T, MT> sc_assemble_vector<>(
612 sc_vector<T> &, MT (T::*));
656 sc_object *obj_ptr =
vec_->objectCast(
const_cast<MT *
>(&*it));
659 ret.push_back(obj_ptr);
686 template <
typename ContainerType,
typename ArgumentType>
690 return bind(
c.begin(),
c.end());
693 template <
typename BindableContainer>
697 return bind(
c.begin(),
c.end());
700 template <
typename BindableIterator>
702 bind(BindableIterator first, BindableIterator last)
707 template <
typename BindableIterator>
711 if (!
size() || from ==
end() || first == last)
712 vec_->reportEmpty(
"sc_vector_assembly", from ==
end());
714 while (from !=
end() && first != last)
715 (*from++).
bind(*first++);
719 template <
typename BindableIterator>
721 bind(BindableIterator first, BindableIterator last,
727 template <
typename ContainerType,
typename ArgumentType>
731 return (*
this)(
c.begin(),
c.end());
734 template <
typename ArgumentContainer>
738 return (*
this)(
c.begin(),
c.end());
741 template <
typename ArgumentIterator>
745 return (*
this)(first, last, this->
begin());
748 template <
typename ArgumentIterator>
752 if (!
size() || from ==
end() || first == last)
753 vec_->reportEmpty(
"sc_vector_assembly", from ==
end());
755 while (from !=
end() && first != last)
760 template <
typename ArgumentIterator>
777 template <
typename T,
typename MT>
786 #endif //__SYSTEMC_EXT_UTIL_SC_VECTOR_HH__
sc_direct_access< PlainType >::ConstPolicy ConstDirectPolicy
sc_vector_assembly< T, MT > sc_assemble_vector(sc_vector< T > &, MT(T::*member_ptr))
iterator bind(BindableIterator first, BindableIterator last)
iterator bind(BindableContainer &c)
iterator operator()(sc_vector_assembly< ContainerType, ArgumentType > c)
const char SC_ID_VECTOR_NONOBJECT_ELEMENTS_[]
sc_vector(const char *_name)
iterator bind(sc_vector_assembly< ContainerType, ArgumentType > c)
void checkIndex(size_type index) const
iterator bind(BindableContainer &c)
ThisType & operator+=(difference_type n)
const_iterator::reference at(size_type i) const
sc_vector_assembly(const sc_vector_assembly &other)
ThisType & operator-=(difference_type n)
const_iterator cend() const
bool operator!=(const ConstDirectIterator &other) const
const_iterator begin() const
AccessType * get(ElementType *this_) const
std::vector< void * > StorageType
const T & at(size_type index) const
iterator::reference at(size_type i)
BaseType::difference_type difference_type
iterator::reference operator[](size_type i)
sc_vector< PlainType > VectorType
std::vector< sc_object * > get_elements() const
sc_direct_access< ElementType > Policy
ElementType * get(ElementType *this_) const
void init(size_type _size)
bool operator==(const ConstDirectIterator &other) const
void unforceParent() const
pointer operator->() const
std::vector< sc_object * > elements
sc_member_access< ElementType, AccessType > Policy
virtual sc_object * objectCast(void *) const =0
sc_object * implicitCast(sc_object *p) const
sc_member_access(const NonConstPolicy &other)
AccessPolicy::NonConstPolicy NonConstPolicy
sc_gem5::remove_const< AccessType >::type PlainType
BaseType::pointer pointer
AccessTypeElementType::* MemberType
AccessPolicy::Policy Policy
sc_object * implicitCast(...) const
iterator bind(BindableIterator first, BindableIterator last, iterator from)
const_iterator end() const
AccessPolicy::ConstPolicy ConstPolicy
#define SC_REPORT_ERROR(msg_type, msg)
iterator bind(BindableIterator first, BindableIterator last, iterator from)
sc_vector(const char *_name, size_type _size)
static T * create_element(const char *_name, size_type index)
std::vector< void * >::const_iterator type
sc_vector_iter(RawIterator it, Policy acc=Policy())
sc_vector_iter< const T, sc_member_access< const T, const MT > > const_iterator
bool operator<=(const ConstDirectIterator &other) const
sc_member_access< const PlainElemType, const PlainType > ConstPolicy
ThisType operator+(difference_type n) const
const std::vector< sc_object * > & get_elements() const
sc_direct_access< const PlainType > ConstPolicy
#define SC_ENABLE_IF_(Cond)
sc_gem5::remove_const< ElementType >::type PlainType
virtual const char * kind() const
sc_direct_access< PlainType > NonConstPolicy
void reportEmpty(const char *kind_, bool empty_dest) const
BaseType::reference reference
const char * sc_gen_unique_name(const char *seed)
bool operator>(const ConstDirectIterator &other) const
bool operator<(const ConstDirectIterator &other) const
sc_gem5::remove_const< ElementType >::type PlainType
sc_gem5::remove_const< ElementType >::type PlainElemType
const Policy & get_policy() const
sc_member_access(MemberType ptr)
reference operator*() const
iterator bind(BindableIterator first, BindableIterator last, typename sc_vector< T >::iterator from)
iterator bind(BindableIterator first, BindableIterator last)
sc_vector_iter< const T > const_iterator
sc_direct_access(const NonConstPolicy &)
sc_vector_iter< ConstPlainType, ConstPolicy > ConstIterator
sc_vector_iter(const It &it, SC_ENABLE_IF_((sc_gem5::is_more_const< ElementType, typename It::Policy::ElementType >)))
sc_vector_assembly(sc_vector< T > &v, MemberType ptr)
sc_direct_access(const U &, SC_ENABLE_IF_((sc_gem5::is_more_const< ElementType, typename U::Policy::ElementType >)))
std::iterator< std::random_access_iterator_tag, AccessType > BaseType
const char * name() const
sc_vector_iter< ConstPlainType, ConstDirectPolicy > ConstDirectIterator
sc_vector_iter< T > iterator
const typedef PlainType ConstPlainType
bool operator>=(const ConstDirectIterator &other) const
const_iterator cbegin() const
sc_vector_iter< T, sc_member_access< T, MT > > iterator
iterator bind(sc_vector_assembly< ContainerType, ArgumentType > c)
void init(size_type _size, Creator creator)
sc_vector(const char *_name, size_type _size, Creator creator)
T & operator[](size_type index)
std::vector< void * >::iterator type
ThisType operator-(difference_type n) const
sc_object * objectCast(void *ptr) const
std::vector< void * > objs
const_iterator cbegin() const
sc_vector & operator=(const sc_vector &)
iterator operator()(sc_vector_assembly< ContainerType, ArgumentType > c)
const_iterator begin() const
reference operator[](difference_type n) const
const_iterator cend() const
sc_member_access< PlainElemType, PlainType > NonConstPolicy
sc_vector_base(const char *_name)
SelectIter< ElementType >::type RawIterator
const_iterator end() const
Generated on Wed Sep 30 2020 14:02:16 for gem5 by doxygen 1.8.17