void RKVariable::writeData (int from_row, int to_row, RCommandChain *chain) { RK_TRACE (OBJECTS); if (from_row == -1) return; // TODO: try to sync in correct storage mode if (from_row == to_row) { RKGlobals::rInterface ()->issueCommand (getFullName () + '[' + QString::number (from_row+1) + "] <- " + getRText (from_row), RCommand::App | RCommand::Sync, QString::null, 0,0, chain); if (myData ()->cell_states[from_row] & RKVarEditData::UnsyncedInvalidState) writeInvalidField (from_row, chain); } else { QString data_string = "c ("; for (int row = from_row; row <= to_row; ++row) { // TODO: use getCharacter and direct setting of vectors. data_string.append (getRText (row)); if (row != to_row) { data_string.append (", "); } if (myData ()->cell_states[row] & RKVarEditData::UnsyncedInvalidState) writeInvalidField (row, chain); } data_string.append (")"); RKGlobals::rInterface ()->issueCommand (getFullName () + '[' + QString::number (from_row + 1) + ':' + QString::number (to_row + 1) + "] <- " + data_string, RCommand::App | RCommand::Sync, QString::null, 0,0, chain); } ChangeSet *set = new ChangeSet; set->from_index = from_row; set->to_index = to_row; RKGlobals::tracker ()->objectDataChanged (this, set); }
void RObject::writeMetaData (RCommandChain *chain) { RK_TRACE (OBJECTS); if (!meta_map) { if (hasMetaObject ()) { RCommand *command = new RCommand ("attr (" + getFullName () + ", \".rk.meta\") <- NULL", RCommand::App | RCommand::Sync); RKGlobals::rInterface ()->issueCommand (command, chain); } type -= (type & HasMetaObject); return; } QString command_string = ".rk.set.meta (" + getFullName () + ", c ("; for (MetaMap::const_iterator it = meta_map->constBegin (); it != meta_map->constEnd (); ++it) { if (it != meta_map->constBegin ()) { command_string.append (", "); } command_string.append (rQuote (it.key ()) + '=' + rQuote (it.value ())); } command_string.append ("))"); RCommand *command = new RCommand (command_string, RCommand::App | RCommand::Sync); RKGlobals::rInterface ()->issueCommand (command, chain); type |= HasMetaObject; }
void RepositoryDependencyAnalyser::InitTypeTable(string moduleName){ // go through each folder and see if the repository is closed, if yes, then take all files into the list for analysis vector<string> fileList; auto directories = FileSystemSearchHelper::searchDirectories(RepositoryMetadataHelper::repository_path, "*"); map<string, RepositoryMetadata> modules; for (auto dir : directories) { auto metadata = RepositoryMetadataHelper::GetMetadata(dir); auto it = modules.find(metadata.Name); if (it != modules.end()) { if (it->second.Version < metadata.Version) it->second = metadata; } else modules.insert({ metadata.Name, metadata }); } for(auto module : modules){ auto dir = RepositoryMetadataHelper::repository_path + module.second.getFullName() + "/"; auto metadata = RepositoryMetadataHelper::GetMetadata(dir); // Only analysis the closed repository if (!metadata.Name.empty() && metadata.Closed && !RepositoryMetadata::VersionCompared(metadata.getFullName(), moduleName) ) { for (auto f : metadata.FileList) { auto filePath = RepositoryMetadataHelper::repository_path + "/" + metadata.getFullName() + "/" + f; fileList.push_back(filePath); moduleLookupTable.insert({ filePath, metadata.getFullName() }); } } } ThreadPool pool(5); this->typeTable = test_getType(pool, fileList); }
void RKVariable::writeInvalidField (int row, RCommandChain *chain) { RK_TRACE (OBJECTS); if (myData ()->invalid_fields[row]) { RKGlobals::rInterface ()->issueCommand (".rk.set.invalid.field (" + getFullName () + ", " + QString::number (row+1) + ", " + rQuote (*(myData ()->invalid_fields[row])) + ')', RCommand::App | RCommand::Sync, QString::null, 0,0, chain); } else { RKGlobals::rInterface ()->issueCommand (".rk.set.invalid.field (" + getFullName () + ", " + QString::number (row+1) + ", NULL)", RCommand::App | RCommand::Sync, QString::null, 0,0, chain); } myData ()->cell_states[row] -= (myData ()->cell_states[row] & RKVarEditData::UnsyncedInvalidState); }
std::string VsUnstructuredMesh::getHexahedralsDatasetName() { //First see if the user has specified a name for the dataset std::string hexahedralsName; getStringAttribute(VsSchema::Unstructured::vsHexahedrals, &hexahedralsName); if (!hexahedralsName.empty()) { return makeCanonicalName(getFullName(), hexahedralsName); } return makeCanonicalName(getFullName(), VsSchema::Unstructured::defaultHexahedralsName); }
std::string VsUnstructuredMesh::getPrismsDatasetName() { //First see if the user has specified a name for the dataset std::string prismsName; getStringAttribute(VsSchema::Unstructured::vsPrisms, &prismsName); if (!prismsName.empty()) { return makeCanonicalName(getFullName(), prismsName); } return makeCanonicalName(getFullName(), VsSchema::Unstructured::defaultPrismsName); }
std::string VsUnstructuredMesh::getPointsDatasetName() { //First see if the user has specified a name for the dataset std::string pointsName; getStringAttribute(VsSchema::Unstructured::vsPoints, &pointsName); if (!pointsName.empty()) { return makeCanonicalName(getFullName(), pointsName); } //if we didn't find vsPoints, try the default name return makeCanonicalName(getFullName(), VsSchema::Unstructured::defaultPointsName); }
/***** Active Skills *****/ int ServantAssassin::poisonStrike(vector<Servant *> defenders) { if (actionMPCosts[ascension][1] > currMP) return 1; // Not enough MP to attack else { subMP(actionMPCosts[ascension][1]); for (unsigned int i = 0; i < defenders.size(); i++) { log->addToEventLog(getFullName() + " used Poison Strike against " + defenders[i]->getFullName() + "!"); // Check if you hit the targets vector<int> opEvade = defenders[i]->getEvade(); bool hit = false; // Calculate accuracy int accuracy = capZero(getHitRate() - opEvade[0]); int r = getRandNum(); if (accuracy >= r) hit = true; // Skill: Presence Detection skips all other evasion checks! // If you hit, apply the poison debuff if (hit) { vector<Stat> dStats; dStats.push_back(HP); vector<int> dAmount; dAmount.push_back(-1 * (defenders[i]->getMaxHP() / 20)); Debuff *poison = new Debuff("Poison", "Poison does damage over time.", defenders[i]->getTeam(), dStats, dAmount, 5); defenders[i]->addDebuff(poison); log->addToEventLog(getFullName() + " poisoned " + defenders[i]->getFullName() + "!"); } else { log->addToEventLog(getFullName() + " missed " + defenders[i]->getFullName() + "!"); } // Poison strike does no damage and thus there is no need to check // if the defender is dead. } } return 0; }
void VsVariableWithMesh::createTransformedVariableAndMesh() { VsLog::debugLog() <<"VsVariableWithMesh::createTransformedVariableAndMesh() - Creating transformed var name." <<std::endl; // Does this variable have a transformation? if (hasTransform()) { VsLog::debugLog()<<"VsVariableWithMesh::createTransformedVariableAndMesh() - registering transformed variable: " + getFullTransformedName() <<std::endl; registry->registerTransformedVarName(getFullTransformedName(), getFullName()); //And register the transformed mesh name to match registry->registerTransformedMeshName(getFullTransformedName(), getFullName()); } VsLog::debugLog() <<"VsVariableWithMesh::createTransformedVariable() - returning." <<std::endl; }
std::string getClipIdentifier() const { if( isOutput() || ! isConnected() ) return getFullName(); else return getConnectedClipFullName(); }
std::string VsUnstructuredMesh::getPointsDatasetName(int i) { std::string attributeName; switch (i) { case 0: attributeName = VsSchema::Unstructured::vsPoints0; break; case 1: attributeName = VsSchema::Unstructured::vsPoints1; break; case 2: attributeName = VsSchema::Unstructured::vsPoints2; break; default: VsLog::debugLog() << __CLASS__ << __FUNCTION__ << " " << __LINE__ << " " << "Requested index (" << i << ") is out of range." << std::endl; return ""; } std::string fullName; getStringAttribute(attributeName, &fullName); //might be empty //if the name was found, make sure it's fully qualified if (!fullName.empty()) { fullName = makeCanonicalName(getFullName(), fullName); } return fullName; }
bool Representation::doWakeUp() { if (getMaterial() == nullptr && !m_materialReference.empty()) { std::vector<std::string> names; boost::split(names, m_materialReference, boost::is_any_of("/")); SURGSIM_ASSERT(names.size() == 2) << "Material reference needs to have 2 parts <scenelement>/<component>, '" << m_materialReference << "' in " << getFullName() << " doesn't."; auto material = getScene()->getComponent(names[0], names[1]); if (material != nullptr) { setMaterial(material); } else { SURGSIM_LOG_WARNING(Framework::Logger::getLogger("Graphics/Representation")) << "Can't find material " << m_materialReference << " in Scene, rendering of " << getFullName() << " is going to be compromised."; } } return true; }
utils::DynVector XMLTag:: getDynVectorAttributeValue ( const std::string& name, int dimensions ) const { preciceTrace2("getDynVectorAttributeValue()", name, dimensions); std::map<std::string,XMLAttribute<utils::DynVector> >::const_iterator iter; iter = _dynVectorAttributes.find(name); assertion (iter != _dynVectorAttributes.end()); preciceCheck(iter->second.getValue().size() >= dimensions, "getDynVectorAttributeValue()", "Vector attribute \"" << name << "\" of tag <" << getFullName() << "> has less dimensions than required (" << iter->second.getValue().size() << " instead of " << dimensions << ")!" ); // Read only first "dimensions" components of the parsed vector values utils::DynVector result(dimensions); const utils::DynVector& parsed = iter->second.getValue(); for (int i=0; i < dimensions; i++){ result[i] = parsed[i]; } preciceDebug("Returning value = " << result); return result; }
virtual void copyTo(ISecUser& destination) { destination.setAuthenticateStatus(getAuthenticateStatus()); destination.setName(getName()); destination.setFullName(getFullName()); destination.setFirstName(getFirstName()); destination.setLastName(getLastName()); destination.setRealm(getRealm()); destination.setFqdn(getFqdn()); destination.setPeer(getPeer()); destination.credentials().setPassword(credentials().getPassword()); CDateTime tmpTime; destination.setPasswordExpiration(getPasswordExpiration(tmpTime)); destination.setStatus(getStatus()); if(m_parameters.get()==NULL) return; CriticalBlock b(crit); Owned<IPropertyIterator> Itr = m_parameters->getIterator(); Itr->first(); while(Itr->isValid()) { destination.setProperty(Itr->getPropKey(),m_parameters->queryProp(Itr->getPropKey())); Itr->next(); } //addToken is not currently implemented.... // DBGLOG("Copied name %s to %s",getName(),destination.getName()); }
void ServantBerserkerFlail::subHP(int hp, DamageType dt) { bool noDamage = false; int r = getRandNum(); if (((ascension == 1 && r <= getLuk()) || (ascension == 2 && r <= getLuk() * 1.5)) && (dt == D_STR || dt == D_MAG)) { noDamage = true; log->addToEventLog(getFullName() + " deflected the attack and took no damage! Spin to Win!"); } if (!noDamage) { currHP -= hp; int mhp = getMaxHP(); if (currHP > mhp) currHP = mhp; else if (currHP <= 0) { currHP = 0; remAllDebuffs(false); } } }
void VsDataset::write() const { std::string offset = ""; for (int i = 0; i < getDepth(); ++i) { offset += " "; } VsLog::debugLog() << offset << getFullName() <<"(" <<getId() <<")" << std::endl; }
size_t VsMDVariable::getNumComps() { VsLog::debugLog() << "VsMDVariable::getNumComps() - Entering for variable " <<getFullName() <<std::endl; if (numComponents == -1) { // Look up all subordinate vars // Get num components for each (should all be the same) // Return the smallest (in case they're not all the same) for (unsigned int i = 0; i < getNumBlocks(); i++) { VsVariable* varMeta = getBlock(i); if (varMeta == NULL) { VsLog::debugLog() <<"VsMDVariable::getNumComps() - Unable to find block #" <<i <<"? Returning 0." <<std::endl; return 0; } int comps = varMeta->getNumComps(); //first time through the loop we just initialize the comparison variable if (numComponents == -1) { numComponents = comps; } else { //the rest of the times through the loop we do some comparisons and error checking if (comps < numComponents) { VsLog::debugLog() <<"VsMDVariable::getNumComps() - mismatch between number of components in subordinate blocks" <<std::endl; numComponents = comps; } else if (comps > numComponents) { VsLog::debugLog() <<"VsMDVariable::getNumComps() - mismatch between number of components in subordinate blocks" <<std::endl; //note that we do NOT adjust fewestComponents here } } } } VsLog::debugLog() <<"VsMDVariable::getNumComps() - Returning " <<numComponents <<"." <<std::endl; return numComponents; }
void Interface::updateSuperTypes() { assert( _numSuperTypes == 0 && !_superTypes ); if( !_baseType ) { assert( getFullName() == "co.IService" ); return; } IInterface* base = _baseType; while( base ) { ++_numSuperTypes; base = base->getBaseType(); } _superTypes = new IInterface*[_numSuperTypes]; base = _baseType; for( size_t i = 0; i < _numSuperTypes; ++i ) { _superTypes[i] = base; base = base->getBaseType(); } assert( _superTypes[_numSuperTypes - 1]->getFullName() == "co.IService" ); }
virtual void copyTo(ISecUser& destination) { destination.setAuthenticateStatus(getAuthenticateStatus()); destination.setName(getName()); destination.setFullName(getFullName()); destination.setFirstName(getFirstName()); destination.setLastName(getLastName()); destination.setEmployeeID(getEmployeeID()); destination.setRealm(getRealm()); destination.setFqdn(getFqdn()); destination.setPeer(getPeer()); destination.credentials().setPassword(credentials().getPassword()); destination.credentials().setSessionToken(credentials().getSessionToken()); destination.credentials().setSignature(credentials().getSignature()); CDateTime exp; credentials().getPasswordExpiration(exp); destination.credentials().setPasswordExpiration(exp); CDateTime tmpTime; destination.setPasswordExpiration(getPasswordExpiration(tmpTime)); destination.setStatus(getStatus()); CriticalBlock b(crit); Owned<IPropertyIterator> Itr = m_parameters->getIterator(); ForEach(*Itr) { destination.setProperty(Itr->getPropKey(),m_parameters->queryProp(Itr->getPropKey())); } // DBGLOG("Copied name %s to %s",getName(),destination.getName()); }
void GUIGlObject::buildPopupHeader(GUIGLObjectPopupMenu* ret, GUIMainWindow& app, bool addSeparator) { new MFXMenuHeader(ret, app.getBoldFont(), getFullName().c_str(), 0, 0, 0); if (addSeparator) { new FXMenuSeparator(ret); } }
const char* PatchBank::loadPreenFMPatchName(const struct PFM2File* bank, int patchNumber) { // Get name position int namePosition = (int)(((unsigned int) reachableFlashParam.presetName) - (unsigned int)&reachableFlashParam); const char* fullBankName = getFullName(bank->name); int result = load(fullBankName, ALIGNED_PATCH_SIZE * patchNumber + namePosition, (void*)presetName, 12); presetName[12] = 0; return presetName; }
string Type::getTypeNameKey() const { string prefix = getSymbolKindName(); string fullname = getFullName(); return prefix.empty() ? fullname : (prefix + " " + fullname); }
bool BFile::delet() const { #ifdef _MSC_VER bool ret = _wremove(getFullName().c_str()) == 0; #else bool ret = remove(getFullNameUtf8().c_str()) == 0; #endif return ret; }
void VsGroup::write() const { //calculate how much indentation to use std::string offset = ""; for (int i = 0; i < getDepth(); ++i) offset += " "; VsLog::debugLog() << offset << getFullName() <<"(" <<getId() <<")" <<std::endl; }
GUIManipulator* GUITriggeredRerouter::openManipulator(GUIMainWindow& app, GUISUMOAbstractView&) { GUIManip_TriggeredRerouter* gui = new GUIManip_TriggeredRerouter(app, getFullName(), *this, 0, 0); gui->create(); gui->show(); return gui; }
// 创建对象实体 void BoxTriggerObject::create(IScene *scene , const NameValuePairList* params) { destroy(); NullObject::create(scene , params); // 创建实体 m_entity = m_scene->getTriggerWorld()->createBoxTriggerEntity(getFullName()); m_entity->setUserAny(Any(static_cast<ISceneObject*>(this))); m_node->setListener(this); }
std::string getConnectedClipFullName() const { if( isOutput() || !isConnected() || _connectedClip->getFullName().size() == 0 ) { BOOST_THROW_EXCEPTION( exception::Logic() << exception::user( "Input clip " + getFullName() + " is not connected !" ) ); } return _connectedClip->getFullName(); }
GUIManipulator* GUICalibrator::openManipulator(GUIMainWindow& app, GUISUMOAbstractView&) { GUIManip_Calibrator* gui = new GUIManip_Calibrator(app, getFullName(), *this, 0, 0); gui->create(); gui->show(); return gui; }
byps_ptr<ifstream> BFile::open(ios_base::openmode mode) const { #ifdef _MSC_VER ifstream* fstrm = new ifstream(getFullName().c_str(), mode); return byps_ptr<ifstream>(fstrm); #else ifstream* fstrm = new ifstream(getFullNameUtf8().c_str(), mode); return byps_ptr<ifstream>(fstrm); #endif }
// Write void VsMDVariable::write() { VsLog::debugLog() <<" MDVar: " <<getFullName() <<std::endl; for (unsigned int i = 0; i < blocks.size(); i++) { VsLog::debugLog() <<" block #" <<i <<" = " <<blocks[i]->getFullName() <<std::endl; } VsLog::debugLog() << " indexOrder = " << indexOrder << std::endl; VsLog::debugLog() << " centering = " << centering << std::endl; VsLog::debugLog() << " MD mesh = " << mesh << std::endl; }