Esempio n. 1
0
	virtual void main()
	{
		//init
		QString psname = getString("psname");
		if (psname=="") psname = getInfile("in");

		//load
		VariantList variants;
		variants.load(getInfile("in"));

		//annotate
		bool test = getFlag("test");
		QString mode = getEnum("mode");
		if(mode=="germline")
		{
			NGSD(test).annotate(variants, psname);
		}
		else if(mode=="somatic")
		{
			NGSD(test).annotateSomatic(variants, psname);
		}

		//store
		variants.store(getOutfile("out"));
	}
Esempio n. 2
0
void RandomFire::load(const VariantMap& stream)
{
  VariantList vl = stream.get( lc_population ).toList();
  _d->minPopulation = vl.get( 0, 0 ).toInt();
  _d->maxPopulation = vl.get( 1, 999999 ).toInt();
  _d->strong = stream.get( lc_strong, 10 );
}
void MoveButtonState::OnPressToggle(bool bDown, boost::signal<void (VariantList*)> *pCustomSignal)
{
	VariantList v;

	if (bDown)
	{

	if (!m_bIsDown)
	{
		m_bIsDown = true;

		v.Get(0).Set(uint32(m_keyType));
		v.Get(1).Set(uint32(VIRTUAL_KEY_PRESS)); 
		if (pCustomSignal)
		{
			(*pCustomSignal)(&v);
		} else
		{
			GetBaseApp()->m_sig_arcade_input(&v);
		}	
	}

	m_releaseTimer = rt_max(GetTick(TIMER_SYSTEM), m_releaseTimer);
	m_releaseTimer += 1000*60;
	} else
	{
		ReleaseIfNeeded(pCustomSignal);
	}
}
Esempio n. 4
0
 virtual void load(const VariantList& stream)
 {
   for (const auto& item : stream) {
     VariantList vl = item.toList();
     (*this)[ vl.get(0) ] = vl.get(1);
   }
 }
Esempio n. 5
0
void Base::load(const VariantList& stream)
{
  type = (Type)stream.get( ftype ).toInt();
  date = stream.get( fdate ).toDateTime();
  objectName = stream.get( fname ).toString();
  message = stream.get( fmessage ).toString();
  location = stream.get( flocation ).toPoint();
}
Esempio n. 6
0
 void load( const VariantList& stream )
 {
   for( unsigned int i=0; i < stream.size(); i+=2 )
   {
     Service::Type type = Service::Type( stream.get( i ).toInt() );
     at( type )->set( stream.get( i+1 ).toFloat() ); //serviceValue
   }
 }
Esempio n. 7
0
bool NGSD::removeColumnIfPresent(VariantList& variants, QString name, bool exact_name_match)
{
	int index = variants.annotationIndexByName(name, exact_name_match, false);
	if (index==-1) return false;

	variants.removeAnnotation(index);
	return true;
}
Esempio n. 8
0
void Addressable::onDeserialize(VariantList& variants) {
	if(variants.hasKey("class")) {
		addClasses(variants.get("class").asStringList());
	}
	if(variants.hasKey("id")) {
		setId(variants.get("id"));
	}
}
Esempio n. 9
0
void RandomDamage::load(const VariantMap& stream)
{
  VariantList vl = stream.get( lc_population ).toList();
  _d->minPopulation = vl.get( 0, 0 ).toInt();
  _d->maxPopulation = vl.get( 1, 999999 ).toInt();
  VARIANT_LOAD_ANY_D( _d, strong, stream );
  VARIANT_LOAD_ANY_D( _d, priority, stream );

}
Esempio n. 10
0
VariantList GoodStock::save() const
{
  VariantList stream;
  stream.push_back( (int)_type );
  stream.push_back( _maxQty );
  stream.push_back( _currentQty );

  return stream;
}
Esempio n. 11
0
  virtual VariantList save() const
  {
    VariantList ret;
    for (const auto& item : *this) {
      ret.push_back(VariantList(item.first, item.second));
    }

    return ret;
  }
Esempio n. 12
0
void GoodStock::load( const VariantList& stream )
{
  if( stream.size() < 3 )
    return;

  VariantList::const_iterator it=stream.begin();
  _type = (Good::Type)(*it).toInt(); it++;
  _maxQty = (*it).toInt(); it++;
  _currentQty = math::clamp( (*it).toInt(), 0, _maxQty );
}
Esempio n. 13
0
  VariantList save() const
  {
     VariantList ret;
     for( auto& mapItem : *this )
     {
       ret.push_back( Variant( (int)mapItem.first ) );
       ret.push_back( Variant( mapItem.second->value() ) );
     }

     return ret;
  }
