CBin CBinShare::GetBuffer( CStr x_sName, CBinShare::t_size x_uSize ) {_STT(); if ( !m_lock.IsValid() ) return CBin(); oexAutoLock ll( m_lock ); if ( !ll.IsLocked() ) return CBin(); // Existing? if ( m_buffers.IsKey( x_sName ) ) { CBinHolder &r = m_buffers[ x_sName ]; r.to = oexGetUnixTime(); return r.bin; } // end if // User only wants existing? else if ( !x_uSize ) return CBin(); // Get / Create share CBinHolder &r = m_buffers[ x_sName ]; r.bin.Mem().OexNew( x_uSize ); r.to = oexGetUnixTime(); return r.bin; }
ClusterBucketer::ClusterBucketer(const std::vector<int>& seed_pos, size_t seed_len, size_t step) : _seed_positions(seed_pos), _seed_len(seed_len), _step(step){ assert(step <= seed_len); splitSeedPositions(); size_t total = static_cast<size_t>(pow(4,_seed_len)); _bins.assign(total,CBin()); }