Beispiel #1
0
ModelObject *ModelData::createDataType(eModelDataTypes type, const std::string &id)
    {
    ModelObject *obj = nullptr;
    switch(type)
        {
        case DT_DataType:
            {
            ModelType *dataType = new ModelType(id);
            /// @todo - use make_unique when supported.
            addType(std::unique_ptr<ModelType>(dataType));
            obj = dataType;
            }
            break;

        case DT_Class:
            {
            ModelClassifier *classifier = new ModelClassifier(id);
            /// @todo - use make_unique when supported.
            addType(std::unique_ptr<ModelType>(classifier));
            obj = classifier;
            break;
            }

        default:
            break;
        }
    return obj;
    }
Beispiel #2
0
  void EAM::addExplicitInteraction(AtomType* atype1, AtomType* atype2, 
                                   RealType dr, int nr,
                                   vector<RealType> phiVals) {
    
    // in case these weren't already in the map
    addType(atype1);
    addType(atype2);

    EAMInteractionData mixer;
    CubicSpline* cs = new CubicSpline();
    vector<RealType> rVals;

    for (int i = 0; i < nr; i++) rVals.push_back(i * dr);

    cs->addPoints(rVals, phiVals);
    mixer.phi = cs;
    mixer.rcut = mixer.phi->getLimits().second;
    mixer.explicitlySet = true;

    int eamtid1 = EAMtids[ atype1->getIdent() ];
    int eamtid2 = EAMtids[ atype2->getIdent() ];
    
    MixingMap[eamtid1][eamtid2] = mixer;
    if (eamtid2 != eamtid1) {
      MixingMap[eamtid2][eamtid1] = mixer;
    }    
    return;
  }
Beispiel #3
0
int fbtBuildInfo::getLengths(fbtBuildStructs& struct_builders)
{


	makeBuiltinTypes();

	fbtBuildStructs::Iterator bit = struct_builders.iterator();
	while (bit.hasMoreElements())
	{
		fbtBuildStruct& bs = bit.getNext();
		bs.m_structId = addType(bs.m_name, 0);

		m_strc.push_back(bs.m_structId);
		m_strc.push_back((FBTint16)bs.m_data.size());

		m_alloc.m_strc += (sizeof(FBTtype) * 2);


		fbtVariables::Iterator it = bs.m_data.iterator();
		while (it.hasMoreElements())
		{
			fbtVariable& cvar = it.getNext();

			cvar.m_typeId = addType(cvar.m_type, 0);
			cvar.m_nameId = addName(cvar.m_name);

			m_strc.push_back(cvar.m_typeId);
			m_strc.push_back(cvar.m_nameId);

			m_alloc.m_strc += (sizeof(FBTtype) * 2);
		}
	}

	return getTLengths(struct_builders);
}
Beispiel #4
0
void GmacsParser::parse(GmacsToken **token)
{
	bool isType = false;
	for (int i = 0; token[i] != NULL; i++) {
		if (searchFromType(token[i])) {
			token[i]->type = TYPE_T;
			isType = true;
		} else if (searchFromPreserve(token[i])) {
			token[i]->type = PRESERVE_T;
			if (isClassType == true) {
				if (token[i + 1] != NULL && token[i + 1]->type == SPACE_T &&
					token[i + 2] != NULL && token[i + 2]->word.contains(QRegExp("^\\w*$"))) {
					addType(token[i + 2]->word);
				} else if (token[i + 1] != NULL && token[i + 1]->type != SPACE_T &&
						   token[i + 1]->word.contains(QRegExp("^\\w*$"))) {
					addType(token[i + 1]->word);
				}
			}
			isClassType = false;
		} else if (token[i]->type == DEF_T && isType &&
				   token[i]->word.contains(QRegExp("^\\w*$"))) {
			token[i]->type = VAR_T;
			isType = false;
		}
	}
	int name_idx = getFuncNameIdx(token);
	if (name_idx > 0) {
		token[name_idx]->type = FUNC_T;
	}
}
Beispiel #5
0
ArcherGuy::ArcherGuy()
{
	addType(TYP_CLIPS);
	addType(TYP_HAS_GRAV);
	size->set(.5, .95);
	dir_facing = DIR_RIGHT;
	firingArrow = 0;
	fireArrowCount = 0;
	fireArrowCooldown = 0;
}
Beispiel #6
0
 explicit TypeValidator(const dynamic& schema) {
   if (schema.isString()) {
     addType(schema.stringPiece());
   } else if (schema.isArray()) {
     for (const auto& item : schema) {
       if (item.isString()) {
         addType(item.stringPiece());
       }
     }
   }
 }
