From a74e7460ca218551ac14e064e9c2bc5190c14774 Mon Sep 17 00:00:00 2001 From: khizmax Date: Fri, 3 Oct 2014 22:30:36 +0400 Subject: [PATCH] fix docs --- cds/gc/hzp/hzp.h | 2 + cds/gc/ptb/ptb.h | 6 +++ cds/intrusive/treiber_stack.h | 35 ++++++++++------ change.log | 1 + doxygen/cds.doxy | 1 + scripts/tab2space.pl | 78 ----------------------------------- 6 files changed, 32 insertions(+), 91 deletions(-) delete mode 100644 scripts/tab2space.pl diff --git a/cds/gc/hzp/hzp.h b/cds/gc/hzp/hzp.h index 26cf409a..59f50d9f 100644 --- a/cds/gc/hzp/hzp.h +++ b/cds/gc/hzp/hzp.h @@ -462,11 +462,13 @@ namespace cds { details::HPRec * m_pHzpRec ; ///< Pointer to thread's HZP record public: + /// Default constructor ThreadGC() : m_HzpManager( GarbageCollector::instance() ), m_pHzpRec( nullptr ) {} + /// The object is not copy-constructible ThreadGC( ThreadGC const& ) = delete; ~ThreadGC() diff --git a/cds/gc/ptb/ptb.h b/cds/gc/ptb/ptb.h index 6605f928..aa943932 100644 --- a/cds/gc/ptb/ptb.h +++ b/cds/gc/ptb/ptb.h @@ -497,6 +497,7 @@ namespace cds { namespace gc { : m_pGuard( nullptr ) {} + /// The object is not copy-constructible guard( guard const& ) = delete; /// Object destructor, does nothing @@ -628,7 +629,10 @@ namespace cds { namespace gc { /// Allocates array of guards from \p gc which must be the ThreadGC object of current thread GuardArray( ThreadGC& gc ) ; // inline below + /// The object is not default-constructible GuardArray() = delete; + + /// The object is not copy-constructible GuardArray( GuardArray const& ) = delete; /// Returns guards allocated back to pool @@ -899,12 +903,14 @@ namespace cds { namespace gc { details::guard_data * m_pFree ; ///< The list of free guard from m_pList public: + /// Default constructor ThreadGC() : m_gc( GarbageCollector::instance() ) , m_pList( nullptr ) , m_pFree( nullptr ) {} + /// The object is not copy-constructible ThreadGC( ThreadGC const& ) = delete; /// Dtor calls fini() diff --git a/cds/intrusive/treiber_stack.h b/cds/intrusive/treiber_stack.h index d82c9576..25787ac4 100644 --- a/cds/intrusive/treiber_stack.h +++ b/cds/intrusive/treiber_stack.h @@ -23,7 +23,7 @@ namespace cds { namespace intrusive { /** Template parameters: - GC - garbage collector used - - Tag - this argument serves as \ref cds_intrusive_hook_tag "a tag" + - Tag - a \ref cds_intrusive_hook_tag "tag" */ template using node = cds::intrusive::single_link::node< GC, Tag > ; @@ -32,7 +32,7 @@ namespace cds { namespace intrusive { /** \p Options are: - opt::gc - garbage collector used. - - opt::tag - \ref cds_intrusive_hook_tag "a tag" + - opt::tag - a \ref cds_intrusive_hook_tag "tag" */ template < typename... Options > using base_hook = cds::intrusive::single_link::base_hook< Options...>; @@ -44,7 +44,7 @@ namespace cds { namespace intrusive { \p Options are: - opt::gc - garbage collector used. - - opt::tag - \ref cds_intrusive_hook_tag "a tag" + - opt::tag - a \ref cds_intrusive_hook_tag "tag" */ template < size_t MemberOffset, typename... Options > using member_hook = cds::intrusive::single_link::member_hook< MemberOffset, Options... >; @@ -56,7 +56,7 @@ namespace cds { namespace intrusive { \p Options are: - opt::gc - garbage collector used. - - opt::tag - \ref cds_intrusive_hook_tag "a tag" + - opt::tag - a \ref cds_intrusive_hook_tag "tag" */ template using traits_hook = cds::intrusive::single_link::traits_hook< NodeTraits, Options... >; @@ -208,7 +208,7 @@ namespace cds { namespace intrusive { This is a wrapper for cds::opt::make_options< type_traits, Options...> Supported \p Options are: - - opt::hook - hook used. Possible values are: \p treiber_stack::base_hook, \p treiber_stack::member_hook, \p treiber_stack::traits_hook. + - opt::hook - hook used. Possible values are: treiber_stack::base_hook, treiber_stack::member_hook, treiber_stack::traits_hook. If the option is not specified, \p %treiber_stack::base_hook<> is used. - opt::back_off - back-off strategy used. If the option is not specified, the \p cds::backoff::Default is used. - opt::disposer - the functor used for dispose removed items. Default is \p opt::v::empty_disposer. This option is used only @@ -424,7 +424,7 @@ namespace cds { namespace intrusive { Template arguments: - \p GC - garbage collector type: gc::HP, gc::PTB. - Garbage collecting schema must be consistent with the treiber_stack::node GC. + Garbage collecting schema must be consistent with the \p treiber_stack::node GC. - \p T - type to be inserted into the stack - \p Traits - stack traits, default is \p treiber_stack::traits. You can use \p treiber_stack::make_traits metafunction to make your traits or just derive your traits from \p %treiber_stack::traits: @@ -433,6 +433,13 @@ namespace cds { namespace intrusive { typedef cds::intrusive::treiber_stack::stat<> stat; }; typedef cds::intrusive::TreiberStack< cds::gc::HP, Foo, myTraits > myStack; + + // Equivalent make_traits example: + typedef cds::intrusive::TreiberStack< cds::gc::HP, Foo, + typename cds::intrusive::treiber_stack::make_traits< + cds::opt::stat< cds::intrusive::treiber_stack::stat<> > + >::type + > myStack; \endcode @note Be careful when you want destroy an item popped, see \ref cds_intrusive_item_destroying "Destroying items of intrusive containers". @@ -443,7 +450,7 @@ namespace cds { namespace intrusive { Example of how to use \p treiber_stack::base_hook. Your class that objects will be pushed on \p %TreiberStack should be based on \p treiber_stack::node class \code - #include + #include #include namespace ci = cds::intrusive; @@ -457,7 +464,9 @@ namespace cds { namespace intrusive { // Stack type typedef ci::TreiberStack< gc, myData, - ci::opt::hook< ci::treiber_stack::base_hook< gc > > + typename cds::intrusive::treiber_stack::make_traits< + ci::opt::hook< ci::treiber_stack::base_hook< gc > > + >::type > stack_t; // Stack with elimination back-off enabled @@ -472,7 +481,7 @@ namespace cds { namespace intrusive { Example of how to use \p treiber_stack::base_hook with different tags. \code - #include + #include #include namespace ci = cds::intrusive; @@ -499,11 +508,11 @@ namespace cds { namespace intrusive { typedef ci::TreiberStack< gc, myData, typename ci::treiber_stack::make_traits< - ci::opt::hook< ci::treiber_stack::base_hook< gc, tag2 > + ci::opt::hook< ci::treiber_stack::base_hook< gc, tag2 > > >::type > stack2_t; - // You may add myData objects in the objects of type stack1_t and stack2_t independently + // You may add myData objects into stack1_t and stack2_t independently void foo() { stack1_t s1; stack2_t s2; @@ -527,7 +536,7 @@ namespace cds { namespace intrusive { Your class that will be pushed on \p %TreiberStack should have a member of type \p treiber_stack::node \code #include // offsetof macro - #include + #include #include namespace ci = cds::intrusive; @@ -543,7 +552,7 @@ namespace cds { namespace intrusive { typedef ci::TreiberStack< gc, myData, typename ci::treiber_stack::make_traits< - ci::opt::hook< ci::treiber_stack::member_hook< offsetof(myData, member_hook_), gc > + ci::opt::hook< ci::treiber_stack::member_hook< offsetof(myData, member_hook_), gc >> >::type > stack_t; \endcode diff --git a/change.log b/change.log index 126b3db5..acc33a43 100644 --- a/change.log +++ b/change.log @@ -3,6 +3,7 @@ - switch to C++11 standard - Removed: MichaelDeque, reason: the implementation is heavy-weighted, inefficient, and, seems, unstable. + - Added: cds::container::TreiberStack::pop_with( Func ) 1.6.0 23.09.2014 General release diff --git a/doxygen/cds.doxy b/doxygen/cds.doxy index 03587f9b..cf679bfa 100644 --- a/doxygen/cds.doxy +++ b/doxygen/cds.doxy @@ -1401,6 +1401,7 @@ PREDEFINED = CDS_BUILD_BITS=64 \ CDS_CXX11_DECLTYPE_SUPPORT \ CDS_NOEXCEPT=noexcept() \ CDS_CONSTEXPR=constexpr \ + CDS_CONSTEXPR_CONST="constexpr const" \ CDS_ATOMIC=std \ CDS_DELETE_SPECIFIER="=delete"\ CDS_DEFAULT_SPECIFIER="=default" diff --git a/scripts/tab2space.pl b/scripts/tab2space.pl deleted file mode 100644 index 6fb1bf65..00000000 --- a/scripts/tab2space.pl +++ /dev/null @@ -1,78 +0,0 @@ - - -sub processDir( $ ) -{ - my $dirName = shift ; - - opendir(my $dh, $dirName) || die "can't opendir $dirName: $!"; - my @files = grep { /^[^\.]/ } readdir($dh); - closedir $dh; - - foreach my $file ( @files ) { - if ( -d "$dirName/$file" ) { - processDir("$dirName/$file") ; - } - elsif ( $file =~ /\.(h|cpp)$/ ) { - processFile( "$dirName/$file" ) ; - } - } -} - -sub processFile( $ ) -{ - my $file = shift ; - - if ( open( my $fh, $file )) { - binmode $fh ; - my $str = '' ; - my $bTabified = 0 ; - while (<$fh>) { - my $s = $_ ; - if ( $str eq '' ) { - unless ( $s =~ m#//\$\$CDS-header\$\$# ) { - $str .= '//$$CDS-header$$'."\n\n" ; - $bTabified = 1 ; - } - } - while ( $s =~ /\t/ ) { - #print "pos=", $+[0], "\n" ; - $bTabified = 1 ; - my $pos = $+[0] ; - if ( $pos ) { - $pos -= 1 ; - if ( $pos % 4 == 0 ) { - $s =~ s/\t/ / ; - } - elsif ( $pos % 4 == 1 ) { - $s =~ s/\t/ / ; - } - elsif ( $pos % 4 == 2 ) { - $s =~ s/\t/ / ; - } - elsif ( $pos % 4 == 3 ) { - $s =~ s/\t/ / ; - } - } - } - $bTabified = 1 if $s =~ s/[\t ]+([\n\r]+)$/$1/ ; - $str .= $s ; - } - close $fh ; - - if ( $bTabified ) { - print $file, "\n" ; - if ( open( my $fh, ">$file" )) { - binmode $fh ; - print $fh $str ; - close $fh ; - } - } - } -} - -chdir ('..') ; -processDir('cds') ; -processDir('src') ; -processDir('tests/unit') ; - -exit; \ No newline at end of file -- 2.34.1