Esempio n. 14
0
int NGSD::addColumn(VariantList& variants, QString name, QString description)
{
	variants.annotations().append(VariantAnnotationHeader(name));
	for (int i=0; i<variants.count(); ++i)
	{
		variants[i].annotations().append("");
	}

	variants.annotationDescriptions().append(VariantAnnotationDescription(name, description));

	return variants.annotations().count() - 1;
}
void ArcadeInputComponent::ActivateBinding(ArcadeKeyBind *pBind, bool bDown)
{
	//special handling for directional keys, so they work in tandem with the trackball or whatever else also does directions

	bool bWasDirectionalKey = true;

	switch (pBind->m_outputkeycode)
	{
		case VIRTUAL_KEY_DIR_LEFT:  m_buttons[MOVE_BUTTON_DIR_LEFT].OnPressToggle(bDown, m_customSignal);  break;
		case VIRTUAL_KEY_DIR_RIGHT:  m_buttons[MOVE_BUTTON_DIR_RIGHT].OnPressToggle(bDown, m_customSignal);  break;
		case VIRTUAL_KEY_DIR_UP:  m_buttons[MOVE_BUTTON_DIR_UP].OnPressToggle(bDown, m_customSignal);  break;
		case VIRTUAL_KEY_DIR_DOWN:  m_buttons[MOVE_BUTTON_DIR_DOWN].OnPressToggle(bDown, m_customSignal); break;
			
		default:

			bWasDirectionalKey = false;
			break;
	}

	if (bWasDirectionalKey) 
	{
		//avoid sending it twice, we already would above
		return;
	}

	//for other keys, just send it through the arcade signal:
	VariantList v;
	v.Get(0).Set(pBind->m_outputkeycode);
	v.Get(1).Set(uint32(bDown)); 

	if (m_customSignal)
	{
		(*m_customSignal)(&v);
	} else
	{
		GetBaseApp()->m_sig_arcade_input(&v);
	}

	if (bDown)
	{
		//send as normal key, only on the keydown
		VariantList v2;
		v2.Get(0).Set((float)MESSAGE_TYPE_GUI_CHAR);
		v2.Get(1).Set(0,0);
		v2.Get(2).Set(uint32(pBind->m_outputkeycode));
		GetBaseApp()->m_sig_input(&v2);
	}
	if (pBind->m_bOutputAsNormalKeyToo)
	{
		//also send as regular global key
		GetBaseApp()->m_sig_raw_keyboard(&v);
	}
}
Esempio n. 16
0
void JSAPIImpl::FireJSEvent( const std::string& eventName, const VariantMap &members, const VariantList &arguments )
{
    if (!m_valid)   // When invalidated, do nothing more
        return;

    {
        JSAPIImplPtr self(shared_from_this());
        boost::recursive_mutex::scoped_lock _l(m_proxyMutex);
        ProxyList::iterator proxyIt = m_proxies.begin();
        while (proxyIt != m_proxies.end()) {
            JSAPIImplPtr proxy(proxyIt->lock());
            if (!proxy) {
                // Since you can't use a shared_ptr in a destructor, there
                // is no way for the proxy object to let us know when it goes
                // away; thus when we find them, we remove them for efficiency
                proxyIt = m_proxies.erase(proxyIt);
                continue;
            }

            VariantList newArgs = proxyProcessList(arguments, self, proxy);
            VariantMap newMap = proxyProcessMap(members, self, proxy);

            proxy->FireJSEvent(eventName, newMap, newArgs);
            proxyIt++;
        }
    }

    VariantList args;
    args.push_back(CreateEvent(shared_from_this(), eventName, members, arguments));

    {
        boost::recursive_mutex::scoped_lock _l(m_eventMutex);
        EventContextMap::iterator it(m_eventMap.begin());
        while (it != m_eventMap.end()) {
            std::pair<EventMultiMap::iterator, EventMultiMap::iterator> range = it->second.equal_range(eventName);
            for (EventMultiMap::const_iterator eventIt = range.first; eventIt != range.second; eventIt++) {
                eventIt->second->InvokeAsync("", args);
            }
            ++it;
        }
    }

    // Some events are registered as a jsapi object with a method of the same name as the event
    {
        boost::recursive_mutex::scoped_lock _l(m_eventMutex);
        EventIfaceContextMap::iterator it(m_evtIfaces.begin());
        while (it != m_evtIfaces.end()) {
            for (EventIFaceMap::const_iterator ifaceIt = it->second.begin(); ifaceIt != it->second.end(); ifaceIt++) {
                ifaceIt->second->InvokeAsync(eventName, args);
            }
        }
    }
}
Esempio n. 17
0
void TileOverlay::save( VariantMap& stream ) const
{
  VariantList config;
  config.push_back( (int)_d->overlayType );
  config.push_back( Variant( MetaDataHolder::instance().getData( _d->overlayType ).getName() ) );
  config.push_back( getTile().getIJ() );

  stream[ "config" ] = config;
  stream[ "picture" ] = Variant( _d->picture.getName() );
  stream[ "pictureOffset" ] = _d->picture.getOffset();
  stream[ "size" ] = _d->size;
  stream[ "isDeleted" ] = _d->isDeleted;
  stream[ "name" ] = Variant( _d->name );
}
Esempio n. 18
0
VariantMap Storage::save() const
{
  VariantMap stream = good::Store::save();

  stream[ "max" ] = _gsd->capacity;

  VariantList stockSave;
  for( auto& stockInfo : _gsd->stocks )
    stockSave.push_back( stockInfo->save() );

  stream[ "stock" ] = stockSave;

  return stream;
}
Esempio n. 19
0
void Stock::load( const VariantList& stream )
{
  if( stream.empty())
    return;

  _type = stream.get( 0 ).toInt();
  if( _type >= good::goodCount.toInt() )
  {
    Logger::warning( "GoodStock: wrong type of good %d", _type );
    _type = good::none.toInt();
  }

  _capacity = (int)stream.get( 1 );
  _qty = math::clamp( (int)stream.get( 2 ), 0, _capacity );
}
Esempio n. 20
0
void SimpleGoodStore::load( const VariantMap& stream )
{
    _goodStockList.clear();

    GoodStore::load( stream );
    _maxQty = (int)stream.get( "max" );

    VariantList stockSave = stream.get( "stock" ).toList();
    for( VariantList::iterator it=stockSave.begin(); it!=stockSave.end(); it++ )
    {
        GoodStock restored;
        restored.load( (*it).toList() );
        _goodStockList.push_back( restored );
    }
}
Esempio n. 21
0
const VariantList Database::getValueForItemNameAsVector( const std::string &item) const
{
    VariantList list;
    
    std::istringstream f( getValueForItemName( item )->getString() );
    std::string s;
    
    while (getline(f, s, ' '))
    {
        if ( !s.empty() )
            list.push_back( s );
    }
    
    return list;
    
}
Esempio n. 22
0
VariantMap SimpleGoodStore::save() const
{
    VariantMap stream = GoodStore::save();

    stream[ "max" ] = _maxQty;

    VariantList stockSave;
    for( std::vector<GoodStock>::const_iterator itStock = _goodStockList.begin(); itStock != _goodStockList.end(); itStock++)
    {
        stockSave.push_back( (*itStock).save() );
    }

    stream[ "stock" ] = stockSave;

    return stream;
}
Esempio n. 23
0
    VariantList save() 
    {
      VariantList ret;
      ret.push_back( sellPrice );
      ret.push_back( buyPrice );
      ret.push_back( exportLimit );
      ret.push_back( importLimit );
      ret.push_back( soldGoods );
      ret.push_back( bougthGoods );
      ret.push_back( stacking );
      ret.push_back( order );
      ret.push_back( vendor );

      return ret;
    }
