Changeset 432


Ignore:
Timestamp:
07/21/15 14:12:57 (10 years ago)
Author:
epyon
Message:
  • dedicated hash_store used instead of unordered_map
Location:
trunk
Files:
1 added
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/nv/engine/resource_system.hh

    r431 r432  
    1717#include <nv/interface/context.hh>
    1818#include <nv/lua/lua_state.hh>
    19 #include <nv/stl/unordered_map.hh>
     19#include <nv/stl/hash_store.hh>
    2020#include <nv/stl/vector.hh>
    2121
     
    4343
    4444                lua::state* m_lua;
    45                 hashed_table< shash64, resource_id > m_names;
     45                hash_store< shash64, resource_id > m_names;
    4646        };
    4747
     
    9999        protected:
    100100                vector< resource_manager_base* >     m_managers;
    101                 unordered_map< uint64, resource_id > m_manager_names;
     101                hash_store< shash64, resource_id > m_manager_names;
    102102                lua::state* m_lua_state;
    103103        };
  • trunk/nv/stl/container/hash_table.hh

    r408 r432  
    422422                typename SuperClass = empty_type
    423423        >
    424         class hash_table : public hash_table_storage< HashEntryPolicy, RehashPolicy, SuperClass >
     424        class hash_table_base : public hash_table_storage< HashEntryPolicy, RehashPolicy, SuperClass >
    425425        {
    426426                typedef hash_table_storage< HashEntryPolicy, RehashPolicy, SuperClass > base_type;
     
    447447
    448448        public: // constructors
    449                 hash_table() {}
    450                 explicit hash_table( size_type size ) : base_type( size ) {}
    451                 hash_table( const hash_table& other ) = delete;
    452                 hash_table( hash_table&& other ) = default;
     449                hash_table_base() {}
     450                explicit hash_table_base( size_type size ) : base_type( size ) {}
     451                hash_table_base( const hash_table_base& other ) = delete;
     452                hash_table_base( hash_table_base&& other ) = default;
    453453                template< typename InputIterator >
    454                 hash_table( InputIterator first, InputIterator last ) : base_type()
     454                hash_table_base( InputIterator first, InputIterator last ) : base_type()
    455455                {
    456456                        insert( first, last );
     
    459459        public: // assignements
    460460
    461                 hash_table& operator=( const hash_table& other ) = delete;
    462                 hash_table& operator=( hash_table&& other ) = default;
     461                hash_table_base& operator=( const hash_table_base& other ) = delete;
     462                hash_table_base& operator=( hash_table_base&& other ) = default;
    463463
    464464        public: // iterators
  • trunk/nv/stl/container/hash_table_policy.hh

    r408 r432  
    145145        {
    146146                template< typename H >
    147                 static size_t get_index( H h, size_t n ) { return h % n; }
     147                static enable_if_t< is_integral< H >::value, size_t >
     148                get_index( H h, size_t n ) { return h % n; }
     149
     150                template< typename H >
     151                static enable_if_t< is_class< H >::value, size_t >
     152                get_index( H h, size_t n ) { return h.value() % n; }
     153
    148154
    149155                static uint32 get_bucket_count( uint32 requested_count )
  • trunk/nv/stl/hash_map.hh

    r408 r432  
    8888                template < typename > class InsertConvertPolicy = hash_table_no_extra_types_policy
    8989        >
    90         class hash_map : public hash_table< EntryPolicy, QueryConvertPolicy >
     90        class hash_map : public hash_table_base< EntryPolicy, QueryConvertPolicy >
    9191        {
    9292        public:
    93                 typedef hash_table< EntryPolicy, QueryConvertPolicy >                base_type;
     93                typedef hash_table_base< EntryPolicy, QueryConvertPolicy >                base_type;
    9494                typedef hash_map< Key, Mapped, Hash, EntryPolicy, QueryConvertPolicy > this_type;
    9595                typedef typename base_type::value_type                                           value_type;
  • trunk/nv/stl/string_table.hh

    r431 r432  
    1616#include <nv/stl/vector.hh>
    1717#include <nv/stl/string.hh>
    18 #include <nv/stl/unordered_map.hh>
     18#include <nv/stl/hash_store.hh>
    1919#include <nv/stl/stream.hh>
    2020
     
    3030                typedef uint32 size_type;
    3131                typedef uint16 length_type;
    32                 typedef unordered_map< hash_type, size_type > indexer_type;
     32                typedef hash_store< hash_type, size_type > indexer_type;
    3333                typedef vector< char > storage_type;
    3434                typedef indexer_type::const_iterator const_iterator;
  • trunk/nv/stl/unordered_map.hh

    r431 r432  
    230230        >
    231231        class unordered_map
    232                 : public hash_table<
     232                : public hash_table_base<
    233233                        HashEntryPolicy,
    234234                        hash_table_no_extra_types_policy,
     
    238238        {
    239239        public:
    240                 typedef hash_table<
     240                typedef hash_table_base<
    241241                        HashEntryPolicy,
    242242                        hash_table_no_extra_types_policy,
     
    324324        };
    325325
    326         // TODO: remove and make a proper hashed map
    327         template <
    328                 typename Key,
    329                 typename T,
    330                 typename Hasher = hash< Key, typename Key::value_type >,
    331                 typename KeyEqual = equal_to< Key >,
    332                 typename HashEntryPolicy = hash_table_stl_map_policy< Key, T, typename Key::value_type, KeyEqual, Hasher >
    333         >
    334         class hashed_table
    335                 : public hash_table<
    336                 HashEntryPolicy,
    337                 hash_table_no_extra_types_policy,
    338                 hash_table_prime_rehash_policy,
    339                 HashEntryPolicy
    340                 >
    341         {
    342         public:
    343                 typedef hash_table<
    344                         HashEntryPolicy,
    345                         hash_table_no_extra_types_policy,
    346                         hash_table_prime_rehash_policy,
    347                         HashEntryPolicy
    348                 > base_type;
    349                 typedef typename base_type::value_type                                           value_type;
    350                 typedef typename base_type::pointer                                              pointer;
    351                 typedef typename base_type::const_pointer                                        const_pointer;
    352                 typedef typename base_type::reference                                            reference;
    353                 typedef typename base_type::const_reference                                      const_reference;
    354                 typedef typename base_type::iterator                                             iterator;
    355                 typedef typename base_type::const_iterator                                       const_iterator;
    356                 typedef typename base_type::size_type                                            size_type;
    357                 typedef typename base_type::difference_type                                      difference_type;
    358                 typedef typename base_type::key_type                                             key_type;
    359                 typedef typename base_type::mapped_type                                          mapped_type;
    360                 typedef typename base_type::node_type                                            node_type;
    361                 typedef typename base_type::insert_return_type                                   insert_return_type;
    362                 typedef Hasher                                                                   hasher;
    363                 typedef KeyEqual                                                                 key_equal;
    364 
    365                 using base_type::base_type;
    366 
    367                 mapped_type& operator[]( const key_type& key )
    368                 {
    369                         return ( *base_type::insert_key( key ).first ).second;
    370                 }
    371         };
    372 
    373 
    374326}
    375327
  • trunk/src/formats/assimp_loader.cc

    r431 r432  
    88
    99#include "nv/interface/data_channel_access.hh"
    10 #include "nv/stl/unordered_map.hh"
     10#include "nv/stl/hash_store.hh"
    1111#include "nv/lib/assimp.hh"
    1212
     
    288288        const aiScene* scene = reinterpret_cast<const aiScene*>( m_scene );
    289289        mesh_nodes_data* result = new mesh_nodes_data( make_name( "bones" ) );
    290         hashed_table< shash64, uint16 > names;
     290        hash_store< shash64, uint16 > names;
    291291        for ( unsigned int m = 0; m < m_mesh_count; ++m )
    292292        {
Note: See TracChangeset for help on using the changeset viewer.