You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficserver.apache.org by am...@apache.org on 2011/07/12 17:57:26 UTC

svn commit: r1145640 - in /trafficserver/traffic/trunk/lib/ts: IntrusiveDList.h IpMap.cc IpMap.h

Author: amc
Date: Tue Jul 12 15:57:25 2011
New Revision: 1145640

URL: http://svn.apache.org/viewvc?rev=1145640&view=rev
Log:
Comment and license fixes

Modified:
    trafficserver/traffic/trunk/lib/ts/IntrusiveDList.h
    trafficserver/traffic/trunk/lib/ts/IpMap.cc
    trafficserver/traffic/trunk/lib/ts/IpMap.h

Modified: trafficserver/traffic/trunk/lib/ts/IntrusiveDList.h
URL: http://svn.apache.org/viewvc/trafficserver/traffic/trunk/lib/ts/IntrusiveDList.h?rev=1145640&r1=1145639&r2=1145640&view=diff
==============================================================================
--- trafficserver/traffic/trunk/lib/ts/IntrusiveDList.h (original)
+++ trafficserver/traffic/trunk/lib/ts/IntrusiveDList.h Tue Jul 12 15:57:25 2011
@@ -1,6 +1,47 @@
 # if ! defined(TS_INTRUSIVE_DOUBLE_LIST_HEADER)
 # define TS_INTRUSIVE_DOUBLE_LIST_HEADER
 
+/** @file
+
+    Intrusive double linked list container.
+
+    This provide support for a doubly linked list container for an
+    arbitrary class that uses the class directly and not wrapped. It
+    requires the class to provide the list pointers.
+
+    @note This is a header only library.
+
+    @note Due to bugs in either the C++ standard or gcc (or both), the
+    link members @b must be declared in the class used for the
+    list. If they are declared in a super class you will get "could
+    not convert template argument" errors, even though it should
+    work. This is because @c &T::m is of type @c S::* if @c S is a
+    super class of @c T and @c m is declared in @c S. My view is that
+    if I write "&T::m" I want a "T::*" and the compiler shouldn't go
+    rummaging through the class hierarchy for some other type. For
+    MSVC you can @c static_cast the template arguments as a
+    workaround, but not in gcc.
+
+    @section license License
+
+    Licensed to the Apache Software Foundation (ASF) under one
+    or more contributor license agreements.  See the NOTICE file
+    distributed with this work for additional information
+    regarding copyright ownership.  The ASF licenses this file
+    to you under the Apache License, Version 2.0 (the
+    "License"); you may not use this file except in compliance
+    with the License.  You may obtain a copy of the License at
+
+    http://www.apache.org/licenses/LICENSE-2.0
+
+    Unless required by applicable law or agreed to in writing, software
+    distributed under the License is distributed on an "AS IS" BASIS,
+    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+    See the License for the specific language governing permissions and
+    limitations under the License.
+
+ */
+
 # if USE_STL
 #   include <iterator>
 # else
@@ -9,9 +50,7 @@ namespace std {
 }
 # endif
 
-/** @file
-
-    Intrusive double linked list container.
+/** Intrusive doubly linked list container.
 
     This holds items in a doubly linked list using members of the
     items.  Elements are copied in to the list. No memory management
@@ -45,38 +84,21 @@ namespace std {
     and/or @c getTail methods to get the first and last elements in
     the list respectively.
 
-    @note This is a header only library.
-
-    @note Due to bugs in either the C++ standard or gcc (or both), the
-    link members @b must be declared in the class used for the
-    list. If they are declared in a super class you will get "could
-    not convert template argument" errors, even though it should
-    work. This is because @c &T::m is of type @c S::* if @c S is a
-    super class of @c T and @c m is declared in @c S. My view is that
-    if I write "&T::m" I want a "T::*" and the compiler shouldn't go
-    rummaging through the class hierarchy for some other type. For
-    MSVC you can @c static_cast the template arguments as a
-    workaround, but not in gcc.
-
-    @section license License
-
-    Licensed to the Apache Software Foundation (ASF) under one
-    or more contributor license agreements.  See the NOTICE file
-    distributed with this work for additional information
-    regarding copyright ownership.  The ASF licenses this file
-    to you under the Apache License, Version 2.0 (the
-    "License"); you may not use this file except in compliance
-    with the License.  You may obtain a copy of the License at
+    @note Due to bugs in various compilers or the C++ specification
+    (or both) it is not possible in general to declare the element
+    pointers in a super class. The template argument @c T must be
+    exactly the same @c T as for the element pointers, even though a
+    pointer to member of a superclass should be trivially coerced to a
+    pointer to member of subclass. MSVC permits an explicit cast in
+    this case, but gcc does not and therefore there is no way to do
+    this. It is most vexing.
+
+    P.S. I think it's a compiler bug personally with regard to the
+    type of an expression of the form @c &T::M is not @c T::* if @c M
+    is declared in a superclass S. In that case the type is @c S::*
+    which seems very wrong to me.
 
-    http://www.apache.org/licenses/LICENSE-2.0
-
-    Unless required by applicable law or agreed to in writing, software
-    distributed under the License is distributed on an "AS IS" BASIS,
-    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-    See the License for the specific language governing permissions and
-    limitations under the License.
-
- */
+  */
 template <
   typename T, ///< Type of list element.
   T* (T::*N), ///< Member to use for pointer to next element.

