Example #1
0
void FieldMap::removeGroup( int num, int field )
{
  Groups::iterator i = m_groups.find( field );
  if ( i == m_groups.end() ) return;
  if ( num <= 0 ) return;
  std::vector< FieldMap* >& vector = i->second;
  if ( vector.size() < ( unsigned ) num ) return;

  std::deque< FieldMap* > queue;
  while( vector.size() > (unsigned)num )
  {
    queue.push_back( vector.back() );
    vector.pop_back();
  }
  delete vector.back();
  vector.pop_back();
  while( queue.size() )
  {
    vector.push_back( queue.front() );
    queue.pop_front();
  }

  if( vector.size() == 0 )
  {
    m_groups.erase( field );
  }
  else
  {
    IntField groupCount( field, vector.size() );
    setField( groupCount, true );
  }
}
Example #2
0
std::shared_ptr<base::IGroup> BlockFS::getGroup(ndsize_t index) const {
    if (index >= groupCount()) {
        throw OutOfBounds("Trying to access block.group with invalid index.", index);
    }
    bfs::path p = group_dir.sub_dir_by_index(index);
    return std::make_shared<GroupFS>(file(), block(), p.string());
}
Example #3
0
RedisServantGroup *RedisProxy::group(const char *name) const
{
    for (int i = 0; i < groupCount(); ++i) {
        RedisServantGroup* p = group(i);
        if (strcmp(name, p->groupName()) == 0) {
            return p;
        }
    }
    return NULL;
}
Example #4
0
void FieldMap::removeGroup( int field )
{ QF_STACK_PUSH(FieldMap::removeGroup)
  removeGroup( groupCount(field), field );
  QF_STACK_POP
}