Beispiel #1
0
    Slice::Slice(Shard& shard)
        : m_shard(shard),
          m_capacity(shard.GetSliceCapacity()),
          m_refCount(1),
          m_buffer(shard.AllocateSliceBuffer()),
          m_unallocatedCount(shard.GetSliceCapacity()),
          m_commitPendingCount(0),
          m_expiredCount(0)
    {
        Initialize();

        // Perform start up initialization of the DocTable and RowTables after
        // the buffer has been allocated.
        GetDocTable().Initialize(m_buffer);
        for (Rank r = 0; r <= c_maxRankValue; ++r)
        {
            GetRowTable(r).Initialize(m_buffer, m_shard.GetTermTable());
        }
    }
Beispiel #2
0
    Slice::Slice(Shard& shard, std::istream& input)
        : m_shard(shard),
          m_capacity(shard.GetSliceCapacity()),
          m_refCount(1),
          m_buffer(shard.LoadSliceBuffer(input)),
          m_unallocatedCount(StreamUtilities::ReadField<DocIndex>(input)),
          m_commitPendingCount(StreamUtilities::ReadField<DocIndex>(input)),
          m_expiredCount(StreamUtilities::ReadField<DocIndex>(input))
    {
        // Initializes the slice buffer, place pointer to a Slice at the 
        // specific offset as indicated by Shard.
        Initialize();

        // Perform loading of the DocTable contents which is not part of the 
        // SliceBuffer.
        GetDocTable().LoadVariableSizeBlobs(m_buffer, input);

        // No need to initialize RowTable buffers since they are simply part of 
        // the SliceBuffer which has been already loaded by the call to ReadBytes
        // above.
    }