Beispiel #7
0
  void SC::addExplicitInteraction(AtomType* atype1, AtomType* atype2, 
                                  RealType epsilon, RealType m, RealType n,
                                  RealType alpha) {
    
    // in case these weren't already in the map
    addType(atype1);
    addType(atype2);

    SCInteractionData mixer;

    mixer.epsilon = epsilon;
    mixer.m = m;
    mixer.n = n;
    mixer.alpha = alpha;
    mixer.rCut = 2.0 * mixer.alpha;
    
    RealType dr = mixer.rCut / (np_ - 1);
    vector<RealType> rvals;
    vector<RealType> vvals;
    vector<RealType> phivals;
    
    rvals.push_back(0.0);
    vvals.push_back(0.0);
    phivals.push_back(0.0);
    
    for (int k = 1; k < np_; k++) {
      RealType r = dr * k;
      rvals.push_back(r);
      vvals.push_back( mixer.epsilon * pow(mixer.alpha/r, mixer.n) );
      phivals.push_back( pow(mixer.alpha/r, mixer.m) );
    }
    
    mixer.vCut = mixer.epsilon * pow(mixer.alpha/mixer.rCut, mixer.n);
    
    CubicSpline* V = new CubicSpline();
    V->addPoints(rvals, vvals);
    
    CubicSpline* phi = new CubicSpline();
    phi->addPoints(rvals, phivals);
    
    mixer.V = V;
    mixer.phi = phi;
    
    mixer.explicitlySet = true;

    int sctid1 = SCtids[ atype1->getIdent() ];
    int sctid2 = SCtids[ atype2->getIdent() ];

    MixingMap[sctid1][sctid2] = mixer;
    if (sctid2 != sctid1) {
      MixingMap[sctid2][sctid1] = mixer;
    }    
    return;
  }
Beispiel #8
0
 static std::shared_ptr<SymbolTable> getPredefinedTable()
 {
   auto table = std::make_shared<SymbolTable>(nullptr);
   table->addType(std::string("integer"), BuiltInType::getInt());
   table->addType(std::string("INTEGER"), BuiltInType::getInt());
   table->addType(std::string("boolean"), BuiltInType::getBool());
   table->addType(std::string("BOOLEAN"), BuiltInType::getBool());
   table->addType(std::string("char"), BuiltInType::getChar());
   table->addType(std::string("CHAR"), BuiltInType::getChar());
   table->addType(std::string("string"), BuiltInType::getStr());
   table->addType(std::string("STRING"), BuiltInType::getStr());
   return table;
 }
