EnumType inline string_to_enum(const std::string& s, const Array& l, EnumType)
{
    std::size_t i;
    for (i= 0; i < size(l) && std::string(l[i]) != s; i++) ;
    MTL_THROW_IF(i == size(l), runtime_error("Search string not found"));
    return EnumType(i);
}
Ejemplo n.º 2
0
static void pragDumpObjectModel( // DUMP OBJECT MODEL
    void )
{
    if( IS_ID_OR_KEYWORD( CurToken ) ) {
        NAME name = NameCreateLen( Buffer, TokenLen );
        SEARCH_RESULT* result = ScopeFindNaked( GetCurrScope(), name );
        if( result == NULL ) {
            CErr2p( ERR_DUMP_OBJ_MODEL, Buffer );
        } else {
            SYMBOL_NAME sname = result->sym_name;
            ScopeFreeResult( result );
            if( sname->name_syms == NULL ) {
                TYPE type = sname->name_type->sym_type;
                if( TypeDefined( type ) ) {
                    TYPE dump_type;
                    dump_type = StructType( type );
                    if( dump_type != NULL ) {
                        DumpObjectModelClass( dump_type );
                    } else {
                        dump_type = EnumType( type );
                        if( dump_type != NULL ) {
                            DumpObjectModelEnum( dump_type );
                        } else {
                            CErr2p( ERR_DUMP_OBJ_MODEL, Buffer );
                        }
                    }
                } else {
                    CErr2p( ERR_DUMP_OBJ_MODEL, Buffer );
                }
            } else {
                CErr2p( ERR_DUMP_OBJ_MODEL, Buffer );
            }
        }
        NextToken();
    }
}
Ejemplo n.º 3
0
void Gear_UnpackList::runVideo()
{
  //std::cout << name() << "::: size:: " << _LIST_IN->type()->size() << std::endl;
  if (!_LIST_IN->connected() ||
      _LIST_IN->type()->empty())
  {    
    _LIST_OUT->sleeping(true); // TODO: the sleeping mechanism just doesn't work
    return;
  }

  _LIST_OUT->sleeping(false);

  ListType *listType = _LIST_OUT->type();
  const AbstractType *type = _LIST_IN->type()->front();

  // XXX Maybe there's a more efficient way than clearing/populating each time but this
  // is safe memory-wise.
  clearList();

  // Copy
  const ListType* inputList = _LIST_IN->type();
  for(ListType::const_iterator it=inputList->begin() + 1; it!=inputList->end(); ++it)
    listType->push_back( (*it)->clone() );

  //std::cout << "got something " << type->typeName() << std::endl;
  //for (ListType::const_iterator it = _LIST_IN->type()->begin(); it != _LIST_IN->type()->end(); ++it)
  //listType->assign(_LIST_IN->type()->begin(), _LIST_IN->type()->end());
  
  if ((_STR_OUT->connected()) && type->typeName() == StringType().typeName())
  {
    //std::cout << "sending str out: " << ((StringType*)type)->value() << std::endl;
    _STR_OUT->type()->copyFrom(*type);
    return;
  }
    
  else if ((_VAL_OUT->connected()) && type->typeName() == ValueType().typeName())
  {
    //std::cout << "sending val out: " << ((ValueType*)type)->value() << std::endl;
    _VAL_OUT->type()->copyFrom(*type);
    return;
  }

  else if ((_ENUM_OUT->connected()) && type->typeName() == EnumType().typeName())
  {
    //std::cout << "sending val out: " << ((ValueType*)type)->value() << std::endl;
    _ENUM_OUT->type()->copyFrom(*type);
    return;
  }

  else if ((_CHANNEL_OUT->connected()) && type->typeName() == VideoChannelType().typeName())
  {
    //std::cout << "sending val out: " << ((ValueType*)type)->value() << std::endl;
    _CHANNEL_OUT->type()->copyFrom(*type);
    return;
  }


  else if ((_VIDEO_OUT->connected()) && type->typeName() == VideoRGBAType().typeName())
  {
    //std::cout << "sending val out: " << ((ValueType*)type)->value() << std::endl;
    _VIDEO_OUT->type()->copyFrom(*type);
    return;
  }

  else if ((_AREA_OUT->connected()) && type->typeName() == AreaType().typeName())
  {
    //std::cout << "sending val out: " << ((ValueType*)type)->value() << std::endl;
    _AREA_OUT->type()->copyFrom(*type);
    return;
  }
}
Ejemplo n.º 4
0
EnumType Context::addEnum(const std::string &enumName)
{
	return EnumType(this, enumName);
}