home *** CD-ROM | disk | FTP | other *** search
- #ifndef __RWTVASSLNK_H__
- #define __RWTVASSLNK_H__
- pragma push_align_members(64);
-
- /*
- * RWTValAssocLink: Key / Value association link
- *
- * $Header: E:/vcs/rw/tvasslnk.h_v 1.0 02 Mar 1992 16:10:52 KEFFER $
- *
- ****************************************************************************
- *
- * Rogue Wave Software, Inc.
- * P.O. Box 2328
- * Corvallis, OR 97339
- *
- * Copyright (C) 1992. This software is subject to copyright
- * protection under the laws of the United States and other countries.
- *
- ***************************************************************************
- *
- * This class defines an association between a key of type K, and a
- * value of type V in a singly-linked link, using value semantics.
- *
- * It has a single value constructor that just takes the key.
- * This means that the value will be constructed using the default
- * constructor for type V. Usually this works just fine. However, if the
- * value (type V) is a builtin, then its value will be left undefined.
- * Usually this also works fine. However, if this is unsatisfactory,
- * then you can supply your own definition that overrides the template-
- * generated definition. For an explanation of user-specified overrides
- * of template-generated definitions, see Stroustrup II, sec. 8.4.1.
- *
- * Example:
- *
- * RWTValAssocLink<int,double>::RWTValAssocLink(int i) :
- * _key(i)
- * {
- * _value = 0.0; // Explicitly set the value to zero.
- * }
- *
- *
- ***************************************************************************
- *
- * $Log: E:/vcs/rw/tvasslnk.h_v $
- *
- * Rev 1.0 02 Mar 1992 16:10:52 KEFFER
- * Initial revision.
- */
-
- #include "rw/islink.h"
-
- template <class K, class V> struct RWExport RWTValAssocLink : public RWIsvSlink {
- K _key;
- V _value;
- RWTValAssocLink(K key);
- RWTValAssocLink(K key, V value) : _key(key), _value(value) { }
-
- RWBoolean operator==(const RWTValAssocLink<K,V>& a){ return _key==a._key; }
- };
-
- /*
- * Template-generated single-value constructor. This can be overridden
- * by the user.
- */
- template <class K, class V>
- RWTValAssocLink<K,V>::RWTValAssocLink(K key) :
- _key(key)
- {
-
- }
-
- pragma pop_align_members();
- #endif /* __RWTVASSLNK_H__ */
-