Go to the documentation of this file.
47 #ifndef __SYSTEMC_EXT_UTIL_SC_VECTOR_HH__
48 #define __SYSTEMC_EXT_UTIL_SC_VECTOR_HH__
57 #include "../core/sc_module.hh"
58 #include "../core/sc_object.hh"
66 #if __cplusplus >= 201103L
69 using std::remove_const;
75 template<
bool Cond,
typename T=
void>
80 struct enable_if<true, T>
91 struct remove_const<const T>
96 template <
typename T,
typename U>
99 static const bool value =
false;
101 template <
typename T>
104 static const bool value =
true;
107 template <
typename T>
112 template <
typename T>
115 static const bool value =
true;
120 template <
typename CT,
typename T>
123 static const bool value =
132 template <
typename T>
136 template <
typename T>
142 #define SC_RPTYPE_(Type) \
143 ::sc_gem5::remove_special_fptr< \
144 ::sc_gem5::special_result & (*) Type>::type::value
146 #define SC_ENABLE_IF_(Cond) \
147 typename ::sc_gem5::enable_if<SC_RPTYPE_(Cond)>::type * = NULL
154 template <
typename T,
typename MT>
157 template <
typename T>
160 template <
typename T,
typename MT>
162 sc_vector<T> &, MT(T::* member_ptr));
171 virtual const char *
kind()
const {
return "sc_vector"; }
194 void reportEmpty(
const char *kind_,
bool empty_dest)
const;
203 template <
typename Element>
218 template <
typename U>
234 template <
typename Element,
typename Access>
238 template <
typename,
typename>
261 template <
typename Element,
267 typedef typename AccessPolicy::Policy
Policy;
278 template <
typename,
typename>
280 template <
typename,
typename>
287 template <
typename U>
292 template <
typename U>
322 template <
typename It>
437 template <
typename T>
438 class sc_vector :
public sc_vector_base
451 template <
typename Creator>
455 init(_size, creator);
470 template <
typename Creator>
494 return *
static_cast<const T *
>(objs[
index]);
500 this->checkIndex(
index);
501 return *
static_cast<T *
>(objs[
index]);
506 this->checkIndex(
index);
507 return *
static_cast<const T *
>(objs[
index]);
517 template <
typename ContainerType,
typename ArgumentType>
521 return bind(
c.begin(),
c.end());
524 template <
typename BindableContainer>
528 return bind(
c.begin(),
c.end());
531 template <
typename BindableIterator>
533 bind(BindableIterator first, BindableIterator last)
538 template <
typename BindableIterator>
542 if (!size() || from ==
end() || first == last)
543 reportEmpty(kind(), from ==
end());
545 while (from !=
end() && first != last)
546 (*from++).
bind(*first++);
550 template <
typename ContainerType,
typename ArgumentType>
554 return (*
this)(
c.begin(),
c.end());
557 template <
typename ArgumentContainer>
561 return (*
this)(
c.begin(),
c.end());
564 template <
typename ArgumentIterator>
568 return (*
this)(first, last, this->
begin());
571 template <
typename ArgumentIterator>
575 if (!size() || from ==
end() || first == last)
576 reportEmpty(kind(), from ==
end());
578 while (from !=
end() && first != last)
592 delete static_cast<T *
>(obj);
595 template <
typename,
typename>
601 return implicitCast(
static_cast<T *
>(ptr));
605 template <
typename T,
typename MT>
606 class sc_vector_assembly
609 friend sc_vector_assembly<T, MT> sc_assemble_vector<>(
610 sc_vector<T> &, MT (T::*));
654 sc_object *obj_ptr =
vec_->objectCast(
const_cast<MT *
>(&*it));
657 ret.push_back(obj_ptr);
684 template <
typename ContainerType,
typename ArgumentType>
688 return bind(
c.begin(),
c.end());
691 template <
typename BindableContainer>
695 return bind(
c.begin(),
c.end());
698 template <
typename BindableIterator>
700 bind(BindableIterator first, BindableIterator last)
705 template <
typename BindableIterator>
709 if (!
size() || from ==
end() || first == last)
710 vec_->reportEmpty(
"sc_vector_assembly", from ==
end());
712 while (from !=
end() && first != last)
713 (*from++).
bind(*first++);
717 template <
typename BindableIterator>
719 bind(BindableIterator first, BindableIterator last,
725 template <
typename ContainerType,
typename ArgumentType>
729 return (*
this)(
c.begin(),
c.end());
732 template <
typename ArgumentContainer>
736 return (*
this)(
c.begin(),
c.end());
739 template <
typename ArgumentIterator>
743 return (*
this)(first, last, this->
begin());
746 template <
typename ArgumentIterator>
750 if (!
size() || from ==
end() || first == last)
751 vec_->reportEmpty(
"sc_vector_assembly", from ==
end());
753 while (from !=
end() && first != last)
758 template <
typename ArgumentIterator>
775 template <
typename T,
typename MT>
784 #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)
typename AccessPolicy::Type value_type
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
typename AccessPolicy::Type & reference
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)
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
typename AccessPolicy::Type * pointer
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
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
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)
std::random_access_iterator_tag iterator_category
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::ptrdiff_t difference_type
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 Sun Jul 30 2023 01:57:02 for gem5 by doxygen 1.8.17