void MoveButtonState::ReleaseIfNeeded(boost::signal<void (VariantList*)> *pCustomSignal)
{
	if (m_bIsDown)
	{
		m_bIsDown = false;
		VariantList v;

		v.Get(0).Set(uint32(m_keyType));
		v.Get(1).Set(uint32(VIRTUAL_KEY_RELEASE)); 
	
		if (pCustomSignal)
		{
			(*pCustomSignal)(&v);
		} else
		{
			GetBaseApp()->m_sig_arcade_input(&v);
		}	
	}
}
Esempio n. 25
0
    void load( const VariantList& stream )
    {
      if( stream.size() != 9 )
      {
        Logger::warning( "%s [%s %d]", "Incorrect argument number in ", __FILE__, __LINE__ );
        return;
      }

      VariantList::const_iterator it=stream.begin();
      sellPrice = it->toUInt(); ++it;
      buyPrice = it->toUInt(); ++it;
      exportLimit = it->toUInt(); ++it;
      importLimit = it->toUInt(); ++it;
      soldGoods = it->toUInt(); ++it;
      bougthGoods = it->toUInt(); ++it;
      stacking = it->toBool(); ++it;
      order = (trade::Order)it->toInt(); ++it;
      vendor = it->toBool();
    }
Esempio n. 26
0
void NGSD::setReportVariants(const QString& filename, const VariantList& variants, QSet<int> selected_indices)
{
	QString ps_id = processedSampleId(filename);

	//get variant ID
	for(int i=0; i<variants.count(); ++i)
	{
		getQuery().exec("UPDATE detected_variant SET report=" + QString(selected_indices.contains(i) ? "1" : "0" ) + " WHERE processed_sample_id='" + ps_id + "' AND variant_id='" + variantId(variants[i]) + "'");
	}
}
Esempio n. 27
0
    void load( const VariantList& stream )
    {
      if( stream.size() != 9 )
      {
        StringHelper::debug( 0xff, "%s [%s %d]", "Incorrect argument number in ", __FILE__, __LINE__ );
        return;
      }

      VariantList::const_iterator it=stream.begin();
      sellPrice = it->toUInt(); it++;
      buyPrice = it->toUInt(); it++;
      exportLimit = it->toUInt(); it++;
      importLimit = it->toUInt(); it++;
      soldGoods = it->toUInt(); it++;
      bougthGoods = it->toUInt(); it++;
      stacking = it->toBool(); it++;
      order = (CityTradeOptions::Order)it->toInt(); it++;
      vendor = it->toBool();
    }
Esempio n. 28
0
void PictureBank::Impl::loadAtlas(const vfs::Path& filePath)
{
  if( !filePath.exist() )
  {
    Logger::warning( "PictureBank: cant find atlas " + filePath.toString() );
    return;
  }

  VariantMap info = config::load( filePath );

  vfs::Path texturePath = info.get( "texture" ).toString();

  vfs::NFile file = vfs::NFile::open( texturePath );

  Picture mainTexture;
  if( file.isOpen() )
  {
    mainTexture = PictureLoader::instance().load( file );
  }
  else
  {
    Logger::warning( "PictureBank: load atlas failed for texture" + texturePath.toString() );
    mainTexture = Picture::getInvalid();
  }

  //SizeF mainRectSize = mainTexture.size().toSizeF();
  if( !info.empty() )
  {
    VariantMap items = info.get( framesSection ).toMap();
    for( auto& i : items )
    {
      VariantList rInfo = i.second.toList();
      Picture pic = mainTexture;
      Point start( rInfo.get( 0 ).toInt(), rInfo.get( 1 ).toInt() );
      Size size( rInfo.get( 2 ).toInt(), rInfo.get( 3 ).toInt() );

      pic.setOriginRect( Rect( start, size ) );
      setPicture( i.first, pic );
    }
  }
}
Esempio n. 29
0
/**
 * parseArray
 */
Variant Json::parseArray(const std::string &json, int &index, bool &success)
{
  VariantList list;

  Json::nextToken(json, index);

  bool done = false;
  while(!done)
  {
    int token = Json::lookAhead(json, index);

    if(token == JsonTokenNone)
    {
      success = false;
      return VariantList();
    }
    else if(token == JsonTokenComma)
    {
      Json::nextToken(json, index);
    }
    else if(token == JsonTokenSquaredClose)
    {
      Json::nextToken(json, index);
      break;
    }
    else
    {
      Variant value = Json::parseValue(json, index, success);

      if(!success)
      {
        return VariantList();
      }

      list.push_back(value);
    }
  }

  return Variant(list);
}
Esempio n. 30
0
void PictureInfoBank::initialize(vfs::Path filename)
{
  Logger::warning( "PictureInfoBank: start load offsets from " + filename.toString() );
  VariantMap m = config::load( filename );

  foreach( it, m )
  {
    Variant v = it->second;
    Logger::warning( "Set offset for " + it->first );
    if( v.type() == Variant::Map )
    {
      VariantMap vm = v.toMap();
      int startIndex = vm[ "start" ];
      int stopIndex = vm[ "stop" ];
      std::string rc = vm[ "rc" ].toString();
      Point offset = vm[ "offset" ].toPoint();
      _d->setRange( rc.empty() ? it->first : rc, startIndex, stopIndex, offset );
    }
    else if( v.type() == Variant::List )
    {
      VariantList vl = v.toList();
      _d->setOne( it->first, vl.get( idxIndex ), vl.get( idxXOffset ), vl.get( idxYOffset ) );
    }
  }