xalan-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mh...@apache.org
Subject cvs commit: xml-xalan/c/src/xalanc/Include XalanDeque.hpp XalanMemoryManagement.hpp XalanVector.hpp
Date Thu, 04 Nov 2004 23:11:03 GMT
mhoyt       2004/11/04 15:11:03

  Modified:    c/src/xalanc/Include XalanDeque.hpp
                        XalanMemoryManagement.hpp XalanVector.hpp
  Log:
  Fix to enable XalanDeque to work with values that require a MemoryManager and provide an
alternative to declaring a traits specialization.
  
  Revision  Changes    Path
  1.4       +4 -3      xml-xalan/c/src/xalanc/Include/XalanDeque.hpp
  
  Index: XalanDeque.hpp
  ===================================================================
  RCS file: /home/cvs/xml-xalan/c/src/xalanc/Include/XalanDeque.hpp,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- XalanDeque.hpp	17 Oct 2004 00:25:58 -0000	1.3
  +++ XalanDeque.hpp	4 Nov 2004 23:11:03 -0000	1.4
  @@ -156,7 +156,7 @@
   /**
    * Xalan implementation of deque
    */
  -template <class Type>
  +template <class Type, class ConstructionTraits = MemoryManagedConstructionTraits<Type>
>
   class XalanDeque
   {
   public:
  @@ -169,7 +169,7 @@
       typedef Type&           reference;
       typedef const Type&     const_reference;
   
  -    typedef XalanVector<Type>	    BlockType;
  +    typedef XalanVector<Type, ConstructionTraits>	    BlockType;
   
       typedef XalanVector<BlockType*> BlockIndexType;
   
  @@ -335,11 +335,12 @@
   
       void resize(size_type newSize)
       {
  +        typename ConstructionTraits::Constructor::ConstructableType defaultValue(*m_memoryManager);
           if (newSize > size())
           {
               for (size_type i = 0; i < newSize - size(); ++i)
               {
  -                push_back(value_type());
  +                push_back(defaultValue.value);
               }
           }
           else
  
  
  
  1.5       +38 -0     xml-xalan/c/src/xalanc/Include/XalanMemoryManagement.hpp
  
  Index: XalanMemoryManagement.hpp
  ===================================================================
  RCS file: /home/cvs/xml-xalan/c/src/xalanc/Include/XalanMemoryManagement.hpp,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- XalanMemoryManagement.hpp	17 Oct 2004 20:36:44 -0000	1.4
  +++ XalanMemoryManagement.hpp	4 Nov 2004 23:11:03 -0000	1.5
  @@ -32,11 +32,33 @@
   
   typedef XERCES_CPP_NAMESPACE_QUALIFIER MemoryManager		MemoryManagerType;
   
  +template <class C>
  +struct ConstructValueWithNoMemoryManager 
  +{   
  +    ConstructValueWithNoMemoryManager(MemoryManagerType& /*mgr*/) :
  +        value()
  +    {
  +    }
  +
  +    const C value;
  +};
  +
  +template <class C>
  +struct ConstructValueWithMemoryManager
  +{   
  +    ConstructValueWithMemoryManager(MemoryManagerType& mgr) :
  +        value(mgr)
  +    {
  +    }
   
  +    const C value;
  +};
   
   template <class C>
   struct ConstructWithNoMemoryManager
   {
  +    typedef ConstructValueWithNoMemoryManager<C>   ConstructableType;
  +
       static C* construct(C* address, MemoryManagerType& /* mgr */)
       {
           return (C*) new (address) C;
  @@ -51,6 +73,8 @@
   template <class C>
   struct ConstructWithMemoryManager
   {
  +    typedef ConstructValueWithNoMemoryManager<C>    ConstructableType;
  +
       static C* construct(C* address, MemoryManagerType& mgr)
       {
           return (C*) new (address) C(mgr);
  @@ -66,6 +90,7 @@
   struct MemoryManagedConstructionTraits
   {
       typedef ConstructWithNoMemoryManager<C> Constructor;
  +
   };
   
   #define  XALAN_USES_MEMORY_MANAGER(Type)  \
  @@ -76,6 +101,19 @@
       { \
           typedef ConstructWithMemoryManager<Type> Constructor; \
       };
  +
  +template <class C>
  +struct ConstructWithMemoryManagerTraits 
  +{
  +    typedef ConstructWithMemoryManager<C>       Constructor;
  +};
  +
  +template <class C>
  +struct ConstructWithNoMemoryManagerTraits
  +{
  +    typedef ConstructWithNoMemoryManager<C> Constructor;
  +};
  +
   
   
   
  
  
  
  1.8       +2 -2      xml-xalan/c/src/xalanc/Include/XalanVector.hpp
  
  Index: XalanVector.hpp
  ===================================================================
  RCS file: /home/cvs/xml-xalan/c/src/xalanc/Include/XalanVector.hpp,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- XalanVector.hpp	17 Oct 2004 00:25:58 -0000	1.7
  +++ XalanVector.hpp	4 Nov 2004 23:11:03 -0000	1.8
  @@ -50,7 +50,7 @@
   #pragma warning(disable: 4100)
   #endif
   
  -template <class Type>
  +template <class Type, class ConstructionTraits = MemoryManagedConstructionTraits<Type>
>
   class XalanVector
   {
   public:
  @@ -106,7 +106,7 @@
   
       typedef XalanVector<value_type>     ThisType;
   
  -    typedef typename MemoryManagedConstructionTraits<value_type>::Constructor Constructor;
  +    typedef typename ConstructionTraits::Constructor Constructor;
   
       XalanVector(
               MemoryManagerType*  theManager = 0,
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: xalan-cvs-unsubscribe@xml.apache.org
For additional commands, e-mail: xalan-cvs-help@xml.apache.org


Mime
View raw message