Expression ESolver::CreateExpression(const string& OperatorName, const Expression& Exp1, const Expression& Exp2, const Expression& Exp3) { // special case for bv extract if (OperatorName == "bvextract") { if (Exp2->As<UserConstExpression>() == nullptr || Exp3->As<UserConstExpression>() == nullptr) { throw TypeException((string)"bvextract can only be applied to constant indices"); } if (Exp2->GetType() != IntType || Exp3->GetType() != IntType) { throw TypeException((string)"bvextract can only be applied to constant integer indices"); } auto OpName = BVLogic::GetExtractOpName(Exp1->GetType(), Exp2->GetOp()->As<ConstOperator>()->GetConstantValue()->GetValue(), Exp3->GetOp()->As<ConstOperator>()->GetConstantValue()->GetValue()); // recurse with new name auto Op = LookupOperator(OpName); if (Op == nullptr) { LoadedBVLogic->InstantiateExtractOperator(Exp1->GetType(), Exp2->GetOp()->As<ConstOperator>()->GetConstantValue()->GetValue(), Exp3->GetOp()->As<ConstOperator>()->GetConstantValue()->GetValue()); Op = LookupOperator(OpName); } vector<Expression> Children = { Exp1 }; return CreateExpression(Op, Children); } vector<Expression> Children(3); Children[0] = Exp1; Children[1] = Exp2; Children[2] = Exp3; return CreateExpression(OperatorName, Children); }
vector<Book*> BookList::Children ( Book* book ) { vector<Book*> ret; if ( book->IsDir() ) { vector<Book*> children = book->getChildren(); for ( vector<Book*>::iterator it=children.begin() ; it < children.end(); ++it ) { if ( (*it)->IsDir() ) { vector<Book*> ch = Children( *it ); ret.insert( ret.end(), ch.begin(), ch.end() ); } else { ret.push_back(*it); } } } return ret; }
void CUsbDkHubFilterStrategy::RegisterNewChild(PDEVICE_OBJECT PDO) { CWdmUsbDeviceAccess pdoAccess(PDO); auto Port = pdoAccess.GetAddress(); if (Port == CWdmDeviceAccess::NO_ADDRESS) { TraceEvents(TRACE_LEVEL_ERROR, TRACE_FILTERDEVICE, "%!FUNC! Cannot read device port number"); return; } auto Speed = UsbDkWdmUsbDeviceGetSpeed(PDO, m_Owner->GetDriverObject()); if (Speed == NoSpeed) { TraceEvents(TRACE_LEVEL_ERROR, TRACE_FILTERDEVICE, "%!FUNC! Cannot query device speed"); return; } USB_DEVICE_DESCRIPTOR DevDescriptor; auto status = pdoAccess.GetDeviceDescriptor(DevDescriptor); if (!NT_SUCCESS(status)) { TraceEvents(TRACE_LEVEL_ERROR, TRACE_FILTERDEVICE, "%!FUNC! Cannot query device descriptor"); return; } CObjHolder<CRegText> DevID; CObjHolder<CRegText> InstanceID; if (!UsbDkGetWdmDeviceIdentity(PDO, &DevID, &InstanceID)) { TraceEvents(TRACE_LEVEL_ERROR, TRACE_FILTERDEVICE, "%!FUNC! Cannot query device identity"); return; } TraceEvents(TRACE_LEVEL_INFORMATION, TRACE_FILTERDEVICE, "%!FUNC! Registering new child (PDO: %p):", PDO); DevID->Dump(); InstanceID->Dump(); CUsbDkChildDevice::TDescriptorsCache CfgDescriptors(DevDescriptor.bNumConfigurations); if (!CfgDescriptors.Create()) { TraceEvents(TRACE_LEVEL_ERROR, TRACE_FILTERDEVICE, "%!FUNC! Cannot create descriptors cache"); return; } if (!FetchConfigurationDescriptors(pdoAccess, CfgDescriptors)) { TraceEvents(TRACE_LEVEL_ERROR, TRACE_FILTERDEVICE, "%!FUNC! Cannot fetch configuration descriptors"); return; } CUsbDkChildDevice *Device = new CUsbDkChildDevice(DevID, InstanceID, Port, Speed, DevDescriptor, CfgDescriptors, *m_Owner, PDO); if (Device == nullptr) { TraceEvents(TRACE_LEVEL_ERROR, TRACE_FILTERDEVICE, "%!FUNC! Cannot allocate child device instance"); return; } DevID.detach(); InstanceID.detach(); Children().PushBack(Device); ApplyRedirectionPolicy(*Device); }
Expr *Expr::FoldConstants(void) { Expr *n = AllocExpr(); *n = *this; int c = Children(); if(c >= 1) n->a = a->FoldConstants(); if(c >= 2) n->b = b->FoldConstants(); switch(op) { case PARAM_PTR: case PARAM: case CONSTANT: break; case MINUS: case TIMES: case DIV: case PLUS: // If both ops are known, then we can evaluate immediately if(n->a->op == CONSTANT && n->b->op == CONSTANT) { double nv = n->Eval(); n->op = CONSTANT; n->v = nv; break; } // x + 0 = 0 + x = x if(op == PLUS && n->b->op == CONSTANT && Tol(n->b->v, 0)) { *n = *(n->a); break; } if(op == PLUS && n->a->op == CONSTANT && Tol(n->a->v, 0)) { *n = *(n->b); break; } // 1*x = x*1 = x if(op == TIMES && n->b->op == CONSTANT && Tol(n->b->v, 1)) { *n = *(n->a); break; } if(op == TIMES && n->a->op == CONSTANT && Tol(n->a->v, 1)) { *n = *(n->b); break; } // 0*x = x*0 = 0 if(op == TIMES && n->b->op == CONSTANT && Tol(n->b->v, 0)) { n->op = CONSTANT; n->v = 0; break; } if(op == TIMES && n->a->op == CONSTANT && Tol(n->a->v, 0)) { n->op = CONSTANT; n->v = 0; break; } break; case SQRT: case SQUARE: case NEGATE: case SIN: case COS: case ASIN: case ACOS: if(n->a->op == CONSTANT) { double nv = n->Eval(); n->op = CONSTANT; n->v = nv; } break; default: oops(); } return n; }
// private void InitializeUX() [instance] :10 void Nakamura::InitializeUX() { ::g::Fuse::Controls::Image* temp = ::g::Fuse::Controls::Image::New2(); temp->File(::g::Uno::UX::BundleFileSource::New1(::g::MyFirstProject_bundle::nakamurae464ba9f())); ::g::Uno::Collections::ICollection::Add_ex(uInterface(uPtr(Children()), ::g::Uno::Collections::ICollection_typeof()->MakeType(::TYPES[4/*Fuse.Node*/])), temp); }
Children children() const { return Children(); }
void GalaxySetupPanel::Disable(bool b/* = true*/) { for (std::list<GG::Wnd*>::const_iterator it = Children().begin(); it != Children().end(); ++it) static_cast<GG::Control*>(*it)->Disable(b); }
/*********************** * elix::path::Children @ std::string path @ std::string subpath @ std::vector<std::string> & list @ bool deep @ bool storepath @ bool storedirectories - return true if it's a directory exist */ bool Children( std::string path, std::string sub_path, std::vector<std::string> & list, bool deep, bool storepath, bool storedirectories ) { dirent * entry = NULL; std::string dir_path = path + ELIX_DIR_SSEPARATOR + sub_path; std::string file_path = path; DIR * dir = opendir( dir_path.c_str() ); if ( !dir ) { return false; } while ( (entry = readdir(dir)) != NULL ) { if ( (strcmp(entry->d_name, ".") != 0) && (strcmp(entry->d_name, "..") != 0) ) { file_path = dir_path + ELIX_DIR_SSEPARATOR + entry->d_name; if ( elix::path::Exist( file_path ) ) { if ( deep ) { std::string dir_store(entry->d_name); Children( path, dir_store, list, false, storepath, storedirectories ); } if ( storedirectories ) { std::string name_store; if ( storepath ) { name_store = file_path + ELIX_DIR_SSEPARATOR; } else if ( sub_path.length() ) { name_store = sub_path + ELIX_DIR_SSEPARATOR + entry->d_name + ELIX_DIR_SSEPARATOR; } else { name_store = entry->d_name; name_store.append(ELIX_DIR_SSEPARATOR); } list.push_back( name_store ); } } else { std::string name_store; if ( storepath ) { name_store = file_path; } else if ( sub_path.length() ) { name_store = sub_path + ELIX_DIR_SSEPARATOR + entry->d_name; } else { name_store = entry->d_name; } list.push_back( name_store ); } } } closedir(dir); return true; }