Beispiel #9
0
bool MJGroup::init_BJ()
{
//    if (mjList!= NULL) {
//        mjList->removeAllObjects();
//    }
//    else
    {
       setMjList(__Array::create());
    }
    addType(MJType_Wang);
    addType(MJType_Tiao);
    addType(MJType_Tong);
    return this;
}
Beispiel #10
0
DocTypeRep
DocumenttypesConfigBuilderHelper::document(int32_t id, const vespalib::string &name,
                                           const DatatypeConfig &header,
                                           const DatatypeConfig &body) {
    assert(header.type == DatatypeConfig::STRUCT);
    assert(body.type == DatatypeConfig::STRUCT);
    _config.documenttype.resize(_config.documenttype.size() + 1);
    _config.documenttype.back().id = id;
    _config.documenttype.back().name = name;
    _config.documenttype.back().headerstruct = header.id;
    _config.documenttype.back().bodystruct = body.id;
    addType(header, _config.documenttype.back());
    addType(body, _config.documenttype.back());
    return DocTypeRep(_config.documenttype.back());
}
Beispiel #11
0
void KeyModifiers::init()
{
	m_bitmask = 0x00000001;
	addType("Shift");
	addType("Control");
	addType("Alt");

	ConfigEx& cfg = ConfigEx::getInstance("keyhelper");

	cfg.setGroup("Global");

	QString timeout = cfg.readEntry("ToggleTimeout", "10");
	int msec = timeout.toInt();
	msec *= 1000; /* sec to msec */
	m_timeout = msec;
}
Beispiel #12
0
t_tree addType(t_tree pVariables, eType pType)
{
   if (pVariables == NULL) return NULL;
   pVariables->Node.Variable.Type = pType;
   addType (pVariables->Node.Variable.Next, pType);
   return pVariables;
}
status_t MediaCodecList::addTypeFromAttributes(const char **attrs) {
    const char *name = NULL;

    size_t i = 0;
    while (attrs[i] != NULL) {
        if (!strcmp(attrs[i], "name")) {
            if (attrs[i + 1] == NULL) {
                return -EINVAL;
            }
            name = attrs[i + 1];
            ++i;
        } else {
            return -EINVAL;
        }

        ++i;
    }

    if (name == NULL) {
        return -EINVAL;
    }

    addType(name);

    return OK;
}
Beispiel #14
0
Weapon::Weapon(RenderLayers layer, const float damage, const sf::Texture &texture, const sf::IntRect &rect)
: Item(layer, texture, rect)
, m_damage{ damage }
, m_damageMultiplicator{ 1.f }
{
    addType(WorldObjectTypes::WEAPON);
}
Beispiel #15
0
//put data onto the dataPtr of the data array
OSCMessage& OSCMessage::add(int32_t data){
	//add type
	addType('i');
	//add data;
	addToBuffer(data);
	return *this;
}
Beispiel #16
0
//put data onto the data part of the data array
OSCMessage& OSCMessage::add(unsigned int data){
	//add type
	addType('i');
	//add data;
	addToBuffer(int32_t(data));
	return *this;
}
Beispiel #17
0
void BasicScope::declareType(string name, Type *type){

	if(this->isDefined(name)){
		throw NoticeException("Type '" + name + "' redeclaration #1!");
	}
	addType(name, type);
}
Beispiel #18
0
OSCMessage& OSCMessage::add(double data){
	//add type
	addType('f');
	//add data;
	addToBuffer(float(data));
	return *this;
}
Beispiel #19
0
/* this function gets the index of a dihedral angle in the table
   (adding an entry if none exists).  The required number of
   parameters (see notes on class DihedralTable) must be stored in
   the array <c> */
