VirtualBox

Changeset 36654 in vbox for trunk/include/iprt/cpp


Ignore:
Timestamp:
Apr 12, 2011 12:42:35 PM (14 years ago)
Author:
vboxsync
Message:

iprt-cpp/list: added RTMEMEF_NEW_AND_DELETE_OPERATORS; changed private data to protected; docs

Location:
trunk/include/iprt/cpp
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/iprt/cpp/list.h

    r36573 r36654  
    120120    inline void enterWrite() {}
    121121    inline void leaveWrite() {}
     122
     123    /* Define our own new and delete. */
     124    RTMEMEF_NEW_AND_DELETE_OPERATORS();
    122125};
    123126
     
    193196{
    194197    /**
     198     * Traits
     199     *
    195200     * Defines the return type of most of the getter methods. If the internal
    196201     * used type is a pointer, we return a reference. If not we return by
     
    221226     *
    222227     * The other list will be fully copied and the capacity will be the same as
    223      * the size if the other list.
     228     * the size of the other list.
    224229     *
    225230     * @param   other          The list to copy.
     
    688693    }
    689694
     695    /* Define our own new and delete. */
     696    RTMEMEF_NEW_AND_DELETE_OPERATORS();
     697
    690698    /**
    691699     * The default capacity of the list. This is also used as grow factor.
    692700     */
    693701    static const size_t DefaultCapacity;
    694 private:
     702
     703protected:
    695704
    696705    /**
     
    779788class RTCList : public RTCListBase<T, ITYPE, false>
    780789{
     790    /* Traits */
    781791    typedef RTCListBase<T, ITYPE, false> BASE;
     792
    782793public:
     794    /**
     795     * Creates a new list.
     796     *
     797     * This preallocates @a cCapacity elements within the list.
     798     *
     799     * @param   cCapacitiy   The initial capacity the list has.
     800     * @throws  std::bad_alloc
     801     */
    783802    RTCList(size_t cCapacity = BASE::DefaultCapacity)
    784803     : BASE(cCapacity) {}
     804
     805    /* Define our own new and delete. */
     806    RTMEMEF_NEW_AND_DELETE_OPERATORS();
    785807};
    786808
     
    794816class RTCList<uint64_t>: public RTCListBase<uint64_t, uint64_t, false>
    795817{
     818    /* Traits */
    796819    typedef RTCListBase<uint64_t, uint64_t, false> BASE;
     820
    797821public:
     822    /**
     823     * Creates a new list.
     824     *
     825     * This preallocates @a cCapacity elements within the list.
     826     *
     827     * @param   cCapacitiy   The initial capacity the list has.
     828     * @throws  std::bad_alloc
     829     */
    798830    RTCList(size_t cCapacity = BASE::DefaultCapacity)
    799831     : BASE(cCapacity) {}
     832
     833    /* Define our own new and delete. */
     834    RTMEMEF_NEW_AND_DELETE_OPERATORS();
    800835};
    801836
     
    809844class RTCList<int64_t>: public RTCListBase<int64_t, int64_t, false>
    810845{
     846    /* Traits */
    811847    typedef RTCListBase<int64_t, int64_t, false> BASE;
     848
    812849public:
     850    /**
     851     * Creates a new list.
     852     *
     853     * This preallocates @a cCapacity elements within the list.
     854     *
     855     * @param   cCapacitiy   The initial capacity the list has.
     856     * @throws  std::bad_alloc
     857     */
    813858    RTCList(size_t cCapacity = BASE::DefaultCapacity)
    814859     : BASE(cCapacity) {}
     860
     861    /* Define our own new and delete. */
     862    RTMEMEF_NEW_AND_DELETE_OPERATORS();
    815863};
    816864
  • trunk/include/iprt/cpp/mtlist.h

    r36563 r36654  
    4949    inline void leaveWrite()      { int rc = RTSemRWReleaseWrite(m_hRWSem); AssertRC(rc); }
    5050
     51    /* Define our own new and delete. */
     52    RTMEMEF_NEW_AND_DELETE_OPERATORS();
     53
    5154private:
    5255    mutable RTSEMRW m_hRWSem;
     
    7275class RTCMTList : public RTCListBase<T, ITYPE, true>
    7376{
     77    /* Traits */
    7478    typedef RTCListBase<T, ITYPE, true> BASE;
     79
    7580public:
     81    /**
     82     * Creates a new list.
     83     *
     84     * This preallocates @a cCapacity elements within the list.
     85     *
     86     * @param   cCapacitiy   The initial capacity the list has.
     87     * @throws  std::bad_alloc
     88     */
    7689    RTCMTList(size_t cCapacity = BASE::DefaultCapacity)
    7790     : BASE(cCapacity) {}
     91
     92    /* Define our own new and delete. */
     93    RTMEMEF_NEW_AND_DELETE_OPERATORS();
    7894};
    7995
     
    87103class RTCMTList<uint64_t>: public RTCListBase<uint64_t, uint64_t, true>
    88104{
     105    /* Traits */
    89106    typedef RTCListBase<uint64_t, uint64_t, true> BASE;
     107
    90108public:
     109    /**
     110     * Creates a new list.
     111     *
     112     * This preallocates @a cCapacity elements within the list.
     113     *
     114     * @param   cCapacitiy   The initial capacity the list has.
     115     * @throws  std::bad_alloc
     116     */
    91117    RTCMTList(size_t cCapacity = BASE::DefaultCapacity)
    92118     : BASE(cCapacity) {}
     119
     120    /* Define our own new and delete. */
     121    RTMEMEF_NEW_AND_DELETE_OPERATORS();
    93122};
    94123
     
    102131class RTCMTList<int64_t>: public RTCListBase<int64_t, int64_t, true>
    103132{
     133    /* Traits */
    104134    typedef RTCListBase<int64_t, int64_t, true> BASE;
     135
    105136public:
     137    /**
     138     * Creates a new list.
     139     *
     140     * This preallocates @a cCapacity elements within the list.
     141     *
     142     * @param   cCapacitiy   The initial capacity the list has.
     143     * @throws  std::bad_alloc
     144     */
    106145    RTCMTList(size_t cCapacity = BASE::DefaultCapacity)
    107146     : BASE(cCapacity) {}
     147
     148    /* Define our own new and delete. */
     149    RTMEMEF_NEW_AND_DELETE_OPERATORS();
    108150};
    109151
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette