SystemC 3.0.0
Accellera SystemC proof-of-concept library
sc_vector.h
Go to the documentation of this file.
1/*****************************************************************************
2
3 Licensed to Accellera Systems Initiative Inc. (Accellera) under one or
4 more contributor license agreements. See the NOTICE file distributed
5 with this work for additional information regarding copyright ownership.
6 Accellera licenses this file to you under the Apache License, Version 2.0
7 (the "License"); you may not use this file except in compliance with the
8 License. You may obtain a copy of the License at
9
10 http://www.apache.org/licenses/LICENSE-2.0
11
12 Unless required by applicable law or agreed to in writing, software
13 distributed under the License is distributed on an "AS IS" BASIS,
14 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
15 implied. See the License for the specific language governing
16 permissions and limitations under the License.
17
18 *****************************************************************************/
19
20/*****************************************************************************
21
22 sc_vector.h - A vector of named (SystemC) objects (modules, ports, channels)
23
24 Original Author: Philipp A. Hartmann, OFFIS
25
26 CHANGE LOG AT END OF FILE
27 *****************************************************************************/
28
29#ifndef SC_VECTOR_H_INCLUDED_
30#define SC_VECTOR_H_INCLUDED_
31
32#include <algorithm> // std::swap
33#include <iterator>
34#include <string>
35#include <type_traits>
36#include <vector>
37
40
41#if defined(_MSC_VER) && !defined(SC_WIN_DLL_WARN)
42#pragma warning(push)
43#pragma warning(disable: 4251) // DLL import for std::vector
44#endif
45
46namespace sc_core {
47// forward declarations
48template< typename T > class sc_vector;
49template< typename T, typename MT > class sc_vector_assembly;
50template< typename T, typename MT > class sc_vector_iter;
51
52// implementation-defined
53template< typename Container, typename ArgumentIterator >
54typename Container::iterator
55sc_vector_do_bind( Container & cont
56 , ArgumentIterator first
57 , ArgumentIterator last
58 , typename Container::iterator from );
59
60// implementation-defined
61template< typename Container, typename ArgumentIterator >
62typename Container::iterator
63sc_vector_do_operator_paren( Container & cont
64 , ArgumentIterator first
65 , ArgumentIterator last
66 , typename Container::iterator from );
67
69{
72};
73
74class sc_vector_element; // opaque pointer
75
77 : public sc_object
79{
80
81 template<typename,typename> friend class sc_vector_assembly;
82 template<typename,typename> friend class sc_vector_iter;
83
84public:
85
86 typedef sc_vector_element* handle_type;
87 typedef std::vector< handle_type > storage_type;
88 typedef storage_type::size_type size_type;
89 typedef storage_type::difference_type difference_type;
90
91 const char * kind() const { return "sc_vector"; }
92
93 std::vector<sc_object*> const & get_elements() const;
94
96 { return vec_.size(); }
97
98 void lock() { locked = true; };
99
100 bool is_locked() const { return locked; }
101
102protected:
103
104 // begin implementation defined
105
106 typedef storage_type::iterator iterator;
107 typedef storage_type::const_iterator const_iterator;
108
110
111 sc_vector_base( const char* prefix )
112 : sc_object( prefix )
113 , vec_()
114 , objs_vec_(0)
115 , locked(false)
116 {
117 init_lock_cb();
118 }
119
121 { delete objs_vec_; }
122
123 void * at( size_type i )
124 { return vec_[i]; }
125
126 void const * at( size_type i ) const
127 { return vec_[i]; }
128
130 { vec_.reserve(n); }
131
132 void clear()
133 { vec_.clear(); }
134
135 void push_back( void* item )
136 { vec_.push_back( static_cast<handle_type>(item) ); }
137
138 bool check_locked() const;
139 void check_index( size_type i ) const;
140 bool check_init( size_type n ) const;
141
142 static std::string make_name( const char* prefix, size_type index );
143
144 iterator begin() { return vec_.begin(); }
145 iterator end() { return vec_.end(); }
146
147 const_iterator begin() const { return vec_.begin(); }
148 const_iterator end() const { return vec_.end(); }
149
150 virtual sc_object* object_cast( void* ) const = 0;
151
152 sc_object* implicit_cast( sc_object* p ) const { return p; }
153 sc_object* implicit_cast( ... /* incompatible */ ) const;
154
156 void stage_callback(const sc_stage & stage); // implement callback
157
158public:
159 void report_empty_bind( const char* kind_, bool dst_range_ ) const;
160
161private:
162 storage_type vec_;
163 mutable std::vector< sc_object* >* objs_vec_;
164 bool locked;
165
166 // disabled
168 sc_vector_base& operator=( const sc_vector_base& );
169
170}; // sc_vector_base
171
172// helper check for constness
173template< typename CT, typename T >
174inline constexpr bool sc_is_more_const_v =
175 std::is_same_v<std::remove_const_t<CT>, std::remove_const_t<T>> &&
176 std::is_const_v<CT> >= std::is_const_v<T>;
177
178// iterator access adapters
179template< typename ElementType >
181{
182 typedef ElementType element_type;
184 typedef std::remove_const_t<type> plain_type;
185
189
191 // convert from any policy to (const) direct policy
192 template< typename U
193 , typename = std::enable_if_t<sc_is_more_const_v<type, typename U::policy::element_type>>>
194 sc_direct_access( const U& ) {}
195
196 type* get( type* this_ ) const
197 { return this_; }
198};
199
200// iterator access adapters
201template< typename ElementType
202 , typename AccessType >
204{
205 public:
206 template< typename, typename > friend class sc_member_access;
207
208 typedef ElementType element_type;
209 typedef AccessType access_type;
210 typedef access_type (ElementType::*member_type);
212 typedef std::remove_const_t<type> plain_type;
213 typedef std::remove_const_t<ElementType> plain_elem_type;
214
220
222 : ptr_(ptr) {}
223
225 : ptr_(other.ptr_)
226 {}
227
228 access_type * get( element_type* this_ ) const
229 { return &(this_->*ptr_); }
230
231 private:
232 member_type ptr_;
233}; // sc_member_access
234
235
236template< typename ElementType
237 , typename AccessPolicy = sc_direct_access<ElementType> >
239 : private AccessPolicy
240{
241 typedef ElementType element_type;
242 typedef typename AccessPolicy::policy access_policy;
243 typedef typename AccessPolicy::non_const_policy non_const_policy;
244 typedef typename AccessPolicy::const_policy const_policy;
245
246 typedef std::remove_const_t<ElementType> plain_type;
247 typedef const plain_type const_plain_type;
250
251 friend class sc_vector< plain_type >;
252 template< typename, typename > friend class sc_vector_assembly;
253 template< typename, typename > friend class sc_vector_iter;
254
257 typedef sc_vector_base::storage_type storage_type;
258
259 // select correct base-type iterator
260 template< typename U > struct select_iter
261 { typedef typename storage_type::iterator type; };
262 template< typename U > struct select_iter< const U >
263 { typedef typename storage_type::const_iterator type; };
264
265 typedef typename select_iter<ElementType>::type raw_iterator;
266 typedef sc_vector_iter< const_plain_type, const_policy > const_iterator;
267 typedef sc_vector_iter< const_plain_type, const_direct_policy >
268 const_direct_iterator;
269
270 // underlying vector iterator
271
272 raw_iterator it_;
273
274 sc_vector_iter( raw_iterator it, access_policy acc = access_policy() )
275 : access_policy(acc), it_(it) {}
276
277 access_policy const & get_policy() const { return *this; }
278
279public:
280 // interface for Random Access Iterator category,
281 // see ISO/IEC 14882:2003(E), 24.1 [lib.iterator.requirements]
282
283 typedef std::random_access_iterator_tag iterator_category;
284 typedef std::ptrdiff_t difference_type;
285 typedef typename access_policy::type value_type;
288
289 sc_vector_iter() : access_policy(), it_() {}
290
291 // iterator conversions to more const, and/or direct iterators
292 //
293 // Note: There is a minor risk to match unrelated classes (i.e. not sc_vector_iter<T,POL>),
294 // but MSVC 2005 does not correctly consider a restricted conversion constructor
295 // sc_vector_iter( const sc_vector_iter<OtherType,OtherPolicy>, SC_ENABLE_IF_ ...).
296 // To reduce this risk, the types used in the enable-if condition could be further
297 // tailored towards sc_vector(_iter), should the need arise.
298 //
299 // See also: sc_direct_access conversion constructor
300 template< typename It
301 , typename = std::enable_if_t<sc_is_more_const_v<element_type, typename It::policy::element_type>>>
302 sc_vector_iter( const It& it )
303 : access_policy( it.get_policy() ), it_( it.it_ )
304 {}
305
306 // step
307 this_type& operator++(){ ++it_; return *this; }
308 this_type& operator--(){ --it_; return *this; }
309 this_type operator++(int){ this_type old(*this); ++it_; return old; }
310 this_type operator--(int){ this_type old(*this); --it_; return old; }
311
312 // advance
314 { return this_type( it_ + n, get_policy()); }
316 { return this_type( it_ - n, get_policy()); }
317
318 this_type& operator+=( difference_type n ) { it_+=n; return *this; }
319 this_type& operator-=( difference_type n ) { it_-=n; return *this; }
320
321 // dereference
323 { return *access_policy::get( static_cast<element_type*>((void*)*it_) ); }
325 { return access_policy::get( static_cast<element_type*>((void*)*it_) ); }
327 { return *access_policy::get( static_cast<element_type*>((void*)it_[n]) ); }
328
329 // distance
331 { return it_-that.it_; }
332
333 raw_iterator raw() const { return it_; }
334
335}; // sc_vector_iter
336
337
338// sc_vector_iter relations
339template< typename T1, typename Pol1, typename T2, typename Pol2
340 , typename = std::enable_if_t<std::is_same_v<std::remove_const_t<T1>, std::remove_const_t<T2>>>>
341inline bool
343 { return a.raw() == b.raw(); }
344
345template< typename T1, typename Pol1, typename T2, typename Pol2 >
346inline auto
347operator!=( const sc_vector_iter<T1,Pol1>& a, const sc_vector_iter<T2,Pol2> & b ) -> decltype( !(a == b) )
348 { return !(a == b); }
349
350template< typename T1, typename Pol1, typename T2, typename Pol2
351 , typename = std::enable_if_t<std::is_same_v<std::remove_const_t<T1>, std::remove_const_t<T2>>>>
352inline bool
354 { return a.raw() < b.raw(); }
355
356template< typename T1, typename Pol1, typename T2, typename Pol2 >
357inline auto
358operator>=( const sc_vector_iter<T1,Pol1>& a, const sc_vector_iter<T2,Pol2> & b ) -> decltype( !(a < b) )
359 { return !(a < b); }
360
361template< typename T1, typename Pol1, typename T2, typename Pol2 >
362inline auto
363operator>( const sc_vector_iter<T1,Pol1>& a, const sc_vector_iter<T2,Pol2> & b ) -> decltype( (b < a) )
364 { return b < a; }
365
366template< typename T1, typename Pol1, typename T2, typename Pol2 >
367inline auto
368operator<=( const sc_vector_iter<T1,Pol1>& a, const sc_vector_iter<T2,Pol2> & b ) -> decltype( !(b < a) )
369 { return !(b < a); }
370
371
372template< typename T >
374 : public sc_vector_base
375{
377 typedef sc_vector<T> this_type;
378
379public:
380 typedef T element_type;
383
385
386 explicit sc_vector( const char* prefix )
387 : base_type( prefix )
388 {}
389
390 sc_vector( const char* prefix, size_type n,
392 : base_type( prefix )
393 {
394 init(n, init_pol);
395 }
396
397 template< typename Creator >
398 sc_vector( const char* prefix, size_type n, Creator creator,
400 : base_type( prefix )
401 {
402 init( n, creator, init_pol );
403 }
404
405 virtual ~sc_vector();
406
408 { return *static_cast<element_type*>( base_type::at(i) ); }
409
411 { check_index(i); return (*this)[i]; }
412
414 { return *static_cast<element_type const *>( base_type::at(i) ); }
415
416 const element_type& at( size_type i ) const
417 { check_index(i); return (*this)[i]; }
418
421 { init( n, &this_type::create_element, init_pol ); }
422
423 template< typename Creator >
424 void init( size_type n, Creator c,
426
427 // Append element with automatically generated name
428 // T(generated_name, args...)
429 template< typename... Args >
430 void emplace_back( Args&&... args );
431
432 // Append element with user-defined name
433 template< typename... Args >
434 void emplace_back_with_name(Args &&... args);
435
436 static element_type * create_element( const char* prefix, size_type index );
437
440
442 const_iterator end() const { return base_type::end(); }
443
445 const_iterator cend() const { return base_type::end(); }
446
447 template< typename ContainerType, typename ArgumentType >
449 { return bind( c.begin(), c.end() ); }
450
451 template< typename BindableContainer >
452 iterator bind( BindableContainer & c )
453 { return bind( c.begin(), c.end() ); }
454
455 template< typename BindableIterator >
456 iterator bind( BindableIterator first, BindableIterator last )
457 { return bind( first, last, this->begin() ); }
458
459 template< typename BindableIterator >
460 iterator bind( BindableIterator first, BindableIterator last
461 , iterator from )
462 { return sc_vector_do_bind( *this, first, last, from ); }
463
464 template< typename ContainerType, typename ArgumentType >
466 { return operator()( c.begin(), c.end() ); }
467
468 template< typename ArgumentContainer >
469 iterator operator()( ArgumentContainer & c )
470 { return operator()( c.begin(), c.end() ); }
471
472 template< typename ArgumentIterator >
473 iterator operator()( ArgumentIterator first, ArgumentIterator last )
474 { return operator()( first, last, this->begin() ); }
475
476 template< typename ArgumentIterator >
477 iterator operator()( ArgumentIterator first, ArgumentIterator last
478 , iterator from )
479 { return sc_vector_do_operator_paren( *this, first, last, from ); }
480
481 // member-wise access
482
483 template< typename MT >
484 sc_vector_assembly<T,MT> assemble( MT (T::*member_ptr) )
485 { return sc_vector_assembly<T,MT>( *this, member_ptr ); }
486
487protected:
488
489 void clear();
490
491 virtual sc_object* object_cast( void* p ) const
492 { return implicit_cast( static_cast<element_type*>(p) ); }
493
494};
495
496template< typename T, typename MT >
498{
499 template< typename U > friend class sc_vector;
500
501public:
502
504
506 typedef sc_vector_iter< const T
508
509 typedef T element_type;
510 typedef MT access_type;
511
515 typedef typename iterator::pointer pointer;
518
519
521
522 const char* name() const { return vec_->name(); }
523 const char* kind() const { return "sc_vector_assembly"; }
524
526 { return iterator( (*vec_).begin().it_, ptr_ ); }
528 { return iterator( (*vec_).end().it_, ptr_ ); }
529
531 { return const_iterator( (*vec_).cbegin().it_, ptr_ ); }
533 { return const_iterator( (*vec_).cend().it_, ptr_ ); }
534
536 { return const_iterator( (*vec_).begin().it_, ptr_ ); }
538 { return const_iterator( (*vec_).end().it_, ptr_ ); }
539
540 size_type size() const { return vec_->size(); }
541 const std::vector< sc_object* > & get_elements() const;
542
544 { return (*vec_)[idx].*ptr_; }
546 { return vec_->at(idx).*ptr_; }
548 { return (*vec_)[idx].*ptr_; }
550 { return vec_->at(idx).*ptr_; }
551
552 template< typename ContainerType, typename ArgumentType >
554 { return bind( c.begin(), c.end() ); }
555
556 template< typename BindableContainer >
557 iterator bind( BindableContainer & c )
558 { return bind( c.begin(), c.end() ); }
559
560 template< typename BindableIterator >
561 iterator bind( BindableIterator first, BindableIterator last )
562 { return bind( first, last, this->begin() ); }
563
564 template< typename BindableIterator >
565 iterator bind( BindableIterator first, BindableIterator last
566 , iterator from )
567 { return sc_vector_do_bind( *this, first, last, from ); }
568
569 template< typename BindableIterator >
570 iterator bind( BindableIterator first, BindableIterator last
571 , typename base_type::iterator from )
572 { return bind( first, last, iterator(from.it_, ptr_) ); }
573
574 template< typename ContainerType, typename ArgumentType >
576 { return operator()( c.begin(), c.end() ); }
577
578 template< typename ArgumentContainer >
579 iterator operator()( ArgumentContainer & c )
580 { return operator()( c.begin(), c.end() ); }
581
582 template< typename ArgumentIterator >
583 iterator operator()( ArgumentIterator first, ArgumentIterator last )
584 { return operator()( first, last, this->begin() ); }
585
586 template< typename ArgumentIterator >
587 iterator operator()( ArgumentIterator first, ArgumentIterator last
588 , iterator from )
589 { return sc_vector_do_operator_paren( *this, first, last, from ); }
590
591 template< typename ArgumentIterator >
592 iterator operator()( ArgumentIterator first, ArgumentIterator last
593 , typename base_type::iterator from )
594 { return operator()( first, last, iterator(from.it_, ptr_) ); }
595
597 : vec_( other.vec_ )
598 , ptr_( other.ptr_ )
599 , child_vec_(0)
600 {}
601
603 {
604 swap( other_copy );
605 return *this;
606 }
607
609 {
610 using std::swap;
611 swap( vec_, that.vec_ );
612 swap( ptr_, that.ptr_ );
613 swap( child_vec_, that.child_vec_ );
614 }
615
616 void report_empty_bind( const char* kind_, bool dst_empty_ ) const
617 { vec_->report_empty_bind( kind_, dst_empty_ ); }
618
620 { delete child_vec_; }
621
622private:
623
625 : vec_(&v)
626 , ptr_(ptr)
627 , child_vec_(0)
628 {}
629
630 sc_object* object_cast( pointer p ) const
631 { return vec_->implicit_cast( p ); }
632
633 base_type * vec_;
634 member_type ptr_;
635
636 mutable std::vector< sc_object* >* child_vec_;
637};
638
639template< typename T, typename MT >
640sc_vector_assembly<T,MT>
641sc_assemble_vector( sc_vector<T> & vec, MT (T::*ptr) )
642{
643 return vec.assemble( ptr );
644}
645
646template< typename T >
648sc_vector<T>::create_element( const char* name, size_type /* idx */ )
649{
650 return new T( name );
651}
652
653template< typename T >
654template< typename Creator >
655void
657{
658 if ( base_type::check_init(n) )
659 {
660 base_type::reserve( n );
661
662 // restore SystemC hierarchy context, if needed
663 sc_hierarchy_scope scope( get_hierarchy_scope() );
664 try
665 {
666 for ( size_type i = 0; i<n; ++i )
667 {
668 // this workaround is needed for SystemC 2.2/2.3 sc_bind
669 std::string name = make_name( basename(), i );
670 const char* cname = name.c_str();
671
672 element_type* p = c( cname, i ) ; // call Creator
673 base_type::push_back(p);
674 }
675 }
676 catch ( ... )
677 {
678 clear();
679 throw;
680 }
681
682 if (init_pol == SC_VECTOR_LOCK_AFTER_INIT)
683 base_type::lock();
684
685 }
686}
687
688template< typename T >
689template< typename... Args >
690void sc_vector<T>::emplace_back( Args&&... args ) {
691 if (check_locked()) {
692 sc_hierarchy_scope scope( get_hierarchy_scope() );
693 T* p = new T( make_name( basename(), size()).c_str() ,
694 std::forward<Args>(args)...);
695 base_type::push_back(p);
696 }
697}
698
699template< typename T >
700template< typename... Args >
702 if (check_locked()) {
703 sc_hierarchy_scope scope( get_hierarchy_scope() );
704 T *p = new T(std::forward<Args>(args)...);
705 base_type::push_back(p);
706 }
707}
708
709template< typename T >
710void
712{
713 size_type i = size();
714 while ( i --> 0 )
715 {
716 delete &( (*this)[i] );
717 }
718 base_type::clear();
719}
720
721template< typename Container, typename ArgumentIterator >
722typename Container::iterator
723sc_vector_do_bind( Container & cont
724 , ArgumentIterator first
725 , ArgumentIterator last
726 , typename Container::iterator from )
727{
728 typename Container::iterator end = cont.end();
729
730 if( !cont.size() || from == end || first == last )
731 cont.report_empty_bind( cont.kind(), from == end );
732
733 while( from!=end && first != last )
734 (*from++).bind( *first++ );
735 return from;
736}
737
738template< typename Container, typename ArgumentIterator >
739typename Container::iterator
741 , ArgumentIterator first
742 , ArgumentIterator last
743 , typename Container::iterator from )
744{
745 typename Container::iterator end = cont.end();
746
747 if( !cont.size() || from == end || first == last )
748 cont.report_empty_bind( cont.kind(), from == end );
749
750 while( from!=end && first != last )
751 (*from++)( *first++ );
752 return from;
753}
754
755template< typename T >
757{
758 clear();
759}
760
761template< typename T, typename MT >
762std::vector< sc_object* > const &
764{
765 if( !child_vec_ )
766 child_vec_ = new std::vector< sc_object* >;
767
768 if( child_vec_->size() || !size() )
769 return *child_vec_;
770
771 child_vec_->reserve( size() );
772 for( const_iterator it=begin(); it != end(); ++it )
773 if( sc_object * obj = object_cast( const_cast<MT*>(&*it) ) )
774 child_vec_->push_back( obj );
775
776 return *child_vec_;
777}
778
779} // namespace sc_core
780
781#undef SC_RPTYPE_
782#undef SC_ENABLE_IF_
783
784#if defined(_MSC_VER) && !defined(SC_WIN_DLL_WARN)
785#pragma warning(pop)
786#endif
787
788// $Log: sc_vector.h,v $
789// Revision 1.17 2011/08/26 20:46:20 acg
790// Andy Goodrich: moved the modification log to the end of the file to
791// eliminate source line number skew when check-ins are done.
792//
793// Revision 1.16 2011/07/25 10:21:17 acg
794// Andy Goodrich: check in aftermath of call to automake.
795//
796// Revision 1.15 2011/04/02 00:04:32 acg
797// Philipp A. Hartmann: fix distance from member iterators, and
798// add iterator conversions.
799//
800// Revision 1.14 2011/04/01 22:35:19 acg
801// Andy Goodrich: spelling fix.
802//
803// Revision 1.13 2011/03/28 13:03:09 acg
804// Andy Goodrich: Philipp's latest update.
805//
806// Revision 1.12 2011/03/23 16:16:28 acg
807// Philipp A. Hartmann: rebase implementation on void*
808// - supports virtual inheritance from sc_object again
809// - build up get_elements result on demand
810// - still requires element type to be derived from sc_object
811//
812// Revision 1.11 2011/02/19 16:46:36 acg
813// Andy Goodrich: finally get the update from Philipp correct!
814//
815
816#endif // SC_VECTOR_H_INCLUDED_
817// Taf!
#define SC_API
Definition: sc_cmnhdr.h:148
auto operator>(const sc_vector_iter< T1, Pol1 > &a, const sc_vector_iter< T2, Pol2 > &b) -> decltype((b< a))
Definition: sc_vector.h:363
Container::iterator sc_vector_do_bind(Container &cont, ArgumentIterator first, ArgumentIterator last, typename Container::iterator from)
Definition: sc_vector.h:723
bool operator!=(const sc_process_handle &left, const sc_process_handle &right)
auto operator<=(const sc_vector_iter< T1, Pol1 > &a, const sc_vector_iter< T2, Pol2 > &b) -> decltype(!(b< a))
Definition: sc_vector.h:368
bool operator==(const sc_process_handle &left, const sc_process_handle &right)
sc_vector_init_policy
Definition: sc_vector.h:69
@ SC_VECTOR_LOCK_AFTER_ELABORATION
Definition: sc_vector.h:71
@ SC_VECTOR_LOCK_AFTER_INIT
Definition: sc_vector.h:70
Container::iterator sc_vector_do_operator_paren(Container &cont, ArgumentIterator first, ArgumentIterator last, typename Container::iterator from)
Definition: sc_vector.h:740
class SC_API sc_object
Definition: sc_object.h:46
bool operator<(const sc_process_handle &left, const sc_process_handle &right)
auto operator>=(const sc_vector_iter< T1, Pol1 > &a, const sc_vector_iter< T2, Pol2 > &b) -> decltype(!(a< b))
Definition: sc_vector.h:358
constexpr bool sc_is_more_const_v
Definition: sc_vector.h:174
sc_vector_assembly< T, MT > sc_assemble_vector(sc_vector< T > &vec, MT(T::*ptr))
Definition: sc_vector.h:641
uint64 const sc_uint_base int b
Definition: sc_fxval.h:955
const char * name() const
Definition: sc_object.h:122
const element_type & at(size_type i) const
Definition: sc_vector.h:416
void init(size_type n, sc_vector_init_policy init_pol=SC_VECTOR_LOCK_AFTER_INIT)
Definition: sc_vector.h:419
void emplace_back(Args &&... args)
Definition: sc_vector.h:690
iterator bind(BindableIterator first, BindableIterator last, iterator from)
Definition: sc_vector.h:460
iterator bind(sc_vector_assembly< ContainerType, ArgumentType > c)
Definition: sc_vector.h:448
element_type & at(size_type i)
Definition: sc_vector.h:410
iterator operator()(ArgumentIterator first, ArgumentIterator last)
Definition: sc_vector.h:473
const_iterator cbegin() const
Definition: sc_vector.h:444
sc_vector(const char *prefix, size_type n, Creator creator, sc_vector_init_policy init_pol=SC_VECTOR_LOCK_AFTER_INIT)
Definition: sc_vector.h:398
sc_vector_iter< const element_type > const_iterator
Definition: sc_vector.h:382
iterator operator()(ArgumentContainer &c)
Definition: sc_vector.h:469
sc_vector(const char *prefix)
Definition: sc_vector.h:386
iterator bind(BindableContainer &c)
Definition: sc_vector.h:452
iterator operator()(ArgumentIterator first, ArgumentIterator last, iterator from)
Definition: sc_vector.h:477
iterator begin()
Definition: sc_vector.h:438
iterator end()
Definition: sc_vector.h:439
sc_vector_assembly< T, MT > assemble(MT(T::*member_ptr))
Definition: sc_vector.h:484
static element_type * create_element(const char *prefix, size_type index)
Definition: sc_vector.h:648
virtual ~sc_vector()
Definition: sc_vector.h:756
const element_type & operator[](size_type i) const
Definition: sc_vector.h:413
void emplace_back_with_name(Args &&... args)
Definition: sc_vector.h:701
virtual sc_object * object_cast(void *p) const
Definition: sc_vector.h:491
iterator bind(BindableIterator first, BindableIterator last)
Definition: sc_vector.h:456
sc_vector_iter< element_type > iterator
Definition: sc_vector.h:381
const_iterator end() const
Definition: sc_vector.h:442
const_iterator begin() const
Definition: sc_vector.h:441
const_iterator cend() const
Definition: sc_vector.h:445
iterator operator()(sc_vector_assembly< ContainerType, ArgumentType > c)
Definition: sc_vector.h:465
element_type & operator[](size_type i)
Definition: sc_vector.h:407
sc_vector(const char *prefix, size_type n, sc_vector_init_policy init_pol=SC_VECTOR_LOCK_AFTER_INIT)
Definition: sc_vector.h:390
iterator bind(sc_vector_assembly< ContainerType, ArgumentType > c)
Definition: sc_vector.h:553
base_type::size_type size_type
Definition: sc_vector.h:512
access_typeT::* member_type
Definition: sc_vector.h:520
const std::vector< sc_object * > & get_elements() const
Definition: sc_vector.h:763
const_reference at(size_type idx) const
Definition: sc_vector.h:549
void swap(sc_vector_assembly &that)
Definition: sc_vector.h:608
iterator operator()(ArgumentContainer &c)
Definition: sc_vector.h:579
const_iterator cbegin() const
Definition: sc_vector.h:530
iterator bind(BindableContainer &c)
Definition: sc_vector.h:557
iterator::pointer pointer
Definition: sc_vector.h:515
const_iterator::reference const_reference
Definition: sc_vector.h:516
iterator operator()(sc_vector_assembly< ContainerType, ArgumentType > c)
Definition: sc_vector.h:575
iterator bind(BindableIterator first, BindableIterator last, iterator from)
Definition: sc_vector.h:565
reference operator[](size_type idx)
Definition: sc_vector.h:543
const_iterator cend() const
Definition: sc_vector.h:532
iterator operator()(ArgumentIterator first, ArgumentIterator last, typename base_type::iterator from)
Definition: sc_vector.h:592
reference at(size_type idx)
Definition: sc_vector.h:545
sc_vector_assembly & operator=(sc_vector_assembly other_copy)
Definition: sc_vector.h:602
const_iterator end() const
Definition: sc_vector.h:537
iterator operator()(ArgumentIterator first, ArgumentIterator last, iterator from)
Definition: sc_vector.h:587
sc_vector_iter< const T, sc_member_access< const T, const MT > > const_iterator
Definition: sc_vector.h:507
iterator::reference reference
Definition: sc_vector.h:514
iterator operator()(ArgumentIterator first, ArgumentIterator last)
Definition: sc_vector.h:583
const_reference operator[](size_type idx) const
Definition: sc_vector.h:547
const char * kind() const
Definition: sc_vector.h:523
size_type size() const
Definition: sc_vector.h:540
void report_empty_bind(const char *kind_, bool dst_empty_) const
Definition: sc_vector.h:616
const char * name() const
Definition: sc_vector.h:522
iterator bind(BindableIterator first, BindableIterator last)
Definition: sc_vector.h:561
base_type::difference_type difference_type
Definition: sc_vector.h:513
sc_vector< T > base_type
Definition: sc_vector.h:503
const_iterator begin() const
Definition: sc_vector.h:535
const_iterator::pointer const_pointer
Definition: sc_vector.h:517
sc_vector_assembly(const sc_vector_assembly &other)
Definition: sc_vector.h:596
iterator bind(BindableIterator first, BindableIterator last, typename base_type::iterator from)
Definition: sc_vector.h:570
sc_vector_iter< T, sc_member_access< T, MT > > iterator
Definition: sc_vector.h:505
this_type operator-(difference_type n) const
Definition: sc_vector.h:315
friend class sc_vector_iter
Definition: sc_vector.h:253
std::ptrdiff_t difference_type
Definition: sc_vector.h:284
sc_vector_iter(const It &it)
Definition: sc_vector.h:302
std::random_access_iterator_tag iterator_category
Definition: sc_vector.h:283
this_type operator+(difference_type n) const
Definition: sc_vector.h:313
this_type operator--(int)
Definition: sc_vector.h:310
value_type & reference
Definition: sc_vector.h:286
this_type & operator-=(difference_type n)
Definition: sc_vector.h:319
this_type & operator--()
Definition: sc_vector.h:308
raw_iterator raw() const
Definition: sc_vector.h:333
this_type & operator++()
Definition: sc_vector.h:307
reference operator[](difference_type n) const
Definition: sc_vector.h:326
access_policy::type value_type
Definition: sc_vector.h:285
difference_type operator-(const_direct_iterator const &that) const
Definition: sc_vector.h:330
reference operator*() const
Definition: sc_vector.h:322
value_type * pointer
Definition: sc_vector.h:287
pointer operator->() const
Definition: sc_vector.h:324
this_type operator++(int)
Definition: sc_vector.h:309
this_type & operator+=(difference_type n)
Definition: sc_vector.h:318
void reserve(size_type n)
Definition: sc_vector.h:129
storage_type::iterator iterator
Definition: sc_vector.h:106
virtual sc_object * object_cast(void *) const =0
bool is_locked() const
Definition: sc_vector.h:100
const_iterator begin() const
Definition: sc_vector.h:147
std::vector< sc_object * > const & get_elements() const
storage_type::const_iterator const_iterator
Definition: sc_vector.h:107
std::vector< handle_type > storage_type
Definition: sc_vector.h:87
void check_index(size_type i) const
void * at(size_type i)
Definition: sc_vector.h:123
size_type size() const
Definition: sc_vector.h:95
void push_back(void *item)
Definition: sc_vector.h:135
static std::string make_name(const char *prefix, size_type index)
sc_vector_base(const char *prefix)
Definition: sc_vector.h:111
void stage_callback(const sc_stage &stage)
sc_object * implicit_cast(sc_object *p) const
Definition: sc_vector.h:152
bool check_init(size_type n) const
const_iterator end() const
Definition: sc_vector.h:148
sc_vector_element * handle_type
Definition: sc_vector.h:86
storage_type::difference_type difference_type
Definition: sc_vector.h:89
sc_object * implicit_cast(...) const
bool check_locked() const
const char * kind() const
Definition: sc_vector.h:91
void report_empty_bind(const char *kind_, bool dst_range_) const
void const * at(size_type i) const
Definition: sc_vector.h:126
storage_type::size_type size_type
Definition: sc_vector.h:88
sc_direct_access< plain_type > non_const_policy
Definition: sc_vector.h:187
sc_direct_access(const U &)
Definition: sc_vector.h:194
std::remove_const_t< type > plain_type
Definition: sc_vector.h:184
sc_direct_access< type > policy
Definition: sc_vector.h:186
ElementType element_type
Definition: sc_vector.h:182
type * get(type *this_) const
Definition: sc_vector.h:196
sc_direct_access< const plain_type > const_policy
Definition: sc_vector.h:188
ElementType element_type
Definition: sc_vector.h:208
std::remove_const_t< ElementType > plain_elem_type
Definition: sc_vector.h:213
sc_member_access< element_type, access_type > policy
Definition: sc_vector.h:215
sc_member_access(member_type ptr)
Definition: sc_vector.h:221
access_typeElementType::* member_type
Definition: sc_vector.h:210
sc_member_access< const plain_elem_type, const plain_type > const_policy
Definition: sc_vector.h:219
std::remove_const_t< type > plain_type
Definition: sc_vector.h:212
sc_member_access< plain_elem_type, plain_type > non_const_policy
Definition: sc_vector.h:217
sc_member_access(const non_const_policy &other)
Definition: sc_vector.h:224
access_type * get(element_type *this_) const
Definition: sc_vector.h:228