int DihedralTable::getIndex(const float *c, int mult, int funct) {
  /* check to see if it is in the table already */
  int i,j,jmax;
  if(funct==1 || funct==2) { /* for these we only need two params */
    jmax=2;
  } else { /* for RB we need all 6 */
    jmax=6;
  }

  for(i=0;i<cArray.size();i++) {
    int mismatch=0;
    if(mult != multArray[i]) continue;
    if(funct != functArray[i]) continue;

    for(j=0;j<jmax;j++) {
      if(fabs(c[j]-cArray[i][j])>=0.00001) {
	mismatch=1;
	break;
      }
    }
    if(!mismatch) {
      /* all of the parameters matched */
      return i;
    }
  }
  
  /* nope, it wasn't in the table add a new element! */
  addType(NULL,NULL,c,mult,funct);
  return cArray.size()-1;
}
Beispiel #20
0
Ingredient::Ingredient(const Vector &pos, IngredientData *data, int amount)
 : Entity(),  data(data), amount(amount), gone(false), used(false)
{
	addType(SCO_INGREDIENT);
	entityType = ET_INGREDIENT;
	position = pos;
	lifeSpan = 30;
	if (data)
	{
		setTexture("Ingredients/"+data->gfx);
	}
	int mag = 600;
	if (isRotKind())
		velocity = randVector(mag)*0.5f + Vector(0, -mag)*0.5f;
	else
		velocity = Vector(0,-mag*0.5f);
	gravity = Vector(0, 250); //300
	scale = Vector(0.2,0.2);
	scale.interpolateTo(Vector(1, 1), 0.75);

	if (isRotKind())
		rotation.z = randAngle360();

	layer = LR_ENTITIES;
}
bool KnownPluginList::scanAndAddFile (const String& fileOrIdentifier,
                                      const bool dontRescanIfAlreadyInList,
                                      OwnedArray <PluginDescription>& typesFound,
                                      AudioPluginFormat& format)
{
    const ScopedLock sl (scanLock);

    if (dontRescanIfAlreadyInList
         && getTypeForFile (fileOrIdentifier) != nullptr)
    {
        bool needsRescanning = false;

        for (int i = types.size(); --i >= 0;)
        {
            const PluginDescription* const d = types.getUnchecked(i);

            if (d->fileOrIdentifier == fileOrIdentifier && d->pluginFormatName == format.getName())
            {
                if (format.pluginNeedsRescanning (*d))
                    needsRescanning = true;
                else
                    typesFound.add (new PluginDescription (*d));
            }
        }

        if (! needsRescanning)
            return false;
    }

    if (blacklist.contains (fileOrIdentifier))
        return false;

    OwnedArray <PluginDescription> found;

    {
        const ScopedUnlock sl2 (scanLock);

        if (scanner != nullptr)
        {
            if (! scanner->findPluginTypesFor (format, found, fileOrIdentifier))
                addToBlacklist (fileOrIdentifier);
        }
        else
        {
            format.findAllTypesForFile (found, fileOrIdentifier);
        }
    }

    for (int i = 0; i < found.size(); ++i)
    {
        PluginDescription* const desc = found.getUnchecked(i);
        jassert (desc != nullptr);

        addType (*desc);
        typesFound.add (new PluginDescription (*desc));
    }

    return found.size() > 0;
}
Beispiel #22
0
Array<ProjectExporter::ExporterTypeInfo> ProjectExporter::getExporterTypes()
{
    Array<ProjectExporter::ExporterTypeInfo> types;

    addType (types, XCodeProjectExporter::getNameMac(),          BinaryData::projectIconXcode_png,          BinaryData::projectIconXcode_pngSize);
    addType (types, XCodeProjectExporter::getNameiOS(),          BinaryData::projectIconXcodeIOS_png,       BinaryData::projectIconXcodeIOS_pngSize);
    addType (types, MSVCProjectExporterVC2015::getName(),        BinaryData::projectIconVisualStudio_png,   BinaryData::projectIconVisualStudio_pngSize);
    addType (types, MSVCProjectExporterVC2013::getName(),        BinaryData::projectIconVisualStudio_png,   BinaryData::projectIconVisualStudio_pngSize);
    addType (types, MSVCProjectExporterVC2012::getName(),        BinaryData::projectIconVisualStudio_png,   BinaryData::projectIconVisualStudio_pngSize);
    addType (types, MSVCProjectExporterVC2010::getName(),        BinaryData::projectIconVisualStudio_png,   BinaryData::projectIconVisualStudio_pngSize);
    addType (types, MakefileProjectExporter::getNameLinux(),     BinaryData::projectIconLinuxMakefile_png,  BinaryData::projectIconLinuxMakefile_pngSize);
    addType (types, AndroidProjectExporter::getName(),           BinaryData::projectIconAndroid_png,        BinaryData::projectIconAndroid_pngSize);
    addType (types, CodeBlocksProjectExporter::getNameWindows(), BinaryData::projectIconCodeblocks_png,     BinaryData::projectIconCodeblocks_pngSize);
    addType (types, CodeBlocksProjectExporter::getNameLinux(),   BinaryData::projectIconCodeblocks_png,     BinaryData::projectIconCodeblocks_pngSize);

    return types;
}
CRBFFeatureCalculator::CRBFFeatureCalculator(unsigned int numDim, unsigned int dimensions[], unsigned int partitions[], double offsets[], double sigma[]) : CLinearMultiFeatureCalculator(numDim, dimensions, partitions, offsets, 0)
{
	this->sigma = new double[numDim];
	memcpy(this->sigma, sigma, sizeof(double) * numDim);
	sigmaMaxSize = 2.0;
	initAreaSize();
	addType(FEATURESTATEDERIVATIONX);
}
Beispiel #24
0
OSCMessage& OSCMessage::add(char * data) {
	//first put in the type
	addType('s');
	//then the data
	addToBuffer((uint8_t *) data, strlen(data));
	//pad the string;
	addPadToBuffer(padSize(strlen(data)));
	return *this;
}
Beispiel #25
0
Weapon::Weapon(RenderLayers layer, const float damage, const sf::Texture &texture, 
    const std::vector<sf::IntRect> frameRects, bool centerOrigin, 
    float totalTime, bool repeat)
