home *** CD-ROM | disk | FTP | other *** search
- --
- -- Define the class skeleton for Element type
- --
- <code DEFINE_KEY>
- --
- <include k_user.tde>
- --
-
- class $KEY_CLASS$
- {
- //-----------------------------------------------------------------------------
- // Required members for the key type.
- //-----------------------------------------------------------------------------
- public:
- <if ($DEFAULT_CONSTRUCTOR$)>
- //------------------------------------------------------------------------
- // Default constructor
- //------------------------------------------------------------------------
- $KEY_CLASS$()
- < >$K_DEF_CONSTR_BODY$
- </if>
- <if (($K_EQUALITY$) | ($EQUALITY$)) >
- //------------------------------------------------------------------------
- // Equality test
- //------------------------------------------------------------------------
- IBoolean operator== ($KEY_CLASS$ const& a$KEY_CLASS$) const
- < >$K_EQUAL_BODY$
- </if>
- <if (($K_ORDERING$) | ($ORDERING$)) >
- //------------------------------------------------------------------------
- // Ordering relation between $KEY_CLASS$ objects.
- //------------------------------------------------------------------------
- IBoolean operator< ($KEY_CLASS$ const& a$KEY_CLASS$) const
- < >$K_ORDER_BODY$
- </if>
- //-----------------------------------------------------------------------------
- // Additional members (customization)
- //-----------------------------------------------------------------------------
- $K_CUSTOMIZATION$
- }; // End of class $KEY_CLASS$
- <if ($K_HASH_FUNCTION$)>
-
- $DEFINE_K_HASH$\<>
- </if>
- </code DEFINE_KEY>
-
-
- <code DEFINE_K_HASH>
- //-----------------------------------------------------------------------------
- // Need a hash function for the key type
- //-----------------------------------------------------------------------------
- inline unsigned long hash($KEY_TYPE$ const& a$KEY_CLASS$, unsigned long hashInput)
- <if ($USER_DEFINED_KEY$)>
- $K_HASH_BODY$
- <else>\<if ($KEY_PTR$)>
- -- When key type is pointer to predefined type,
- -- do hashing on the actual value
- {
- \<if ($KEY_NUMERIC_TYPE$)>
- return hash(*a$KEY_CLASS$, hashInput);
- \<else>
- return hash((const char*)*a$KEY_CLASS$, hashInput);
- \</if>
- }
- </if>\</if>
- </code DEFINE_K_HASH>