Oracle Coherence for C++ API
Release 3.7.0.0

E18684-01

coherence/util/WrapperCollections.hpp

00001 /*
00002 * WrapperCollections.hpp
00003 *
00004 * Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.
00005 *
00006 * Oracle is a registered trademarks of Oracle Corporation and/or its
00007 * affiliates.
00008 *
00009 * This software is the confidential and proprietary information of Oracle
00010 * Corporation. You shall not disclose such confidential and proprietary
00011 * information and shall use it only in accordance with the terms of the
00012 * license agreement you entered into with Oracle.
00013 *
00014 * This notice may not be removed or altered.
00015 */
00016 #ifndef COH_WRAPPER_COLLECTIONS_HPP
00017 #define COH_WRAPPER_COLLECTIONS_HPP
00018 
00019 #include "coherence/lang.ns"
00020 
00021 #include "coherence/util/Collection.hpp"
00022 #include "coherence/util/Iterator.hpp"
00023 #include "coherence/util/List.hpp"
00024 #include "coherence/util/ListIterator.hpp"
00025 #include "coherence/util/Map.hpp"
00026 #include "coherence/util/Muterator.hpp"
00027 #include "coherence/util/Set.hpp"
00028 
00029 #include <cstddef>
00030 #include <ostream>
00031 
00032 COH_OPEN_NAMESPACE2(coherence,util)
00033 
00034 
00035 /**
00036 * A collection of abstract Collection implementation classes for wrapping
00037 * Collection types.
00038 *
00039 * @author mf  2007.07.05
00040 */
00041 class COH_EXPORT WrapperCollections
00042     {
00043     // ----- inner classes --------------------------------------------------
00044 
00045     public:
00046         /**
00047         * Iterator implementation which delegates all calls to another
00048         * Iterator.
00049         */
00050         class COH_EXPORT AbstractWrapperIterator
00051             : public abstract_spec<AbstractWrapperIterator,
00052                 extends<Object>,
00053                 implements<Muterator> >
00054             {
00055             // ----- constructors ---------------------------------------
00056 
00057             protected:
00058                 /**
00059                 * Create an AbstractWrapperIterator which delegates to the
00060                 * specified Iterator.
00061                 *
00062                 * @param hiterDelegate a handle to the specified delegate
00063                 *        Iterator
00064                 */
00065                 AbstractWrapperIterator(Iterator::Handle hiterDelegate);
00066 
00067                 /**
00068                 * Copy constructor.
00069                 */
00070                 AbstractWrapperIterator(const AbstractWrapperIterator& that);
00071 
00072 
00073             // ----- Iterator interface ---------------------------------
00074 
00075             public:
00076                 /**
00077                 * {@inheritDoc}
00078                 */
00079                 virtual bool hasNext() const;
00080 
00081                 /**
00082                 * {@inheritDoc}
00083                 */
00084                 virtual Object::Holder next();
00085 
00086 
00087             // ----- Muterator interface --------------------------------
00088 
00089             public:
00090                 /**
00091                 * {@inheritDoc}
00092                 */
00093                 virtual void remove();
00094 
00095             // ----- Object interface -----------------------------------
00096 
00097             public:
00098                 /**
00099                 * {@inheritDoc}
00100                 */
00101                 virtual void toStream(std::ostream& out) const;
00102 
00103                 /**
00104                 * {@inheritDoc}
00105                 */
00106                 virtual size32_t hashCode() const;
00107 
00108                 /**
00109                 * {@inheritDoc}
00110                 */
00111                 virtual bool equals(Object::View v) const;
00112 
00113 
00114             // ----- accessors ------------------------------------------
00115 
00116             protected:
00117                 /**
00118                 * Return a handle to the delegate.
00119                 *
00120                 * @return the delegate handle
00121                 *
00122                 * @throw UnsupportedOperationException if the delegate is a
00123                 *        view
00124                 */
00125                 virtual Iterator::Handle getDelegate();
00126 
00127                 /**
00128                 * Return a view to the delegate.
00129                 *
00130                 * @return the delegate view
00131                 */
00132                 virtual Iterator::View getDelegate() const;
00133 
00134             // ----- data members ---------------------------------------
00135 
00136             private:
00137                 /**
00138                 * The Iterator to which this wrapper delegates.
00139                 */
00140                 FinalHolder<Iterator> m_ohDelegate;
00141             };
00142 
00143 
00144         /**
00145         * ListIterator implementation which delegates all calls to another
00146         * ListIterator.
00147         */
00148         class COH_EXPORT AbstractWrapperListIterator
00149             : public abstract_spec<AbstractWrapperListIterator,
00150                 extends<AbstractWrapperIterator>,
00151                 implements<ListMuterator> >
00152             {
00153             // ----- constructors ---------------------------------------
00154 
00155             protected:
00156                 /**
00157                 * Create an AbstractWrapperListIterator which delegates to
00158                 * the specified ListIterator.
00159                 *
00160                 * @param hIterDelegate  the Iterator to delegate to
00161                 */
00162                 AbstractWrapperListIterator(
00163                         ListIterator::Handle hIterDelegate);
00164 
00165                 /**
00166                 * Copy constructor.
00167                 */
00168                 AbstractWrapperListIterator(
00169                         const AbstractWrapperListIterator& that);
00170 
00171             // ----- ListIterator interface ----------------------------
00172 
00173             public:
00174                 /**
00175                 * {@inheritDoc}
00176                 */
00177                 virtual bool hasPrevious() const;
00178 
00179                 /**
00180                 * {@inheritDoc}
00181                 */
00182                 virtual Object::Holder previous();
00183 
00184                 /**
00185                 * {@inheritDoc}
00186                 */
00187                 virtual size32_t nextIndex() const;
00188 
00189                 /**
00190                 * {@inheritDoc}
00191                 */
00192                 virtual size32_t previousIndex() const;
00193 
00194             // ----- ListMuterator interface ----------------------------
00195 
00196             public:
00197                 /**
00198                 * {@inheritDoc}
00199                 */
00200                 virtual void remove();
00201                 /**
00202                 * {@inheritDoc}
00203                 */
00204                 virtual void add(Object::Holder oh);
00205 
00206                 /**
00207                 * {@inheritDoc}
00208                 */
00209                 virtual void set(Object::Holder oh);
00210 
00211             // ----- Iterator interface ---------------------------------
00212 
00213             public:
00214                 /**
00215                 * {@inheritDoc}
00216                 */
00217                 virtual bool hasNext() const;
00218 
00219                 /**
00220                 * {@inheritDoc}
00221                 */
00222                 virtual Object::Holder next();
00223 
00224 
00225             // ----- helper methods -------------------------------------
00226 
00227             protected:
00228                 /**
00229                 * Return a handle to the delegate.
00230                 *
00231                 * @return the delegate handle
00232                 *
00233                 * @throw UnsupportedOperationException if the delegate is a
00234                 *        view
00235                 */
00236                 virtual ListIterator::Handle getListDelegate();
00237 
00238                 /**
00239                 * Return a view to the delegate.
00240                 *
00241                 * @return the delegate view
00242                 */
00243                 virtual ListIterator::View getListDelegate() const;
00244 
00245 
00246             // ----- data members -------------------------------------------
00247 
00248             private:
00249                 /**
00250                 * The ListIterator to which this wrapper delegates.
00251                 */
00252                 FinalHolder<ListIterator> m_ohDelegate;
00253             };
00254 
00255 
00256         /**
00257         * Collection implementation which delegates all calls to another
00258         * Collection.
00259         */
00260         class COH_EXPORT AbstractWrapperCollection
00261             : public abstract_spec<AbstractWrapperCollection,
00262                 extends<Object>,
00263                 implements<Collection> >
00264             {
00265             // ----- constructors ---------------------------------------
00266 
00267             protected:
00268                 /**
00269                 * Create an AbstractWrapperCollection which delegates to the
00270                 * specified Collection.
00271                 *
00272                 * @param ohCollDelegate  the Collection to delegate to
00273                 */
00274                 AbstractWrapperCollection(Collection::Holder ohCollDelegate);
00275 
00276                 /**
00277                 * Copy constructor.
00278                 */
00279                 AbstractWrapperCollection(const AbstractWrapperCollection& that);
00280 
00281             // ----- Collection interface -------------------------------
00282 
00283             public:
00284                 /**
00285                 * {@inheritDoc}
00286                 */
00287                 virtual size32_t size() const;
00288 
00289                 /**
00290                 * {@inheritDoc}
00291                 */
00292                 virtual bool isEmpty() const;
00293 
00294                 /**
00295                 * {@inheritDoc}
00296                 */
00297                 virtual bool contains(Object::View v) const;
00298 
00299                 /**
00300                 * {@inheritDoc}
00301                 */
00302                 virtual Iterator::Handle iterator() const;
00303 
00304                 /**
00305                 * {@inheritDoc}
00306                 */
00307                 virtual Muterator::Handle iterator();
00308 
00309                 /**
00310                 * {@inheritDoc}
00311                 */
00312                 virtual ObjectArray::Handle toArray(
00313                         ObjectArray::Handle hao = NULL) const;
00314 
00315                 /**
00316                 * {@inheritDoc}
00317                 */
00318                 virtual bool add(Object::Holder oh);
00319 
00320                 /**
00321                 * {@inheritDoc}
00322                 */
00323                 virtual bool remove(Object::View v);
00324 
00325                 /**
00326                 * {@inheritDoc}
00327                 */
00328                 virtual bool containsAll(Collection::View vc) const;
00329 
00330                 /**
00331                 * {@inheritDoc}
00332                 */
00333                 virtual bool addAll(Collection::View vc);
00334 
00335                 /**
00336                 * {@inheritDoc}
00337                 */
00338                 virtual bool removeAll(Collection::View vc);
00339 
00340                 /**
00341                 * {@inheritDoc}
00342                 */
00343                 virtual bool retainAll(Collection::View vc);
00344 
00345                 /**
00346                 * {@inheritDoc}
00347                 */
00348                 virtual void clear();
00349 
00350             // ----- Object interface -----------------------------------
00351 
00352             public:
00353                 /**
00354                 * {@inheritDoc}
00355                 */
00356                 virtual void toStream(std::ostream& out) const;
00357 
00358                 /**
00359                 * {@inheritDoc}
00360                 */
00361                 virtual size32_t hashCode() const;
00362 
00363                 /**
00364                 * {@inheritDoc}
00365                 */
00366                 virtual bool equals(Object::View v) const;
00367 
00368                 /**
00369                 * {@inheritDoc}
00370                 */
00371                 virtual bool isImmutable() const;
00372 
00373             // ----- accessors ------------------------------------------
00374 
00375             protected:
00376                 /**
00377                 * Return a handle to the delegate.
00378                 *
00379                 * @return the delegate handle
00380                 *
00381                 * @throw UnsupportedOperationException if the delegate is a
00382                 *        view
00383                 */
00384                 virtual Collection::Handle getDelegate();
00385 
00386                 /**
00387                 * Return a view to the delegate.
00388                 *
00389                 * @return the delegate view
00390                 */
00391                 virtual Collection::View getDelegate() const;
00392 
00393             // ----- data members ---------------------------------------
00394 
00395             private:
00396                 /**
00397                 * The Collection to which this wrapper delegates.
00398                 */
00399                 FinalHolder<Collection> m_ohDelegate;
00400             };
00401 
00402         /**
00403         * Set implementation which delegates all calls to another Set.
00404         */
00405         class COH_EXPORT AbstractWrapperSet
00406             : public abstract_spec<AbstractWrapperSet,
00407                 extends<Object>,
00408                 implements<Set> >
00409             {
00410             // ----- constructors ---------------------------------------
00411 
00412             protected:
00413                 /**
00414                 * Create an AbstractWrapperSet which delegates to the
00415                 * specified Set.
00416                 *
00417                 * @param ohSetDelegate  the Set to delegate to
00418                 */
00419                 AbstractWrapperSet(Set::Holder ohSetDelegate);
00420 
00421                 /**
00422                 * Copy constructor.
00423                 */
00424                 AbstractWrapperSet(const AbstractWrapperSet& that);
00425 
00426             // ----- Set interface --------------------------------------
00427 
00428             public:
00429                 /**
00430                 * {@inheritDoc}
00431                 */
00432                 virtual size32_t size() const;
00433 
00434                 /**
00435                 * {@inheritDoc}
00436                 */
00437                 virtual bool isEmpty() const;
00438 
00439                 /**
00440                 * {@inheritDoc}
00441                 */
00442                 virtual bool contains(Object::View v) const;
00443 
00444                 /**
00445                 * {@inheritDoc}
00446                 */
00447                 virtual Iterator::Handle iterator() const;
00448 
00449                 /**
00450                 * {@inheritDoc}
00451                 */
00452                 virtual Muterator::Handle iterator();
00453 
00454                 /**
00455                 * {@inheritDoc}
00456                 */
00457                 virtual ObjectArray::Handle toArray(
00458                         ObjectArray::Handle hao = NULL) const;
00459 
00460                 /**
00461                 * {@inheritDoc}
00462                 */
00463                 virtual bool add(Object::Holder oh);
00464 
00465                 /**
00466                 * {@inheritDoc}
00467                 */
00468                 virtual bool remove(Object::View v);
00469 
00470                 /**
00471                 * {@inheritDoc}
00472                 */
00473                 virtual bool containsAll(Collection::View vc) const;
00474 
00475                 /**
00476                 * {@inheritDoc}
00477                 */
00478                 virtual bool addAll(Collection::View vc);
00479 
00480                 /**
00481                 * {@inheritDoc}
00482                 */
00483                 virtual bool removeAll(Collection::View vc);
00484 
00485                 /**
00486                 * {@inheritDoc}
00487                 */
00488                 virtual bool retainAll(Collection::View vc);
00489 
00490                 /**
00491                 * {@inheritDoc}
00492                 */
00493                 virtual void clear();
00494 
00495             // ----- Object interface -----------------------------------
00496 
00497             public:
00498                 /**
00499                 * {@inheritDoc}
00500                 */
00501                 virtual void toStream(std::ostream& out) const;
00502 
00503                 /**
00504                 * {@inheritDoc}
00505                 */
00506                 virtual size32_t hashCode() const;
00507 
00508                 /**
00509                 * {@inheritDoc}
00510                 */
00511                 virtual bool equals(Object::View v) const;
00512 
00513                 /**
00514                 * {@inheritDoc}
00515                 */
00516                 virtual bool isImmutable() const;
00517 
00518             // ----- accessors ------------------------------------------
00519 
00520             protected:
00521                 /**
00522                 * Return a handle to the delegate.
00523                 *
00524                 * @return the delegate handle
00525                 *
00526                 * @throw UnsupportedOperationException if the delegate is a
00527                 *        view
00528                 */
00529                 virtual Set::Handle getDelegate();
00530 
00531                 /**
00532                 * Return a view to the delegate.
00533                 *
00534                 * @return the delegate view
00535                 */
00536                 virtual Set::View getDelegate() const;
00537 
00538             // ----- data members ---------------------------------------
00539 
00540             private:
00541                 /**
00542                 * The Set to which this wrapper delegates.
00543                 */
00544                 FinalHolder<Set> m_ohDelegate;
00545             };
00546 
00547 
00548         /**
00549         * List implementation which delegates all calls to another List.
00550         */
00551         class COH_EXPORT AbstractWrapperList
00552             : public abstract_spec<AbstractWrapperList,
00553                 extends<Object>,
00554                 implements<List> >
00555             {
00556             // ----- constructors -------------------------------------------
00557 
00558             protected:
00559                 /**
00560                 * Create an AbstractWrapperList which delegates to the
00561                 * specified List.
00562                 *
00563                 * @param ohListDelegate  the List to delegate to
00564                 */
00565                 AbstractWrapperList(List::Holder ohListDelegate);
00566 
00567                 /**
00568                 * Copy constructor.
00569                 */
00570                 AbstractWrapperList(const AbstractWrapperList& that);
00571 
00572 
00573             // ----- List interface ------------------------------------------
00574 
00575             public:
00576                 /**
00577                 * {@inheritDoc}
00578                 */
00579                 virtual bool add(size32_t i, Object::Holder oh);
00580 
00581                 /**
00582                 * {@inheritDoc}
00583                 */
00584                 virtual bool addAll(size32_t i, Collection::View vc);
00585 
00586                 /**
00587                 * {@inheritDoc}
00588                 */
00589                 virtual Object::Holder get(size32_t i) const;
00590 
00591                 /**
00592                 * {@inheritDoc}
00593                 */
00594                 virtual Object::Holder get(size32_t i);
00595 
00596                 /**
00597                 * {@inheritDoc}
00598                 */
00599                 virtual size32_t indexOf(Object::View v) const;
00600 
00601                 /**
00602                 * {@inheritDoc}
00603                 */
00604                 virtual size32_t lastIndexOf(Object::View v) const;
00605 
00606                 /**
00607                 * {@inheritDoc}
00608                 */
00609                 virtual ListIterator::Handle listIterator() const;
00610 
00611                 /**
00612                 * {@inheritDoc}
00613                 */
00614                 virtual ListIterator::Handle listIterator(size32_t index) const;
00615 
00616                 /**
00617                 * {@inheritDoc}
00618                 */
00619                 virtual ListMuterator::Handle listIterator();
00620 
00621                 /**
00622                 * {@inheritDoc}
00623                 */
00624                 virtual ListMuterator::Handle listIterator(size32_t index);
00625 
00626                 /**
00627                 * {@inheritDoc}
00628                 */
00629                 virtual Object::Holder remove(size32_t idx);
00630 
00631                 /**
00632                 * {@inheritDoc}
00633                 */
00634                 virtual Object::Holder set(size32_t idx, Object::Holder oh);
00635 
00636                 /**
00637                 * {@inheritDoc}
00638                 */
00639                 virtual List::Handle subList(size32_t fromIndex,
00640                         size32_t toIndex);
00641 
00642                 /**
00643                 * {@inheritDoc}
00644                 */
00645                 virtual List::View subList(size32_t fromIndex,
00646                         size32_t toIndex) const;
00647 
00648 
00649             // ----- Collection interface -----------------------------------
00650 
00651             public:
00652                 /**
00653                 * {@inheritDoc}
00654                 */
00655                 virtual size32_t size() const;
00656 
00657                 /**
00658                 * {@inheritDoc}
00659                 */
00660                 virtual bool isEmpty() const;
00661 
00662                 /**
00663                 * {@inheritDoc}
00664                 */
00665                 virtual bool contains(Object::View v) const;
00666 
00667                 /**
00668                 * {@inheritDoc}
00669                 */
00670                 virtual bool containsAll(Collection::View vCol) const;
00671 
00672                 /**
00673                 * {@inheritDoc}
00674                 */
00675                 virtual Iterator::Handle iterator() const;
00676 
00677                 /**
00678                 * {@inheritDoc}
00679                 */
00680                 virtual Muterator::Handle iterator();
00681 
00682                 /**
00683                 * {@inheritDoc}
00684                 */
00685                 virtual ObjectArray::Handle toArray(
00686                         ObjectArray::Handle hao = NULL) const;
00687 
00688                 /**
00689                 * {@inheritDoc}
00690                 */
00691                 virtual bool add(Object::Holder oh);
00692 
00693                 /**
00694                 * {@inheritDoc}
00695                 */
00696                 virtual bool addAll(Collection::View vCol);
00697 
00698                 /**
00699                 * {@inheritDoc}
00700                 */
00701                 virtual bool remove(Object::View v);
00702 
00703                 /**
00704                 * {@inheritDoc}
00705                 */
00706                 virtual bool removeAll(Collection::View vCol);
00707 
00708                 /**
00709                 * {@inheritDoc}
00710                 */
00711                 virtual bool retainAll(Collection::View vCol);
00712 
00713                 /**
00714                 * {@inheritDoc}
00715                 */
00716                 virtual void clear();
00717 
00718 
00719             // ----- Object interface ---------------------------------------
00720 
00721             public:
00722                 /**
00723                 * {@inheritDoc}
00724                 */
00725                 virtual void toStream(std::ostream& out) const;
00726 
00727                 /**
00728                 * {@inheritDoc}
00729                 */
00730                 virtual size32_t hashCode() const;
00731 
00732                 /**
00733                 * {@inheritDoc}
00734                 */
00735                 virtual bool equals(Object::View v) const;
00736 
00737                 /**
00738                 * {@inheritDoc}
00739                 */
00740                 virtual bool isImmutable() const;
00741 
00742 
00743             // ----- helper methods -----------------------------------------
00744 
00745             protected:
00746                 /**
00747                 * Return a handle to the delegate.
00748                 *
00749                 * @return the delegate handle
00750                 *
00751                 * @throw UnsupportedOperationException if the delegate is a
00752                 *        view
00753                 */
00754                 virtual List::Handle getDelegate();
00755 
00756                 /**
00757                 * Return a view to the delegate.
00758                 *
00759                 * @return the delegate view
00760                 */
00761                 virtual List::View getDelegate() const;
00762 
00763 
00764             // ----- data members -------------------------------------------
00765 
00766             private:
00767                 /**
00768                 * The List to which this wrapper delegates.
00769                 */
00770                 FinalHolder<List> m_ohDelegate;
00771             };
00772 
00773         /**
00774         * Map implementation which delegates all calls to another Map.
00775         */
00776         class COH_EXPORT AbstractWrapperMap
00777             : public abstract_spec<AbstractWrapperMap,
00778                 extends<Object>,
00779                 implements<Map> >
00780             {
00781             // ----- constructors ---------------------------------------
00782 
00783             protected:
00784                 /**
00785                 * Create an AbstractWrapperMap which delegates to the
00786                 * specified Map.
00787                 *
00788                 * @param ohMapDelegate  the Map to delegate to
00789                 */
00790                 AbstractWrapperMap(Map::Holder ohMapDelegate);
00791 
00792                 /**
00793                 * Copy constructor.
00794                 */
00795                 AbstractWrapperMap(const AbstractWrapperMap& that);
00796 
00797             // ----- Map interface --------------------------------------
00798 
00799             public:
00800                 /**
00801                 * {@inheritDoc}
00802                 */
00803                 virtual size32_t size() const;
00804 
00805                 /**
00806                 * {@inheritDoc}
00807                 */
00808                 virtual bool isEmpty() const;
00809 
00810                 /**
00811                 * {@inheritDoc}
00812                 */
00813                 virtual bool containsKey(Object::View vKey) const;
00814 
00815                 /**
00816                 * {@inheritDoc}
00817                 */
00818                 virtual bool containsValue(Object::View vValue) const;
00819 
00820                 /**
00821                 * {@inheritDoc}
00822                 */
00823                 virtual Object::Holder get(Object::View vKey) const;
00824 
00825                 /**
00826                 * {@inheritDoc}
00827                 */
00828                 virtual Object::Holder get(Object::View vKey);
00829 
00830                 /**
00831                 * {@inheritDoc}
00832                 */
00833                 virtual Object::Holder put(Object::View vKey,
00834                                          Object::Holder ohValue);
00835 
00836                 /**
00837                 * {@inheritDoc}
00838                 */
00839                 virtual Object::Holder remove(Object::View vKey);
00840 
00841                 /**
00842                 * {@inheritDoc}
00843                 */
00844                 virtual void putAll(Map::View vMap);
00845 
00846                 /**
00847                 * {@inheritDoc}
00848                 */
00849                 virtual void clear();
00850 
00851                 /**
00852                 * {@inheritDoc}
00853                 */
00854                 virtual Set::View keySet() const;
00855 
00856                 /**
00857                 * {@inheritDoc}
00858                 */
00859                 virtual Set::Handle keySet();
00860 
00861                 /**
00862                 * {@inheritDoc}
00863                 */
00864                 virtual Collection::View values() const;
00865 
00866                 /**
00867                 * {@inheritDoc}
00868                 */
00869                 virtual Collection::Handle values();
00870 
00871                 /**
00872                 * {@inheritDoc}
00873                 */
00874                 virtual Set::View entrySet() const;
00875 
00876                 /**
00877                 * {@inheritDoc}
00878                 */
00879                 virtual Set::Handle entrySet();
00880 
00881             // ----- Object interface -----------------------------------
00882 
00883             public:
00884                 /**
00885                 * {@inheritDoc}
00886                 */
00887                 virtual void toStream(std::ostream& out) const;
00888 
00889                 /**
00890                 * {@inheritDoc}
00891                 */
00892                 virtual size32_t hashCode() const;
00893 
00894                 /**
00895                 * {@inheritDoc}
00896                 */
00897                 virtual bool equals(Object::View v) const;
00898 
00899                 /**
00900                 * {@inheritDoc}
00901                 */
00902                 virtual bool isImmutable() const;
00903 
00904             // ----- accessors ------------------------------------------
00905 
00906             protected:
00907                 /**
00908                 * Return a handle to the delegate.
00909                 *
00910                 * @return the delegate handle
00911                 *
00912                 * @throw UnsupportedOperationException if the delegate is a
00913                 *        view
00914                 */
00915                 virtual Map::Handle getDelegate();
00916 
00917                 /**
00918                 * Return a view to the delegate.
00919                 *
00920                 * @return the delegate view
00921                 */
00922                 virtual Map::View getDelegate() const;
00923 
00924             // ----- data members ---------------------------------------
00925 
00926             private:
00927                 /**
00928                 * The Map to which this wrapper delegates.
00929                 */
00930                 FinalHolder<Map> m_ohDelegate;
00931             };
00932 
00933 
00934     // ----- inner class: AbstractWrapperEntry ------------------------------
00935 
00936     public:
00937         /**
00938         * Map#Entry implementation which delegates all calls to another
00939         * Map#Entry.
00940         */
00941         class COH_EXPORT AbstractWrapperEntry
00942             : public abstract_spec<AbstractWrapperEntry,
00943                 extends<Object>,
00944                 implements<Map::Entry> >
00945             {
00946             // ----- constructors ---------------------------------------
00947 
00948             protected:
00949                 /**
00950                 * Create an AbstractWrapperEntry which delegates to the
00951                 * specified Map#Entry.
00952                 *
00953                 * @param ohEntryDelegate  the Entry to delegate to
00954                 */
00955                 AbstractWrapperEntry(Map::Entry::Holder ohEntryDelegate);
00956 
00957                 /**
00958                 * Copy constructor.
00959                 */
00960                 AbstractWrapperEntry(const AbstractWrapperEntry& that);
00961 
00962             // ----- Map::Entry interface -------------------------------
00963 
00964             public:
00965                 /**
00966                 * {@inheritDoc}
00967                 */
00968                 virtual Object::View getKey() const;
00969 
00970                 /**
00971                 * {@inheritDoc}
00972                 */
00973                 virtual Object::Holder getValue() const;
00974 
00975                 /**
00976                 * {@inheritDoc}
00977                 */
00978                 virtual Object::Holder getValue();
00979 
00980                 /**
00981                 * {@inheritDoc}
00982                 */
00983                 virtual Object::Holder setValue(Object::Holder ohValue);
00984 
00985             // ----- Object interface -----------------------------------
00986 
00987             public:
00988                 /**
00989                 * {@inheritDoc}
00990                 */
00991                 virtual void toStream(std::ostream& out) const;
00992 
00993                 /**
00994                 * {@inheritDoc}
00995                 */
00996                 virtual size32_t hashCode() const;
00997 
00998                 /**
00999                 * {@inheritDoc}
01000                 */
01001                 virtual bool equals(Object::View v) const;
01002 
01003                 /**
01004                 * {@inheritDoc}
01005                 */
01006                 virtual bool isImmutable() const;
01007 
01008             // ----- accessors ------------------------------------------
01009 
01010             protected:
01011                 /**
01012                 * Return a handle to the delegate.
01013                 *
01014                 * @return the delegate handle
01015                 *
01016                 * @throw UnsupportedOperationException if the delegate is a
01017                 *        view
01018                 */
01019                 virtual Map::Entry::Handle getDelegate();
01020 
01021                 /**
01022                 * Return a view to the delegate.
01023                 *
01024                 * @return the delegate view
01025                 */
01026                 virtual Map::Entry::View getDelegate() const;
01027 
01028             // ----- data members ---------------------------------------
01029 
01030             private:
01031                 /**
01032                 * The Map::Entry to which this wrapper delegates.
01033                 */
01034                 FinalHolder<Map::Entry> m_ohDelegate;
01035             };
01036     };
01037 
01038 COH_CLOSE_NAMESPACE2
01039 
01040 #endif // COH_WRAPPER_COLLECTIONS_HPP
Copyright © 2000, 2011, Oracle and/or its affiliates. All rights reserved.