Modified: trafficserver/traffic/trunk/lib/ts/IpMap.cc
URL: http://svn.apache.org/viewvc/trafficserver/traffic/trunk/lib/ts/IpMap.cc?rev=1145640&r1=1145639&r2=1145640&view=diff
==============================================================================
--- trafficserver/traffic/trunk/lib/ts/IpMap.cc (original)
+++ trafficserver/traffic/trunk/lib/ts/IpMap.cc Tue Jul 12 15:57:25 2011
@@ -1,14 +1,38 @@
 # include "IpMap.h"
-// # include <iostream>
 
-/*  Don't bother to look at this code if you don't know how a
-    red/black tree works. There are so many good references on the
+/** @file
+    IP address map support.
+
+    Provide the ability to create a range based mapping for the IP
+    address space. Addresses can be added and removed and each address
+    is associated with arbitrary client data.
+
+    @internal Don't bother to look at this code if you don't know how
+    a red/black tree works. There are so many good references on the
     subject it's a waste to have some inferior version here. The
     methods on @c Node follow the standard implementation except for
     being parameterized by direction (so that, for instance, right
     rotate and left rotate are both done by the @c rotate method with
     a direction argument).
-*/
+
+    @section license License
+
+    Licensed to the Apache Software Foundation (ASF) under one
+    or more contributor license agreements.  See the NOTICE file
+    distributed with this work for additional information
+    regarding copyright ownership.  The ASF licenses this file
+    to you under the Apache License, Version 2.0 (the
+    "License"); you may not use this file except in compliance
+    with the License.  You may obtain a copy of the License at
+
+    http://www.apache.org/licenses/LICENSE-2.0
+
+    Unless required by applicable law or agreed to in writing, software
+    distributed under the License is distributed on an "AS IS" BASIS,
+    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+    See the License for the specific language governing permissions and
+    limitations under the License.
+ */
 
 // Validation / printing disabled until I figure out how to generalize so
 // as to not tie reporting into a particular project environment.

Modified: trafficserver/traffic/trunk/lib/ts/IpMap.h
URL: http://svn.apache.org/viewvc/trafficserver/traffic/trunk/lib/ts/IpMap.h?rev=1145640&r1=1145639&r2=1145640&view=diff
==============================================================================
--- trafficserver/traffic/trunk/lib/ts/IpMap.h (original)
+++ trafficserver/traffic/trunk/lib/ts/IpMap.h Tue Jul 12 15:57:25 2011
@@ -1,7 +1,6 @@
 # if ! defined(TS_IP_MAP_HEADER)
 # define TS_IP_MAP_HEADER
 
-# include <ts/ink_assert.h>
 # include <ts/ink_inet.h>
 # include <ts/IntrusiveDList.h>
 
@@ -55,17 +54,19 @@ namespace ts { namespace detail {
   class Ip6Map; // Forward declare.
 
   /** A node in a red/black tree.
+
       This class provides only the basic tree operations. The client
-      must provide the search and decision logic. This enables this class
-      to be a base class for templated nodes with much less code duplication.
+      must provide the search and decision logic. This enables this
+      class to be a base class for templated nodes with much less code
+      duplication.
   */
   struct RBNode {
-    typedef RBNode self; //!< self reference type
+    typedef RBNode self; ///< self reference type
 
-    //! Node colors
+    /// Node colors
     typedef enum { RED, BLACK } Color;
 
-    //! Directional constants
+    /// Directional constants
     typedef enum { NONE, LEFT, RIGHT } Direction;
 
     /// Get a child by direction.
@@ -94,8 +95,8 @@ namespace ts { namespace detail {
     /// @return The color of the node.
     Color getColor() const { return _color; }
 
-    //! Reverse a direction
-    /** @return @c LEFT if @a d is @c RIGHT, @c RIGHT if @a d is @c LEFT,
+    /** Reverse a direction
+        @return @c LEFT if @a d is @c RIGHT, @c RIGHT if @a d is @c LEFT,
         @c NONE otherwise.
     */
     Direction flip(Direction d) {
@@ -234,7 +235,7 @@ namespace ts { namespace detail {
     not supported (any particular range of addresses must be a single
     protocol but ranges of both types can be in the map).
 
-    Use @c mark to mark / set/ add addresses to the map.
+    Use @c mark to mark / set / add addresses to the map.
     Use @c unmark to unset addresses (setting the client data to 0 does
     @b not remove the address -- this is for the convenience of clients
     that do not need data, only membership). @c contains tests for