258 lines
12 KiB
Plaintext
258 lines
12 KiB
Plaintext
compile insert rti_HashTable_Equates
|
|
/*
|
|
** Copyright (C) 1992-2016 Revelation Software Inc. All Rights Reserved **
|
|
|
|
Author : Captain C
|
|
Date : September 2016
|
|
Purpose : Constants for use with the HashTable functions in RevSTL.DLL
|
|
|
|
Comments
|
|
========
|
|
|
|
Amended Date Reason
|
|
======= ==== ======
|
|
Mr C 31 Mar 17 Added Hashtable row flags
|
|
|
|
*/
|
|
///////////////////////////////////////////////////////////////////////////////
|
|
///////////////////////////////////////////////////////////////////////////////
|
|
#ifndef _RTI_HASHTABLE_EQUATES_
|
|
#define _RTI_HASHTABLE_EQUATES_
|
|
///////////////////////////////////////////////////////////////////////////////
|
|
///////////////////////////////////////////////////////////////////////////////
|
|
|
|
equ REVSTL_HTBL_SUCCESS$ to 0
|
|
equ REVSTL_HTBL_MAX_ERROR_LEN$ to 2048
|
|
|
|
///////////////////////////////////////////////////////////////////////////////
|
|
///////////////////////////////////////////////////////////////////////////////
|
|
|
|
// HashTable methods
|
|
equ REVSTL_HTBLMTD_CREATETABLE$ to 1
|
|
equ REVSTL_HTBLMTD_READROW$ to 2
|
|
equ REVSTL_HTBLMTD_WRITEROW$ to 3
|
|
equ REVSTL_HTBLMTD_DELETEROW$ to 4
|
|
equ REVSTL_HTBLMTD_CLEARTABLE$ to 5
|
|
equ REVSTL_HTBLMTD_CLOSETABLE$ to 6
|
|
equ REVSTL_HTBLMTD_ROWEXISTS$ to 7
|
|
equ REVSTL_HTBLMTD_LISTKEYS$ to 8
|
|
equ REVSTL_HTBLMTD_GETROWCOUNT$ to 9
|
|
|
|
equ REVSTL_HTBLMTD_FIRST$ to REVSTL_HTBLMTD_CREATETABLE$
|
|
equ REVSTL_HTBLMTD_LAST$ to REVSTL_HTBLMTD_GETROWCOUNT$
|
|
|
|
///////////////////////////////////////////////////////////////////////////////
|
|
///////////////////////////////////////////////////////////////////////////////
|
|
|
|
// HashTable types
|
|
equ REVSTL_HTBLTYPE_STD$ to 1 ; // std::unordered_map (VS2015)
|
|
equ REVSTL_HTBLTYPE_BOOST$ to 2 ; // boost::unordered_map
|
|
equ REVSTL_HTBLTYPE_SPP$ to 3 ; // spp::sparsepp
|
|
|
|
///////////////////////////////////////////////////////////////////////////////
|
|
///////////////////////////////////////////////////////////////////////////////
|
|
|
|
// Hashtable row flags
|
|
equ REVSTL_HTBLROW_IDISPATCH$ to 0x0001; // Store OleVar
|
|
|
|
///////////////////////////////////////////////////////////////////////////////
|
|
///////////////////////////////////////////////////////////////////////////////
|
|
|
|
// HashTable error codes
|
|
equ REVSTL_HTBLERR_BADMETHOD$ to -1
|
|
equ REVSTL_HTBLERR_OUTOFHANDLES$ to -2
|
|
equ REVSTL_HTBLERR_BADINITPARAM$ to -3
|
|
equ REVSTL_HTBLERR_OUTOFMEM$ to -4
|
|
equ REVSTL_HTBLERR_BADHANDLE$ to -5
|
|
equ REVSTL_HTBLERR_BADKEY$ to -6
|
|
equ REVSTL_HTBLERR_ROW_DNE$ to -7
|
|
|
|
///////////////////////////////////////////////////////////////////////////////
|
|
///////////////////////////////////////////////////////////////////////////////
|
|
// REVSTL_HTBLMTD_CREATETABLE$ method
|
|
//
|
|
// Creates a hashtable and returns the handle.
|
|
//
|
|
// ----------------------------------------------------------------------------
|
|
// [i] param1 : InitParam. This is an @fm delimited array of init parameters
|
|
// : structures as follows:
|
|
// :
|
|
// : <1> Type of HashTable - defaults to REVSTL_HTBLTYPE_STD$
|
|
// : <2> Expected RowCount - presizes the table to hold the
|
|
// : passed number of rows. Defaults to 0.
|
|
// ----------------------------------------------------------------------------
|
|
// [r] Returns the table handle if successful (a value > 0), or an error code
|
|
// (a value < 0) if it fails.
|
|
// ----------------------------------------------------------------------------
|
|
// [e] Error details are returned via Set_Status()
|
|
// ----------------------------------------------------------------------------
|
|
|
|
// InitParam constants
|
|
equ REVSTL_HTBL_INITPARAM_TYPE$ to 1
|
|
equ REVSTL_HTBL_INITPARAM_ROWCOUNT$ to 2
|
|
|
|
///////////////////////////////////////////////////////////////////////////////
|
|
// REVSTL_HTBLMTD_READROW$ method
|
|
//
|
|
// Reads a row from the specified hash table.
|
|
//
|
|
// ----------------------------------------------------------------------------
|
|
// [i] param1 : HashTable handle
|
|
// [i] param2 : Key to read
|
|
// [o] param3 : The row data retrieved from the hash table
|
|
// ----------------------------------------------------------------------------
|
|
// [r] The size of the row data read from the table, or an error code
|
|
// (a value < 0) if it fails.
|
|
// ----------------------------------------------------------------------------
|
|
// [e] Errors are returned via set_Status()
|
|
// ----------------------------------------------------------------------------
|
|
|
|
////////////////////////////////////////////////////////////////////////////////
|
|
// REVSTL_HTBLMTD_WRITEROW$ method
|
|
//
|
|
// Writes a row to the specified hash table using the specified key.
|
|
//
|
|
// -----------------------------------------------------------------------------
|
|
// [i] param1 : HashTable handle
|
|
// [i] param2 : Key to write
|
|
// [i] param3 : Row data to write
|
|
// -----------------------------------------------------------------------------
|
|
// [r] Returns 0 if successful or an error code (a value < 0) if it fails.
|
|
// -----------------------------------------------------------------------------
|
|
// [e] Errors are returned via set_Status()
|
|
// -----------------------------------------------------------------------------
|
|
|
|
////////////////////////////////////////////////////////////////////////////////
|
|
// REVSTL_HTBLMTD_DELETEROW$ method
|
|
//
|
|
// Deletes a row from the specified hash table using the specified key.
|
|
//
|
|
// -----------------------------------------------------------------------------
|
|
// [i] param1 : HashTable handle
|
|
// [i] param2 : Key to delete
|
|
// -----------------------------------------------------------------------------
|
|
// [r] Returns 1 if the row was deleted, 0 if it didn't exist, or an error
|
|
// code (a value < 0) if it fails.
|
|
// -----------------------------------------------------------------------------
|
|
// [e] Errors are returned via set_Status()
|
|
// -----------------------------------------------------------------------------
|
|
|
|
///////////////////////////////////////////////////////////////////////////////
|
|
// REVSTL_HTBLMTD_CLEARTABLE$ method
|
|
//
|
|
// Deletes all records from the HashTable
|
|
//
|
|
// -----------------------------------------------------------------------------
|
|
// [i] param1 : HashTable handle
|
|
// -----------------------------------------------------------------------------
|
|
// [r] Returns 0 if the table was cleared, or an error code (a value < 0) if it
|
|
// fails.
|
|
// -----------------------------------------------------------------------------
|
|
// [e] Errors are returned via set_Status()
|
|
// -----------------------------------------------------------------------------
|
|
|
|
///////////////////////////////////////////////////////////////////////////////
|
|
// REVSTL_HTBLMTD_CLOSETABLE$ method
|
|
//
|
|
// Closes (destroys) a HashTable. Do not use the handle afterwards!
|
|
//
|
|
// -----------------------------------------------------------------------------
|
|
// [i,o] param1 : HashTable handle. This is set to 0 if the table is closed.
|
|
// -----------------------------------------------------------------------------
|
|
// [r] Returns 0 if the table was destoryed, or an error code (a value < 0) if
|
|
// fails.
|
|
// -----------------------------------------------------------------------------
|
|
// [e] Errors are returned via set_Status()
|
|
// -----------------------------------------------------------------------------
|
|
|
|
////////////////////////////////////////////////////////////////////////////////
|
|
// REVSTL_HTBLMTD_ROWEXISTS$ method
|
|
//
|
|
// Verifies that a row exists within a HashTable.
|
|
//
|
|
// -----------------------------------------------------------------------------
|
|
// [i] param1 : HashTable handle
|
|
// [i] param2 : Key to verify
|
|
// -----------------------------------------------------------------------------
|
|
// [r] Returns 1 if the row exists, 0 if it doesn't, or an error code (a
|
|
// value < 0) if it fails.
|
|
// -----------------------------------------------------------------------------
|
|
// [e] Errors are returned via set_Status()
|
|
// -----------------------------------------------------------------------------
|
|
|
|
///////////////////////////////////////////////////////////////////////////////
|
|
// REVSTL_HTBLMTD_LISTKEYS$ method
|
|
//
|
|
// Returns an @fm delimited list of keys from the hashtable
|
|
//
|
|
// -----------------------------------------------------------------------------
|
|
// [i] param1 : HashTable handle
|
|
// [o] param2 : @fm'd list of keys
|
|
// -----------------------------------------------------------------------------
|
|
// [r] Returns the number of keys in the list if successful, or an error code
|
|
// (a value < 0) if it fails.
|
|
// -----------------------------------------------------------------------------
|
|
// [e] Errors are returned via set_Status()
|
|
// -----------------------------------------------------------------------------
|
|
|
|
///////////////////////////////////////////////////////////////////////////////
|
|
// REVSTL_HTBLMTD_GETROWCOUNT$ method
|
|
//
|
|
// Returns the number of rows stored in the hashtable
|
|
//
|
|
// -----------------------------------------------------------------------------
|
|
// [i] param1 : HashTable handle
|
|
// -----------------------------------------------------------------------------
|
|
// [r] Returns the number of rows in the table if successful, or an error code
|
|
// (a value < 0) if it fails.
|
|
// -----------------------------------------------------------------------------
|
|
// [e] Errors are returned via set_Status()
|
|
// -----------------------------------------------------------------------------
|
|
|
|
///////////////////////////////////////////////////////////////////////////////
|
|
// Licensing Info for SparsePP ////////////////////////////////////////////////
|
|
///////////////////////////////////////////////////////////////////////////////
|
|
//
|
|
// ----------------------------------------------------------------------
|
|
// Copyright (c) 2016, Gregory Popovitch - greg7mdp@gmail.com
|
|
// All rights reserved.
|
|
//
|
|
// This work is derived from Google's sparsehash library
|
|
//
|
|
// Copyright (c) 2005, Google Inc.
|
|
// All rights reserved.
|
|
//
|
|
// Redistribution and use in source and binary forms, with or without
|
|
// modification, are permitted provided that the following conditions are
|
|
// met:
|
|
//
|
|
// * Redistributions of source code must retain the above copyright
|
|
// notice, this list of conditions and the following disclaimer.
|
|
// * Redistributions in binary form must reproduce the above
|
|
// copyright notice, this list of conditions and the following disclaimer
|
|
// in the documentation and/or other materials provided with the
|
|
// distribution.
|
|
// * Neither the name of Google Inc. nor the names of its
|
|
// contributors may be used to endorse or promote products derived from
|
|
// this software without specific prior written permission.
|
|
//
|
|
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
|
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
|
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
|
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
|
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
|
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
|
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
// ----------------------------------------------------------------------
|
|
|
|
///////////////////////////////////////////////////////////////////////////////
|
|
///////////////////////////////////////////////////////////////////////////////
|
|
#endif _RTI_HASHTABLE_EQUATES_
|
|
///////////////////////////////////////////////////////////////////////////////
|
|
///////////////////////////////////////////////////////////////////////////////
|
|
|