: Item(layer, texture, frameRects, centerOrigin, totalTime, repeat)
, m_damage{ damage }
, m_damageMultiplicator{ 1.f }
{
    addType(WorldObjectTypes::WEAPON);
}
Beispiel #26
0
  static std::shared_ptr<SymbolTable> getPredefinedTable()
  {
    auto table = std::make_shared<SymbolTable>(nullptr, cs6300::GLOBAL);
    table->addType(std::string("integer"), BuiltInType::getInt());
    table->addType(std::string("INTEGER"), BuiltInType::getInt());
    table->addType(std::string("boolean"), BuiltInType::getBool());
    table->addType(std::string("BOOLEAN"), BuiltInType::getBool());
    table->addType(std::string("char"), BuiltInType::getChar());
    table->addType(std::string("CHAR"), BuiltInType::getChar());
    table->addType(std::string("string"), BuiltInType::getStr());
    table->addType(std::string("STRING"), BuiltInType::getStr());

    table->addConstant("true", std::make_shared<LiteralExpression>(true));
    table->addConstant("TRUE", std::make_shared<LiteralExpression>(true));
    table->addConstant("false", std::make_shared<LiteralExpression>(false));
    table->addConstant("FALSE", std::make_shared<LiteralExpression>(false));
    return table;
  }
bool KnownPluginList::scanAndAddFile (const String& fileOrIdentifier,
                                      const bool dontRescanIfAlreadyInList,
                                      OwnedArray<PluginDescription>& typesFound,
                                      AudioPluginFormat& format)
{
    const ScopedLock sl (scanLock);

    if (dontRescanIfAlreadyInList
         && getTypeForFile (fileOrIdentifier) != nullptr)
    {
        bool needsRescanning = false;

        ScopedLock lock (typesArrayLock);

        for (auto* d : types)
        {
            if (d->fileOrIdentifier == fileOrIdentifier && d->pluginFormatName == format.getName())
            {
                if (format.pluginNeedsRescanning (*d))
                    needsRescanning = true;
                else
                    typesFound.add (new PluginDescription (*d));
            }
        }

        if (! needsRescanning)
            return false;
    }

    if (blacklist.contains (fileOrIdentifier))
        return false;

    OwnedArray<PluginDescription> found;

    {
        const ScopedUnlock sl2 (scanLock);

        if (scanner != nullptr)
        {
            if (! scanner->findPluginTypesFor (format, found, fileOrIdentifier))
                addToBlacklist (fileOrIdentifier);
        }
        else
        {
            format.findAllTypesForFile (found, fileOrIdentifier);
        }
    }

    for (auto* desc : found)
    {
        jassert (desc != nullptr);
        addType (*desc);
        typesFound.add (new PluginDescription (*desc));
    }

    return ! found.isEmpty();
}
Beispiel #28
0
	void CGeorgesNewDialog::getTypes( /* std::string& dir // not needed anymore? */ )
	{
		//nlinfo ("Found %d files in directory '%s'", files.size(), dir.c_str());
		for(uint i = 0; i < _files.size(); i++)
		{
			addType(NLMISC::CFile::getFilename(_files[i]));
			QApplication::processEvents();
		}
	}
Beispiel #29
0
Quad::Quad() : RenderObject()
{
	addType(SCO_QUAD);
	borderAlpha = 0.5;
	//debugLog("Quad::Quad()");
	initQuad();
	//debugLog("End Quad::Quad()");
	//textureSize = Vector(1,1);
}
Beispiel #30
0
Weapon::Weapon(RenderLayers layer, const float damage, 
        const std::string &textureId, 
        const ResourceHolder<sf::Texture> &textureHolder)
: Item(layer, textureId, textureHolder)
, m_damage{ damage }
, m_damageMultiplicator{ 1.f }
{
    addType(WorldObjectTypes::WEAPON);
}