void SubscriptionSet::subscriptionEventCallback( const UtlString* earlyDialogHandle, const UtlString* dialogHandle, SipSubscribeClient::SubscriptionState newState, const UtlString* subscriptionState) { OsSysLog::add(FAC_RLS, PRI_DEBUG, "SubscriptionSet::subscriptionEventCallback newState = %d, earlyDialogHandle = '%s', dialogHandle = '%s', subscriptionState = '%s'", newState, mSubscriptionEarlyDialogHandle.data(), dialogHandle->data(), subscriptionState->data()); switch (newState) { case SipSubscribeClient::SUBSCRIPTION_INITIATED: break; case SipSubscribeClient::SUBSCRIPTION_SETUP: { // Put the subscription into pending state, as we have no // content for it yet. addInstance(dialogHandle->data(), "pending"); } break; case SipSubscribeClient::SUBSCRIPTION_TERMINATED: { deleteInstance(dialogHandle->data(), "terminated", subscriptionState->data()); } break; } }
void SubscriptionSet::subscriptionEventCallback( const UtlString* earlyDialogHandle, const UtlString* dialogHandle, SipSubscribeClient::SubscriptionState newState, const UtlString* subscriptionState) { Os::Logger::instance().log(FAC_RLS, PRI_DEBUG, "SubscriptionSet::subscriptionEventCallback newState = %d, earlyDialogHandle = '%s', dialogHandle = '%s', subscriptionState = '%s'", newState, mSubscriptionEarlyDialogHandle.data(), dialogHandle->data(), subscriptionState->data()); switch (newState) { case SipSubscribeClient::SUBSCRIPTION_INITIATED: break; case SipSubscribeClient::SUBSCRIPTION_SETUP: { // There may be duplicate 'active' subscription callbacks, so first // check whether we already know of the subscription. if (!getInstance(dialogHandle->data())) { // Put the subscription into pending state, as we have no // content for it yet. addInstance(dialogHandle->data(), "pending"); } } break; case SipSubscribeClient::SUBSCRIPTION_TERMINATED: { deleteInstance(dialogHandle->data(), "terminated", subscriptionState->data()); } break; } }
/* Uses the tlp library and deserialize the binary file * with the structures from parsing */ void load_structures() { int i = 0; tpl_node *tn_modules, *tn_instances; Module tmp_module; Instance tmp_instance; Instance *head = NULL; // Map an array structs tn_modules = tpl_map("A(S(c#))", &tmp_module, SIZE); // Load file with structure tpl_load(tn_modules, TPL_FILE, "modules.tpl"); // Unpack the array and save the structrure while(tpl_unpack(tn_modules, 1) > 0) { add_module(tmp_module.name); } // Free the memory tpl_free(tn_modules); // Map a two dimensional array with lists tn_instances = tpl_map("A(A(S(ic#)))", &tmp_instance, SIZE); // Load file with structure tpl_load(tn_instances, TPL_FILE, "instances.tpl"); // Unpack the array and save the structure while(tpl_unpack(tn_instances, 1) > 0) { while(tpl_unpack(tn_instances, 2) > 0) { head = addInstance(head, tmp_instance.instance_name, tmp_instance.module_key); } cells[i] = head; i++; head = NULL; } // Free the memory tpl_free(tn_instances); }
VROntologyInstance* VROntology::addVectorInstance(string name, string concept, string x, string y, string z) { auto i = addInstance(name, concept); i->set("x", x); i->set("y", y); i->set("z", z); return i; }
void SystemClass::loadTable(BaseGame *gameRef, BasePersistenceManager *persistMgr) { _savedID = persistMgr->getDWORD(); int numInstances = persistMgr->getDWORD(); for (int i = 0; i < numInstances; i++) { int instID = persistMgr->getDWORD(); if (_persistent) { if (i > 0) { gameRef->LOG(0, "Warning: attempting to load multiple instances of persistent class %s (%d)", _name.c_str(), numInstances); continue; } Instances::iterator it = _instances.begin(); if (it != _instances.end()) { (it->_value)->setSavedID(instID); SystemClassRegistry::getInstance()->addInstanceToTable((it->_value), (it->_value)->getInstance()); } else { gameRef->LOG(0, "Warning: instance %d of persistent class %s not found", i, _name.c_str()); } } // normal instances, create empty objects else { void *emptyObject = _build(); if (!emptyObject) { warning("HALT"); } addInstance(emptyObject, SystemClassRegistry::getInstance()->getNextID(), instID); } } }
void SWProcess::addInstances(IPropertyTree *parent, IPropertyTree *params) { IPropertyTree* pAttrs = params->queryPropTree("Attributes"); if (!pAttrs) throw MakeStringException(CfgEnvErrorCode::InvalidParams, "Miss instance attributes input"); const char * instanceXMLTagName = getInstanceXMLTagName(params->queryProp("@selector")); Owned<IPropertyTreeIterator> iter = pAttrs->getElements("Attribute"); ForEach (*iter) { IPropertyTree *attr = &iter->query(); const char* propName = attr->queryProp("@name"); if (!stricmp(propName, "ip") || !stricmp(propName, "ipfile")) { bool isFile = false; if (!stricmp(propName, "ipfile")) isFile = true; StringArray ips; m_envHelper->processNodeAddress(attr->queryProp("@value"), ips, isFile); for ( unsigned i = 0; i < ips.ordinality() ; i++) { IPropertyTree * computerNode = addComputer(ips.item(i)); addInstance(computerNode, parent, pAttrs, instanceXMLTagName); } } } }
status_t Schedulable::Schedule(Block *b) { status_t err = B_NO_ERROR; Instance *i=nullptr; ResultValue v0 = EvaluateExpression(b); ResultValue v1 = EvaluateExpression(b->Sibling(1)); ResultValue v2 = EvaluateExpression(b->Sibling(2)); cerr << "scheduling "<< sym->name << " on "<< v0.StringValue() << " at " << v1.StringValue() << " for " << v2.StringValue() << endl; Channel *c=nullptr; if (v0.type == TypedValue::S_CHANNEL) { c = (Channel *)v0.PointerValue(nullptr); } else { short chid = v0.IntValue(nullptr); if (chid >= 0 && chid < uberQua->nChannel) { c = uberQua->channel[chid]; } } i = addInstance(sym->name, v1.type == TypedValue::S_TIME? *v1.TimeValue(): Time(v1.IntValue(nullptr), uberQua->metric), v2.type == TypedValue::S_TIME? *v2.TimeValue(): Time(v2.IntValue(nullptr), uberQua->metric), c); cerr << "instance created and added!!!\n"; return err; }
void ShapeImpl::geometry(const GeometryPtr& geometry) { if (geometry_ != geometry) { if (visibility_) removeInstance(); geometry_ = geometry; if (visibility_) addInstance(); } }
void ShapeImpl::order(uint32_t order) { if (order_ != order) { if (visibility_) removeInstance(); order_ = order; if (visibility_) addInstance(); } }
void SWProcess::computerAdded(IPropertyTree *computerNode, const char *instanceXMLTagName) { StringBuffer sb; sb.clear().appendf("%s/%s[1]", XML_TAG_SOFTWARE, m_processName.str()); IPropertyTree * comp = m_envHelper->getEnvTree()->queryPropTree(sb.str()); assert(comp); const char *instance = (instanceXMLTagName)? instanceXMLTagName: m_instanceElemName.str(); addInstance(computerNode, comp, NULL, instance); }
void ShapeImpl::transparency(bool value) { bool current = (fillMode_ == FillMode::Transparent); if (current != value) { if (visibility_) removeInstance(); fillMode_ = value ? FillMode::Transparent : FillMode::Solid; if (visibility_) addInstance(); } }
bool Schedulable::Trigger() { if (uberQua->status != STATUS_RUNNING) { uberQua->Start(); } addInstance(sym->name, uberQua->theTime, Time::infinity, uberQua->channel[0]); return true; }
void ShapeImpl::visibility(bool enable) { if (visibility_ != enable) { visibility_ = enable; if (visibility_) addInstance(); else removeInstance(); } }
Instance * Schedulable::addInstance(const string &nm, const short chan_id, const Time &t, const Time &d, const bool disp) { Channel *c; if (chan_id >= uberQua->nChannel || chan_id < 0) { return nullptr; } c = uberQua->channel[chan_id]; return addInstance(nm, t, d, c); }
void InputOutputFactory::enumPCKeyboard(void) { wchar_t buffer[20]; for (int i = 0; i < NUM_PC_KEYBOARDS; i++) { wsprintf(buffer, L"PCKEYB%d\0", i); AbstractPhysicalElaborationUnitFactory::PhysicalEUDescription* pDescr = new AbstractPhysicalElaborationUnitFactory::PhysicalEUDescription(buffer, NULL, 0, PCKEYBOARD_INDEX, i); addInstance(pDescr); } }
void LayerCache::reset() { m_instances.clear(); delete m_tree; m_tree = new CacheTree; const std::vector<Instance*>& instances = m_layer->getInstances(); for(std::vector<Instance*>::const_iterator i = instances.begin(); i != instances.end(); ++i) { addInstance(*i); } m_needupdate = true; }
LigandRecord(Residue &ligand, string protein, uint residue_num) { // Strip a possible added ring number size_t pos = ligand.residue.find_last_of('_'); name = ligand.residue.substr(0, pos-1); n_qpoles = ligand.carbonRings.size(); n_anions = 0; if (n_qpoles == 0) n_anions = 1; addInstance(protein, residue_num); }
int Heap::addInstanceCLASS(Class * value){ InstanceCLASS * inst = new InstanceCLASS(value); int n_members = inst->getClass()->getMemberSize(); for(int i = 0; i < n_members; i++){ ds->push(addInstanceINT(0)); // TODO address should me -1 } int pos = addInstance(inst); for(int i = n_members-1; i >= 0; i--){ inst->members[i] = ds->pop(); } return pos; }
void ShapeImpl::image(const ImagePtr& atlas, const Rect& element, const Vector2& tile) { element_ = element; tile_ = tile; if (image_ != atlas) { if (visibility_) removeInstance(); image_ = atlas; if (visibility_) addInstance(); } else if (visibility_) { uvFrame(image_, element_, tile_, instance_->uvFrame); } }
void InputOutputFactory::enumMidiInDevices(void) { int num = ::midiInGetNumDevs(); int index = 0; for(int i=0;i<num;++i) { MIDIINCAPS midiInCaps; memset(&midiInCaps,0,sizeof(MIDIINCAPS)); ::midiInGetDevCaps(i,&midiInCaps,sizeof(midiInCaps)); AbstractPhysicalElaborationUnitFactory::PhysicalEUDescription* pDesc = new AbstractPhysicalElaborationUnitFactory::PhysicalEUDescription(midiInCaps.szPname,NULL,0,MIDIIN_INDEX,index++); addInstance(pDesc); } }
void InputOutputFactory::enumPolyKeyboard(void) { //Look for all the serial port where the PolyKeyboard can be connected to wchar_t buffer[10]; int index = 0; //memset(buffer,0,sizeof(buffer)); for(int i=0;i<NUM_SERIALPORT_TEST;i++) { wsprintf(buffer,L"COM%d\0",i); HANDLE hSerial; hSerial = ::CreateFile(buffer,GENERIC_READ | GENERIC_WRITE,0,0,OPEN_EXISTING,FILE_ATTRIBUTE_NORMAL,0); if(hSerial!=INVALID_HANDLE_VALUE) { AbstractPhysicalElaborationUnitFactory::PhysicalEUDescription* pDesc = new AbstractPhysicalElaborationUnitFactory::PhysicalEUDescription(buffer,NULL,0,POLYKEYBOARD_INDEX,index++); addInstance(pDesc); ::CloseHandle(hSerial); } } }
int ClientExec::LoadCfg(string filename) { int ret; try { cfg.readFile(filename.c_str()); cout << "I read client exec configuration " << filename << endl; } catch (const FileIOException &fioex) { std::cerr << "I/O error while reading file." << std::endl; return -1; } catch (const ParseException &pex) { return -1; } try { cfg.lookupValue("DEPLOY_SERVER_IP",deploy_server_ip); } catch (const SettingNotFoundException &nfex) { cerr << "mandatory option DEPLOY_SERVER_IP is missing" << endl; return -1; } const Setting& root = cfg.getRoot(); try { const Setting &instance_map = root["experiment"]["instances"]; number_of_instances = instance_map.getLength(); cout << "Number of instances in the experiment file: " << number_of_instances << endl; for (int i = 0; i < number_of_instances; i++) { const Setting &instance = instance_map[i]; ret = addInstance(instance); if (ret < 0) { return -1; } } } catch (const SettingNotFoundException &nfex) { return -1; cerr << "SettingNotFoundException" << endl; } cout << EOF; }
//------------------------------------------------------------------------------ void InteriorLMManager::addInterior(LM_HANDLE & interiorHandle, U32 numLightmaps, Interior * interior) { interiorHandle = mInteriors.size(); mInteriors.increment(); mInteriors.last() = new InteriorLMInfo; mInteriors.last()->mInterior = interior; mInteriors.last()->mHandlePtr = &interiorHandle; mInteriors.last()->mNumLightmaps = numLightmaps; // create base instance addInstance(interiorHandle, mInteriors.last()->mBaseInstanceHandle, 0); AssertFatal(mInteriors.last()->mBaseInstanceHandle == LM_HANDLE(0), "InteriorLMManager::addInterior: invalid base instance handle"); // steal the lightmaps from the interior Vector<GFXTexHandle>& texHandles = getHandles(interiorHandle, 0); for(U32 i = 0; i < interior->mLightmaps.size(); i++) { AssertFatal(interior->mLightmaps[i], "InteriorLMManager::addInterior: interior missing lightmap"); texHandles[i].set(interior->mLightmaps[i], &GFXDefaultPersistentProfile, true, String("Interior Lightmap")); } interior->mLightmaps.clear(); }
void PathActionEditorTreeModel::setupModelData() { m_actions = new QStringList(); updateActions(); // root QList<QVariant> rootData; rootData << tr("Property") << tr("Value") << tr("Unit"); m_rootItem = new TreeItem(rootData); m_pathactionsTree = new TopTreeItem(tr("PathActions"), m_rootItem); m_rootItem->appendChild(m_pathactionsTree); m_waypointsTree = new TopTreeItem(tr("Waypoints"), m_rootItem); m_rootItem->appendChild(m_waypointsTree); connect(m_rootItem, SIGNAL(updateHighlight(TreeItem *)), this, SLOT(updateHighlight(TreeItem *))); connect(m_pathactionsTree, SIGNAL(updateHighlight(TreeItem *)), this, SLOT(updateHighlight(TreeItem *))); connect(m_waypointsTree, SIGNAL(updateHighlight(TreeItem *)), this, SLOT(updateHighlight(TreeItem *))); { QList<UAVObject *> list = m_objManager->getObjectInstances("PathAction"); foreach(UAVObject * obj, list) { addInstance(obj, m_pathactionsTree); } }
void collectLoopData(int64_t LoopHeaderBBPointer, int64_t tripCount, int64_t estimatedTripCount, int LoopClass){ addInstance(getOrInsertLoop(&loops, LoopHeaderBBPointer, LoopClass), tripCount, estimatedTripCount); }
int Heap::addInstanceINT(int value){ InstanceINT * inst = new InstanceINT(value, this); return addInstance(inst); }
int Heap::addInstanceDOUBLE(double value){ InstanceDOUBLE * inst = new InstanceDOUBLE(value, this); return addInstance(inst); }
int Heap::addInstanceSTRING(std::string value){ InstanceSTRING * inst = new InstanceSTRING(value); return addInstance(inst); }
/*Creates an empty scenenode and return the pointer to the user this empty scene node is used for irrlicht and the user to manage the instance Each instance can be manipulated individualy through thier own empty scenenode*/ ISceneNode* CInstancedMeshSceneNode::addInstance(scene::ISceneNode* node) { return addInstance(node->getPosition(), node->getRotation(), node->getScale(), node->getID()); }