GPUInvertFilter::~GPUInvertFilter() { ObjectCounter::get()->decRef(&typeid(*this)); }
namespace cppa { namespace detail { enum type_info_impl { std_tinf, cppa_tinf }; // some metaprogramming utility template<type_info_impl What, bool IsBuiltin, typename T> struct ta_util; template<bool IsBuiltin, typename T> struct ta_util<std_tinf, IsBuiltin, T> { static inline const std::type_info* get() { return &(typeid(T)); } }; template<> struct ta_util<std_tinf, true, anything> { static inline const std::type_info* get() { return nullptr; } }; template<typename T> struct ta_util<cppa_tinf, true, T> { static inline const uniform_type_info* get() { return uniform_typeid(typeid(T)); } }; template<> struct ta_util<cppa_tinf, true, anything> { static inline const uniform_type_info* get() { return nullptr; } }; template<typename T> struct ta_util<cppa_tinf, false, T> { static inline const uniform_type_info* get() { return nullptr; } }; // only built-in types are guaranteed to be available at static initialization // time, other types are announced at runtime // implements types_array template<bool BuiltinOnlyTypes, typename... T> struct types_array_impl { static constexpr bool builtin_only = true; inline bool is_pure() const { return true; } // all types are builtin, perform lookup on constuction const uniform_type_info* data[sizeof...(T)]; types_array_impl() : data{ta_util<cppa_tinf, true, T>::get()...} { } inline const uniform_type_info* operator[](size_t p) const { return data[p]; } typedef const uniform_type_info* const* const_iterator; inline const_iterator begin() const { return std::begin(data); } inline const_iterator end() const { return std::end(data); } }; template<typename... T> struct types_array_impl<false, T...> { static constexpr bool builtin_only = false; inline bool is_pure() const { return false; } // contains std::type_info for all non-builtin types const std::type_info* tinfo_data[sizeof...(T)]; // contains uniform_type_infos for builtin types and lazy initializes // non-builtin types at runtime mutable std::atomic<const uniform_type_info*> data[sizeof...(T)]; mutable std::atomic<const uniform_type_info* *> pairs; // pairs[sizeof...(T)]; types_array_impl() : tinfo_data{ta_util<std_tinf,util::is_builtin<T>::value,T>::get()...} { bool static_init[sizeof...(T)] = { !std::is_same<T,anything>::value && util::is_builtin<T>::value ... }; for (size_t i = 0; i < sizeof...(T); ++i) { if (static_init[i]) { data[i].store(uniform_typeid(*(tinfo_data[i])), std::memory_order_relaxed); } } } inline const uniform_type_info* operator[](size_t p) const { auto result = data[p].load(); if (result == nullptr) { auto tinfo = tinfo_data[p]; if (tinfo != nullptr) { result = uniform_typeid(*tinfo); data[p].store(result, std::memory_order_relaxed); } } return result; } typedef const uniform_type_info* const* const_iterator; inline const_iterator begin() const { auto result = pairs.load(); if (result == nullptr) { auto parr = new const uniform_type_info*[sizeof...(T)]; for (size_t i = 0; i < sizeof...(T); ++i) { parr[i] = (*this)[i]; } if (!pairs.compare_exchange_weak(result, parr, std::memory_order_relaxed)) { delete[] parr; } else { result = parr; } } return result; } inline const_iterator end() const { return begin() + sizeof...(T); } }; // a container for uniform_type_information singletons with optimization // for builtin types; can act as pattern template<typename... T> struct types_array : types_array_impl<util::tl_forall<util::type_list<T...>, util::is_builtin>::value, T...> { static constexpr size_t size = sizeof...(T); typedef util::type_list<T...> types; typedef typename util::tl_filter_not<types, is_anything>::type filtered_types; static constexpr size_t filtered_size = filtered_types::size; inline bool has_values() const { return false; } }; // utility for singleton-like access to a types_array template<typename... T> struct static_types_array { static types_array<T...> arr; }; template<typename... T> types_array<T...> static_types_array<T...>::arr; template<typename TypeList> struct static_types_array_from_type_list; template<typename... T> struct static_types_array_from_type_list<util::type_list<T...>> { typedef static_types_array<T...> type; }; // utility for singleton-like access to a type_info instance of a type_list template<typename... T> struct static_type_list { static const std::type_info* list; }; template<typename... T> const std::type_info* static_type_list<T...>::list = &typeid(util::type_list<T...>); } } // namespace cppa::detail
static inline const uniform_type_info* get() { return uniform_typeid(typeid(T)); }
explicit WRATHDefaultStrokeAttributePackerT(void): WRATHShapeAttributePacker<T>(typeid(WRATHDefaultStrokeAttributePackerT).name(), WRATHDefaultStrokeAttributePacker::attribute_names().begin(), WRATHDefaultStrokeAttributePacker::attribute_names().end()) {}
RequestBroker::ProcessResponse APIRequest::Process(RequestBroker & rb) { if(HTTPContext) { if(http_async_req_status(HTTPContext)) { char * data; int status, data_size; data = http_async_req_stop(HTTPContext, &status, &data_size); if (status == 200 && data) { void * resultObject = Parser->ProcessResponse((unsigned char *)data, data_size); if(resultObject) { this->ResultObject = resultObject; rb.requestComplete(this); free(data); return RequestBroker::Finished; } else { std::cout << typeid(*this).name() << " Request for " << URL << " could not be parsed: " << data << std::endl; free(data); return RequestBroker::Failed; } } else { //#ifdef DEBUG std::cout << typeid(*this).name() << " Request for " << URL << " failed with status " << status << std::endl; //#endif if(data) free(data); return RequestBroker::Failed; } } } else { std::cout << typeid(*this).name() << " New Request for " << URL << std::endl; if(Post) { char ** postNames = new char*[PostData.size() + 1]; char ** postData = new char*[PostData.size()]; int * postLength = new int[PostData.size()]; int i = 0; std::map<std::string, std::string>::iterator iter = PostData.begin(); while(iter != PostData.end()) { std::string name = iter->first; std::string data = iter->second; char * cName = new char[name.length() + 1]; char * cData = new char[data.length() + 1]; std::strcpy(cName, name.c_str()); std::strcpy(cData, data.c_str()); postNames[i] = cName; postData[i] = cData; postLength[i] = data.length(); i++; iter++; } postNames[i] = NULL; if(Client::Ref().GetAuthUser().ID) { std::cout << typeid(*this).name() << " Authenticated " << std::endl; User user = Client::Ref().GetAuthUser(); char userName[12]; char *userSession = new char[user.SessionID.length() + 1]; std::strcpy(userName, format::NumberToString<int>(user.ID).c_str()); std::strcpy(userSession, user.SessionID.c_str()); HTTPContext = http_multipart_post_async((char*)URL.c_str(), postNames, postData, postLength, userName, NULL, userSession); delete userSession; } else { HTTPContext = http_multipart_post_async((char*)URL.c_str(), postNames, postData, postLength, NULL, NULL, NULL); } } else { HTTPContext = http_async_req_start(NULL, (char *)URL.c_str(), NULL, 0, 0); } //RequestTime = time(NULL); } return RequestBroker::OK; }
bool Converter<float>::canConvert(const Any& a) { return (typeid(float) == a.type() || typeid(int) == a.type() || typeid(const char *) == a.type()); }
wxObject* wxVariantToObjectConverterwxObject ( wxxVariant &data ) { return data.wxTEMPLATED_MEMBER_CALL(Get , wxObject*) ; } wxObject* wxVariantOfPtrToObjectConverterwxObject ( wxxVariant &data ) { return &data.wxTEMPLATED_MEMBER_CALL(Get , wxObject) ; } wxxVariant wxObjectToVariantConverterwxObject ( wxObject *data ) { return wxxVariant( dynamic_cast<wxObject*> (data) ) ; } wxClassInfo wxObject::ms_classInfo(ms_classParents , wxEmptyString , wxT("wxObject"), (int) sizeof(wxObject), \ (wxObjectConstructorFn) 0 , NULL,NULL,0 , 0 , 0 , wxVariantOfPtrToObjectConverterwxObject , wxVariantToObjectConverterwxObject , wxObjectToVariantConverterwxObject); template<> void wxStringReadValue(const wxString & , wxObject * & ){ wxFAIL_MSG("unreachable"); } template<> void wxStringWriteValue(wxString & , wxObject* const & ){ wxFAIL_MSG("unreachable"); } template<> void wxStringReadValue(const wxString & , wxObject & ){ wxFAIL_MSG("unreachable"); } template<> void wxStringWriteValue(wxString & , wxObject const & ){ wxFAIL_MSG("unreachable"); } wxClassTypeInfo s_typeInfo(wxT_OBJECT_PTR , &wxObject::ms_classInfo , NULL , NULL , typeid(wxObject*).name() ) ; wxClassTypeInfo s_typeInfowxObject(wxT_OBJECT , &wxObject::ms_classInfo , NULL , NULL , typeid(wxObject).name() ) ; #else wxClassInfo wxObject::ms_classInfo( wxT("wxObject"), 0, 0, (int) sizeof(wxObject), (wxObjectConstructorFn) 0 ); #endif // restore optimizations #if defined __VISUALC__ && __VISUALC__ >= 1300 #pragma optimize("", on) #endif wxClassInfo* wxClassInfo::sm_first = NULL; wxHashTable* wxClassInfo::sm_classTable = NULL;
void mitk::ImageVtkMapper2D::SetDefaultProperties(mitk::DataNode* node, mitk::BaseRenderer* renderer, bool overwrite) { mitk::Image::Pointer image = dynamic_cast<mitk::Image*>(node->GetData()); // Properties common for both images and segmentations node->AddProperty( "depthOffset", mitk::FloatProperty::New( 0.0 ), renderer, overwrite ); node->AddProperty( "outline binary", mitk::BoolProperty::New( false ), renderer, overwrite ); node->AddProperty( "outline width", mitk::FloatProperty::New( 1.0 ), renderer, overwrite ); node->AddProperty( "outline binary shadow", mitk::BoolProperty::New( false ), renderer, overwrite ); node->AddProperty( "outline binary shadow color", ColorProperty::New(0.0,0.0,0.0), renderer, overwrite ); node->AddProperty( "outline shadow width", mitk::FloatProperty::New( 1.5 ), renderer, overwrite ); if(image->IsRotated()) node->AddProperty( "reslice interpolation", mitk::VtkResliceInterpolationProperty::New(VTK_RESLICE_CUBIC) ); else node->AddProperty( "reslice interpolation", mitk::VtkResliceInterpolationProperty::New() ); node->AddProperty( "texture interpolation", mitk::BoolProperty::New( mitk::DataNodeFactory::m_TextureInterpolationActive ) ); // set to user configurable default value (see global options) node->AddProperty( "in plane resample extent by geometry", mitk::BoolProperty::New( false ) ); node->AddProperty( "bounding box", mitk::BoolProperty::New( false ) ); std::string photometricInterpretation; // DICOM tag telling us how pixel values should be displayed if ( node->GetStringProperty( "dicom.pixel.PhotometricInterpretation", photometricInterpretation ) ) { // modality provided by DICOM or other reader if ( photometricInterpretation.find("MONOCHROME1") != std::string::npos ) // meaning: display MINIMUM pixels as WHITE { // generate LUT (white to black) mitk::LookupTable::Pointer mitkLut = mitk::LookupTable::New(); vtkLookupTable* bwLut = mitkLut->GetVtkLookupTable(); bwLut->SetTableRange (0, 1); bwLut->SetSaturationRange (0, 0); bwLut->SetHueRange (0, 0); bwLut->SetValueRange (1, 0); bwLut->SetAlphaRange (1, 1); bwLut->SetRampToLinear(); bwLut->Build(); mitk::LookupTableProperty::Pointer mitkLutProp = mitk::LookupTableProperty::New(); mitkLutProp->SetLookupTable(mitkLut); node->SetProperty( "LookupTable", mitkLutProp ); } else if ( photometricInterpretation.find("MONOCHROME2") != std::string::npos ) // meaning: display MINIMUM pixels as BLACK { // apply default LUT (black to white) node->SetProperty( "color", mitk::ColorProperty::New( 1,1,1 ), renderer ); } // PALETTE interpretation should be handled ok by RGB loading } bool isBinaryImage(false); if ( ! node->GetBoolProperty("binary", isBinaryImage) ) { // ok, property is not set, use heuristic to determine if this // is a binary image mitk::Image::Pointer centralSliceImage; ScalarType minValue = 0.0; ScalarType maxValue = 0.0; ScalarType min2ndValue = 0.0; ScalarType max2ndValue = 0.0; mitk::ImageSliceSelector::Pointer sliceSelector = mitk::ImageSliceSelector::New(); sliceSelector->SetInput(image); sliceSelector->SetSliceNr(image->GetDimension(2)/2); sliceSelector->SetTimeNr(image->GetDimension(3)/2); sliceSelector->SetChannelNr(image->GetDimension(4)/2); sliceSelector->Update(); centralSliceImage = sliceSelector->GetOutput(); if ( centralSliceImage.IsNotNull() && centralSliceImage->IsInitialized() ) { minValue = centralSliceImage->GetStatistics()->GetScalarValueMin(); maxValue = centralSliceImage->GetStatistics()->GetScalarValueMax(); min2ndValue = centralSliceImage->GetStatistics()->GetScalarValue2ndMin(); max2ndValue = centralSliceImage->GetStatistics()->GetScalarValue2ndMax(); } if ((maxValue == min2ndValue && minValue == max2ndValue) || minValue == maxValue) { // centralSlice is strange, lets look at all data minValue = image->GetStatistics()->GetScalarValueMin(); maxValue = image->GetStatistics()->GetScalarValueMaxNoRecompute(); min2ndValue = image->GetStatistics()->GetScalarValue2ndMinNoRecompute(); max2ndValue = image->GetStatistics()->GetScalarValue2ndMaxNoRecompute(); } isBinaryImage = ( maxValue == min2ndValue && minValue == max2ndValue ); } // some more properties specific for a binary... if (isBinaryImage) { node->AddProperty( "opacity", mitk::FloatProperty::New(0.3f), renderer, overwrite ); node->AddProperty( "color", ColorProperty::New(1.0,0.0,0.0), renderer, overwrite ); node->AddProperty( "binaryimage.selectedcolor", ColorProperty::New(1.0,0.0,0.0), renderer, overwrite ); node->AddProperty( "binaryimage.selectedannotationcolor", ColorProperty::New(1.0,0.0,0.0), renderer, overwrite ); node->AddProperty( "binaryimage.hoveringcolor", ColorProperty::New(1.0,0.0,0.0), renderer, overwrite ); node->AddProperty( "binaryimage.hoveringannotationcolor", ColorProperty::New(1.0,0.0,0.0), renderer, overwrite ); node->AddProperty( "binary", mitk::BoolProperty::New( true ), renderer, overwrite ); node->AddProperty("layer", mitk::IntProperty::New(10), renderer, overwrite); } else //...or image type object { node->AddProperty( "opacity", mitk::FloatProperty::New(1.0f), renderer, overwrite ); node->AddProperty( "color", ColorProperty::New(1.0,1.0,1.0), renderer, overwrite ); node->AddProperty( "binary", mitk::BoolProperty::New( false ), renderer, overwrite ); node->AddProperty("layer", mitk::IntProperty::New(0), renderer, overwrite); } if(image.IsNotNull() && image->IsInitialized()) { if((overwrite) || (node->GetProperty("levelwindow", renderer)==NULL)) { /* initialize level/window from DICOM tags */ std::string sLevel; std::string sWindow; if ( image->GetPropertyList()->GetStringProperty( "dicom.voilut.WindowCenter", sLevel ) && image->GetPropertyList()->GetStringProperty( "dicom.voilut.WindowWidth", sWindow ) ) { float level = atof( sLevel.c_str() ); float window = atof( sWindow.c_str() ); mitk::LevelWindow contrast; std::string sSmallestPixelValueInSeries; std::string sLargestPixelValueInSeries; if ( image->GetPropertyList()->GetStringProperty( "dicom.series.SmallestPixelValueInSeries", sSmallestPixelValueInSeries ) && image->GetPropertyList()->GetStringProperty( "dicom.series.LargestPixelValueInSeries", sLargestPixelValueInSeries ) ) { float smallestPixelValueInSeries = atof( sSmallestPixelValueInSeries.c_str() ); float largestPixelValueInSeries = atof( sLargestPixelValueInSeries.c_str() ); contrast.SetRangeMinMax( smallestPixelValueInSeries-1, largestPixelValueInSeries+1 ); // why not a little buffer? // might remedy some l/w widget challenges } else { contrast.SetAuto( static_cast<mitk::Image*>(node->GetData()), false, true ); // we need this as a fallback } contrast.SetLevelWindow( level, window, true ); node->SetProperty( "levelwindow", LevelWindowProperty::New( contrast ), renderer ); } } if(((overwrite) || (node->GetProperty("opaclevelwindow", renderer)==NULL)) && (image->GetPixelType().GetPixelTypeId() == itk::ImageIOBase::RGBA) && (image->GetPixelType().GetTypeId() == typeid( unsigned char)) ) { mitk::LevelWindow opaclevwin; opaclevwin.SetRangeMinMax(0,255); opaclevwin.SetWindowBounds(0,255); mitk::LevelWindowProperty::Pointer prop = mitk::LevelWindowProperty::New(opaclevwin); node->SetProperty( "opaclevelwindow", prop, renderer ); } } Superclass::SetDefaultProperties(node, renderer, overwrite); }
static size_type serialize_maps(std::ostream&, const map_type&, const inv_map_type&, structure_tree_node*, SDSL_UNUSED std::string name="") { throw std::logic_error(util::demangle(typeid(wt_trait<t_rac>).name())+": serialize not implemented"); return 0; }
void Repair::registerSelf() { boost::shared_ptr<Class> instance (new Repair); registerClass (typeid (ESM::Repair).name(), instance); }
void CommandeDivision::execute()throw(LogMessage){ savePileAvtExe(); Constante* c1; Constante* c2; try{ c1 = _pileCourante->depiler(); c2 = _pileCourante->depiler(); if(typeid(*c1)==typeid(Expression) && typeid(*c2)==typeid(Expression)){ throw LogMessage("addition(): impossible d'appliquer un operateur sur 2 expressions",1); } if (typeid(*c1)==typeid(Expression)){ Expression* oldExpr=dynamic_cast<Expression*>(c1); QString oldChaine=oldExpr->getExp(); QString newChaine; if(typeid(*c2)!=typeid(Complexe)){ Nombre* nb=dynamic_cast<Nombre*>(c2); newChaine = nb->toQString(); } else{ Complexe* nb=dynamic_cast<Complexe*>(c2); newChaine = nb->toQString(); } oldChaine.remove(oldChaine.length()-1,1); _pileCourante->empilerExpression(oldChaine.append(" "+newChaine+" "+'/'+'\'')); } else if (typeid(*c2)==typeid(Expression)){ Expression* oldExpr=dynamic_cast<Expression*>(c2); QString oldChaine=oldExpr->getExp(); QString newChaine; if(typeid(*c1)!=typeid(Complexe)){ Nombre* nb=dynamic_cast<Nombre*>(c1); newChaine = nb->toQString(); } else{ Complexe* nb=dynamic_cast<Complexe*>(c1); newChaine = nb->toQString(); } oldChaine.remove(oldChaine.length()-1,1); _pileCourante->empilerExpression(oldChaine.append(" "+newChaine+" "+'/'+'\'')); } else{ if(_utilisateur->useComplexe()){ Complexe *co1; Complexe *co2; if(typeid(*c1)==typeid(Complexe)) co1 =dynamic_cast<Complexe*>(c1); else if(typeid(*c1)==typeid(Entier)){ Entier* nb = dynamic_cast<Entier*>(c1); co1 = nb->toComplexe(); } else if(typeid(*c1)==typeid(Rationnel)){ Rationnel* nb = dynamic_cast<Rationnel*>(c1); co1 = nb->toComplexe(); } else if(typeid(*c1)==typeid(Reel)){ Reel* nb = dynamic_cast<Reel*>(c1); co1 = nb->toComplexe(); } if(typeid(*c2)==typeid(Complexe)) co2 = dynamic_cast<Complexe*>(c2); else if(typeid(*c2)==typeid(Entier)){ Entier* nb = dynamic_cast<Entier*>(c2); co2 = nb->toComplexe(); } else if(typeid(*c2)==typeid(Rationnel)){ Rationnel* nb = dynamic_cast<Rationnel*>(c2); co2 = nb->toComplexe(); } else if(typeid(*c2)==typeid(Reel)){ Reel* nb = dynamic_cast<Reel*>(c2); co2 = nb->toComplexe(); } if(_utilisateur->useEntier()){ co1->attrToEntier(); co2->attrToEntier(); } else if(_utilisateur->useRationnel()){ co1->attrToRationnel(); co2->attrToRationnel(); } else if(_utilisateur->useReel()){ co1->attrToReel(); co2->attrToReel(); } if(co1->getReel()==0 && co2->getImg()==0) throw LogMessage("division(): impossible de diviser par 0",1); else{ Complexe * res = *(co1)/co2; _pileCourante->empilerConstante(res); savePileApresExe(); } } else{ if(typeid(*c1)==typeid(Complexe) || typeid(*c2)==typeid(Complexe)) throw LogMessage("division(): impossible de convertir un complexe en un autre type de constante, cochez complexe",1); if(_utilisateur->useEntier()){ Entier *e1; Entier *e2; int choix=QMessageBox::Ok; if(typeid(*c1)!=typeid(Expression)&& typeid(*c2)!=typeid(Expression)){ if(typeid(*c1)==typeid(Reel) || typeid(*c1)==typeid(Rationnel) || typeid(*c2)==typeid(Reel) || typeid(*c2)==typeid(Rationnel)){ choix=continuer(); } if(choix==QMessageBox::Ok){ Nombre * n1 = dynamic_cast<Nombre*>(c1); e1 = n1->toEntier(); Nombre * n2 = dynamic_cast<Nombre*>(c2); e2 = n2->toEntier(); if (e2->getNb()==0) throw LogMessage("division(): impossible de diviser par 0",1); else{ Entier * res = *(e1)/e2; _pileCourante->empilerConstante(res); savePileApresExe(); } } else{ _pileCourante->empilerConstante(c2); _pileCourante->empilerConstante(c1); } } else{ _pileCourante->empilerConstante(c2); _pileCourante->empilerConstante(c1); throw LogMessage("division() : La constante doit être un nombre",1); } } else if(_utilisateur->useRationnel()){ Rationnel *ra1; Rationnel *ra2; int choix=QMessageBox::Ok; if(typeid(*c1)!=typeid(Expression) && typeid(*c2)!=typeid(Expression)){ if(typeid(*c1)==typeid(Reel) || typeid(*c2)==typeid(Reel)){ choix=continuer(); } if(choix==QMessageBox::Ok){ Nombre * n1 = dynamic_cast<Nombre*>(c1); Nombre * n2 = dynamic_cast<Nombre*>(c2); ra1 = n1->toRationnel(); ra2 = n2->toRationnel(); } else{ _pileCourante->empilerConstante(c2); _pileCourante->empilerConstante(c1); throw LogMessage("division() : La constante doit être un nombre",1); } if(ra2->getNum()==0) throw LogMessage("division(): impossible de diviser par 0",1); else{ Rationnel * res = *(ra1)/ra2; _pileCourante->empilerConstante(res); savePileApresExe(); } } } else if(_utilisateur->useReel()){ Reel *re1; Reel *re2; int choix=QMessageBox::Ok; if(typeid(*c1)!=typeid(Expression) && typeid(*c2)!=typeid(Expression)){ if(typeid(*c1)==typeid(Rationnel) || typeid(*c2)==typeid(Rationnel)){ choix=continuer(); } if(choix==QMessageBox::Ok){ Nombre * n1 = dynamic_cast<Nombre*>(c1); Nombre * n2 = dynamic_cast<Nombre*>(c2); re1 = n1->toReel(); re2 = n2->toReel(); } else{ _pileCourante->empilerConstante(c2); _pileCourante->empilerConstante(c1); throw LogMessage("division() : La constante doit être un nombre",1); } if(re2->getReel()==0) throw LogMessage("division(): impossible de diviser par 0",1); else{ Reel * res = *(re1)/re2; _pileCourante->empilerConstante(res); savePileApresExe(); } } } else{ _pileCourante->empilerConstante(c2); _pileCourante->empilerConstante(c1); throw LogMessage("Type utilisé non reconnu",1); } } } } catch(LogMessage msg){ //La pile ne contenait pas au moins 2 éléments if(c2!=0) _pileCourante->empilerConstante(c2); if(c1!=0) _pileCourante->empilerConstante(c1); throw; } }
/** * @brief Constructor from any type * * @param s object which type has to be demangled */ template<typename T> Demangler(T& s) : m_name(typeid(s).name()) { }
TEST_F(DecompositionTest, ReturnsDummySolver) { const Solver& result = decomposition.getSolver(); EXPECT_EQ(typeid(solver::dummy::Solver), typeid(result)) << "decomposition.getSolver() should return an object of type solver::dummy::Solver"; }
//---------------------------------------- wxTreeItemId CFieldsTreeCtrl::InsertField(const wxTreeItemId& parentId, CObjectTreeNode* node) { int32_t depth = node->GetLevel(); long numChildren = node->ChildCount(); CField *field = dynamic_cast<CField*>(node->GetData()); if (field == NULL) { wxMessageBox("ERROR in CFieldsTreeCtrl::InsertField - at least one of the tree object is not a CField object", "Error", wxOK | wxICON_ERROR); return parentId; } if ((typeid(*field) == typeid(CFieldIndex)) && field->IsVirtual()) { return parentId; } if ( depth <= 1 ) { wxString str; str.Printf(wxT("%s"), field->GetName().c_str()); // here we pass to AppendItem() normal and selected item images (we // suppose that selected image follows the normal one in the enum) int32_t image = TreeCtrlIcon_Folder; int32_t imageSel = image + 1; wxTreeItemId id = AddRoot(str, image, image, new CFieldsTreeItemData(field)); return id; } bool hasChildren = numChildren > 0; wxString str; if (field->GetUnit().empty()) { str.Printf(wxT("%s"), field->GetName().c_str()); } else { str.Printf(wxT("%s (%s)"), field->GetName().c_str(), field->GetUnit().c_str()); } /* // at depth 1 elements won't have any more children if ( hasChildren ) { str.Printf(wxT("%s"), field->GetName().c_str()); } else { str.Printf(wxT("%s child %d.%d"), wxT("File"), folder, n + 1); } */ // here we pass to AppendItem() normal and selected item images (we // suppose that selected image follows the normal one in the enum) int32_t image = (hasChildren) ? TreeCtrlIcon_Folder : TreeCtrlIcon_File; int32_t imageSel = image + 1; //wxTreeItemId id = AppendItem(idParent, str, image, imageSel, // new MyTreeItemData(str)); wxTreeItemId id = AppendItem(parentId, str, image, imageSel, new CFieldsTreeItemData(field)); //Expand(parentId); if ( (typeid(*field) == typeid(CFieldRecord)) || ( (typeid(*field) == typeid(CFieldArray)) && (field->IsFixedSize() == false) ) ) { SetItemBold(id, true); //SetItemFont(parentId, *wxSWISS_FONT); //SetItemFont(rootId, *wxITALIC_FONT); } // and now we also set the expanded one (only for the folders) if ( hasChildren ) { SetItemImage(id, TreeCtrlIcon_FolderOpened, wxTreeItemIcon_Expanded); } // remember the last child for OnEnsureVisible() if ( !hasChildren ) { m_lastItem = id; } wxTreeItemId returnId; if (hasChildren) { returnId = id; } else { returnId = parentId; CObjectTreeNode* parentNode = node->GetParent(); while (parentNode != NULL) { if (parentNode->m_current == parentNode->GetChildren().end()) { returnId = GetItemParent(returnId); parentNode = parentNode->GetParent(); } else { break; } } } return returnId; }
void setup_buffer(double pAlpha, double pBeta, const std::string& path) { sparseFile = path; alpha = static_cast<T>(pAlpha); beta = static_cast<T>(pBeta); // Read sparse data from file and construct a COO matrix from it clsparseIdx_t nnz, row, col; clsparseStatus fileError = clsparseHeaderfromFile(&nnz, &row, &col, sparseFile.c_str()); if (fileError != clsparseSuccess) throw clsparse::io_exception("Could not read matrix market header from disk"); // Now initialize a CSR matrix from the COO matrix clsparseInitCsrMatrix(&csrMtx); csrMtx.num_nonzeros = nnz; csrMtx.num_rows = row; csrMtx.num_cols = col; //clsparseCsrMetaSize(&csrMtx, control); cl_int status; csrMtx.values = ::clCreateBuffer(ctx, CL_MEM_READ_ONLY, csrMtx.num_nonzeros * sizeof(T), NULL, &status); CLSPARSE_V(status, "::clCreateBuffer csrMtx.values"); csrMtx.col_indices = ::clCreateBuffer(ctx, CL_MEM_READ_ONLY, csrMtx.num_nonzeros * sizeof(clsparseIdx_t), NULL, &status); CLSPARSE_V(status, "::clCreateBuffer csrMtx.col_indices"); csrMtx.row_pointer = ::clCreateBuffer(ctx, CL_MEM_READ_ONLY, (csrMtx.num_rows + 1) * sizeof(clsparseIdx_t), NULL, &status); CLSPARSE_V(status, "::clCreateBuffer csrMtx.row_pointer"); #if 0 csrMtx.rowBlocks = ::clCreateBuffer(ctx, CL_MEM_READ_ONLY, csrMtx.rowBlockSize * sizeof(cl_ulong), NULL, &status); CLSPARSE_V(status, "::clCreateBuffer csrMtx.rowBlocks"); #endif if (typeid(T) == typeid(float)) fileError = clsparseSCsrMatrixfromFile( &csrMtx, sparseFile.c_str(), control, explicit_zeroes ); else if (typeid(T) == typeid(double)) fileError = clsparseDCsrMatrixfromFile( &csrMtx, sparseFile.c_str(), control, explicit_zeroes ); else fileError = clsparseInvalidType; if (fileError != clsparseSuccess) throw clsparse::io_exception("Could not read matrix market data from disk"); // Initilize the output CSR Matrix clsparseInitCsrMatrix(&csrMtxC); // Initialize the scalar alpha & beta parameters clsparseInitScalar(&a); a.value = ::clCreateBuffer(ctx, CL_MEM_READ_ONLY, 1 * sizeof(T), NULL, &status); CLSPARSE_V(status, "::clCreateBuffer a.value"); clsparseInitScalar(&b); b.value = ::clCreateBuffer(ctx, CL_MEM_READ_ONLY, 1 * sizeof(T), NULL, &status); CLSPARSE_V(status, "::clCreateBuffer b.value"); //std::cout << "Flops = " << xSpMSpM_Getflopcount() << std::endl; flopCnt = xSpMSpM_Getflopcount(); }// end of function
static size_type load_maps(std::istream&, map_type&, inv_map_type&) { throw std::logic_error(util::demangle(typeid(wt_trait<t_rac>).name())+": load not implemented"); return 0; }
void RCircleEntity::init() { RCircleEntity::PropertyCustom.generateId(typeid(RCircleEntity), RObject::PropertyCustom); RCircleEntity::PropertyHandle.generateId(typeid(RCircleEntity), RObject::PropertyHandle); RCircleEntity::PropertyProtected.generateId(typeid(RCircleEntity), RObject::PropertyProtected); RCircleEntity::PropertyType.generateId(typeid(RCircleEntity), REntity::PropertyType); RCircleEntity::PropertyBlock.generateId(typeid(RCircleEntity), REntity::PropertyBlock); RCircleEntity::PropertyLayer.generateId(typeid(RCircleEntity), REntity::PropertyLayer); RCircleEntity::PropertyLinetype.generateId(typeid(RCircleEntity), REntity::PropertyLinetype); RCircleEntity::PropertyLinetypeScale.generateId(typeid(RCircleEntity), REntity::PropertyLinetypeScale); RCircleEntity::PropertyLineweight.generateId(typeid(RCircleEntity), REntity::PropertyLineweight); RCircleEntity::PropertyColor.generateId(typeid(RCircleEntity), REntity::PropertyColor); RCircleEntity::PropertyDisplayedColor.generateId(typeid(RCircleEntity), REntity::PropertyDisplayedColor); RCircleEntity::PropertyDrawOrder.generateId(typeid(RCircleEntity), REntity::PropertyDrawOrder); RCircleEntity::PropertyCenterX.generateId(typeid(RCircleEntity), QT_TRANSLATE_NOOP("REntity", "Center"), QT_TRANSLATE_NOOP("REntity", "X")); RCircleEntity::PropertyCenterY.generateId(typeid(RCircleEntity), QT_TRANSLATE_NOOP("REntity", "Center"), QT_TRANSLATE_NOOP("REntity", "Y")); RCircleEntity::PropertyCenterZ.generateId(typeid(RCircleEntity), QT_TRANSLATE_NOOP("REntity", "Center"), QT_TRANSLATE_NOOP("REntity", "Z")); RCircleEntity::PropertyRadius.generateId(typeid(RCircleEntity), "", QT_TRANSLATE_NOOP("REntity", "Radius")); RCircleEntity::PropertyDiameter.generateId(typeid(RCircleEntity), "", QT_TRANSLATE_NOOP("REntity", "Diameter")); RCircleEntity::PropertyCircumference.generateId(typeid(RCircleEntity), "", QT_TRANSLATE_NOOP("REntity", "Circumference")); RCircleEntity::PropertyArea.generateId(typeid(RCircleEntity), "", QT_TRANSLATE_NOOP("REntity", "Area")); }
bool ConnectionSet::_setupFDSet() { if( !_impl->dirty ) { #ifndef _WIN32 // TODO: verify that poll() really modifies _fdSet, and remove the copy // if it doesn't. The man page seems to hint that poll changes fds. _impl->fdSet = _impl->fdSetCopy; #endif return true; } _impl->dirty = false; _impl->fdSet.setSize( 0 ); _impl->fdSetResult.setSize( 0 ); #ifdef _WIN32 // add self connection HANDLE readHandle = _impl->selfConnection->getNotifier(); LBASSERT( readHandle ); _impl->fdSet.append( readHandle ); Result res; res.connection = _impl->selfConnection.get(); _impl->fdSetResult.append( res ); // add regular connections _impl->lock.set(); for( ConnectionsCIter i = _impl->connections.begin(); i != _impl->connections.end(); ++i ) { ConnectionPtr connection = *i; readHandle = connection->getNotifier(); if( !readHandle ) { LBINFO << "Cannot select connection " << connection << ", connection does not provide a read handle" << std::endl; _impl->connection = connection; _impl->lock.unset(); return false; } _impl->fdSet.append( readHandle ); Result result; result.connection = connection.get(); _impl->fdSetResult.append( result ); } for( ThreadsCIter i=_impl->threads.begin(); i != _impl->threads.end(); ++i ) { Thread* thread = *i; readHandle = thread->notifier; LBASSERT( readHandle ); _impl->fdSet.append( readHandle ); Result result; result.thread = thread; _impl->fdSetResult.append( result ); } _impl->lock.unset(); #else // _WIN32 pollfd fd; fd.events = POLLIN; // | POLLPRI; fd.revents = 0; // add self 'connection' fd.fd = _impl->selfConnection->getNotifier(); LBASSERT( fd.fd > 0 ); _impl->fdSet.append( fd ); Result result; result.connection = _impl->selfConnection.get(); _impl->fdSetResult.append( result ); // add regular connections _impl->lock.set(); for( ConnectionsCIter i = _impl->allConnections.begin(); i != _impl->allConnections.end(); ++i ) { ConnectionPtr connectionPtr = *i; const Connection& connection = *connectionPtr.get(); fd.fd = connection.getNotifier(); if( fd.fd <= 0 ) { LBINFO << "Cannot select connection " << connectionPtr << ", connection " << typeid( connection ).name() << " doesn't have a file descriptor" << std::endl; _impl->connection = connectionPtr; _impl->lock.unset(); return false; } LBVERB << "Listening on " << typeid( connection ).name() << " @" << &connection << std::endl; _impl->fdSet.append( fd ); result.connection = connectionPtr.get(); _impl->fdSetResult.append( result ); } _impl->lock.unset(); _impl->fdSetCopy = _impl->fdSet; #endif return true; }
virtual ~SpecificClass2() { std::cout << "Bye Bye... " << typeid(this).name() << std::endl; }
//----------------------------------------------------------------------- void TerrainLiquidObject::_prepareProjector(void) { if (mProjectorName.empty() || !mProjectorSize) return; Ogre::MaterialPtr material = Ogre::MaterialManager::getSingleton().getByName(mMaterialName); if (material.isNull()) return; bool hasProjector = false; { Ogre::Material::TechniqueIterator ti = material->getTechniqueIterator(); while (ti.hasMoreElements()) { Ogre::Technique* technique = ti.getNext(); Ogre::Technique::PassIterator pi = technique->getPassIterator(); while (pi.hasMoreElements()) { Ogre::Pass* pass = pi.getNext(); Ogre::Pass::TextureUnitStateIterator tusi = pass->getTextureUnitStateIterator(); while (tusi.hasMoreElements()) { Ogre::TextureUnitState* tus = tusi.getNext(); if (Ogre::StringUtil::startsWith(tus->getName(), "Fairy/Projector", false)) { hasProjector = true; } } } } } if (!hasProjector) return; ObjectPtr object = mSystem->getSceneInfo()->findObjectByName(mProjectorName); if (!object) return; Variant directionValue = object->getProperty("direction"); if (directionValue.empty() || directionValue.type() != typeid(Ogre::Vector3)) return; Ogre::Vector3 direction = VariantCast<Ogre::Vector3>(directionValue); direction.normalise(); Ogre::String name = material->getName() + Ogre::StringConverter::toString((Ogre::ulong)this); mProjectionCamera = mTerrainLiquid->getParentSceneNode()->getCreator()->createCamera(name); mProjectionCamera->setAutoAspectRatio(false); mProjectionCamera->setAspectRatio(1.0f); mProjectionCamera->setFixedYawAxis(false); mProjectionCamera->setProjectionType(Ogre::PT_ORTHOGRAPHIC); mProjectionCamera->setFOVy(Ogre::Degree(90)); mProjectionCamera->setDirection(-direction); mProjectionCamera->setNearClipDistance(mProjectorSize / 2); mProjectionCamera->setFarClipDistance(mProjectorSize + 5000.0f); mTerrainLiquid->setProjectionCamera(mProjectionCamera); mProjectionMaterial = material->clone(name); { Ogre::Material::TechniqueIterator ti = mProjectionMaterial->getTechniqueIterator(); while (ti.hasMoreElements()) { Ogre::Technique* technique = ti.getNext(); Ogre::Technique::PassIterator pi = technique->getPassIterator(); while (pi.hasMoreElements()) { Ogre::Pass* pass = pi.getNext(); Ogre::Pass::TextureUnitStateIterator tusi = pass->getTextureUnitStateIterator(); while (tusi.hasMoreElements()) { Ogre::TextureUnitState* tus = tusi.getNext(); if (Ogre::StringUtil::startsWith(tus->getName(), "Fairy/Projector", false)) { tus->setProjectiveTexturing(true, mProjectionCamera); } } } } } mProjectionMaterial->load(); }
void go(std::string const & fname) { try { seal::PluginManager::get()->initialise(); pool::DbReflex::setDictionaryAutoLoading( true ); // pool::DbReflex::allowAutoLoadingFor("DataFormatsEcalRecHit"); pool::URIParser p; p.parse(); pool::IFileCatalog lcat; pool::IFileCatalog * cat = &lcat; cat->setWriteCatalog(p.contactstring()); cat->connect(); cat->start(); boost::shared_ptr<pool::IDataSvc> svc(pool::DataSvcFactory::instance(cat)); svc->transaction().start(); std::string containerName = "Events(Prod)"; std::string url = std::string("PFN:") + fname; pool::Collection<Obj> collection(&(*svc), "ImplicitCollection", url, containerName, pool::ICollection::READ); PentiumTimer timer; timer.start(); { typename pool::Collection<Obj>::Iterator iter = collection.select(); int n=0; pool::Ref<Obj> aObj; while(iter.next()) { aObj = iter.ref(); n++; // aObj = itr; if (aObj.token()==0) std::cout << "found invalid object " // << CMSPool::sprint(aObj) // << " of type " << CMSPool::classname(aObj) << std::endl; else act(*aObj); } std::cout << "It contains " << n << " objects of type " << typeid(*aObj).name()<< std::endl; std::cout << "like " << aObj.toString() << std::endl; } timer.stop(); std::cout << "elapsed time " << timer.lap() << std::endl; svc->transaction().commit(); svc->session().disconnectAll(); std::cout << "cache size at end " << svc->cacheSvc().cacheSize() << std::endl; } catch (const std::exception & ce) { std::cout << ce.what() << std::endl; } }
const char* Exception::class_name(void) const throw() { return typeid(*this).name(); }
std::type_index exception_header_formatter::element_type_index() const { static auto r(std::type_index(typeid(yarn::exception))); return r; }
void Timer(int a) { /* some where along the line if I drop the line block on top of a square, if the right block is the one touching it will not recreate a part... */ if(!change) //checks to see if we are dealing with the same shape { x = generatePart(board); // if the shape has set, generate a new shape change = true; // set change to true to not generate a new shape until the one we just generated sets } //Drop variable to set to true so that we cannot move once we drop set //if this is not here it will not work for some reason x->DROP = true; //display board to console for testing print(board); x->draw(board); //draw shape to board print(board); boardDraw(); // draw shape to screen window if(typeid(*x) == typeid(Square)) //if we are dealing with a sqare block (C++ version of java instanceof) { //board[x->Y4+1][x->X4] == 0 && board[x->Y3+1][x->X3] == 0 if(x->moveDown(board)) //check if down move is available { glutDisplayFunc(draw); glutSpecialFunc(keys); glutTimerFunc(speed, Timer, 0); glutPostRedisplay(); } //if(board[x->Y4+1][x->X4] != 0 || board[x->Y3+1][x->X3] != 0) else if(!x->moveDown(board))// if the cube reached the bottom { change = false; glutDisplayFunc(draw); glutTimerFunc(1, Timer, 0); glutPostRedisplay(); } } else if(typeid(*x) == typeid(Line)) //if we are dealing with a line block { //this will only work for a line right now and square //&& board[x->Y4+1][x->X4] == 0 && board[x->Y3+1][x->X3] == 0 if(x->moveDown(board)) { glutTimerFunc(speed, Timer, 0); glutDisplayFunc(draw); glutSpecialFunc(keys); glutPostRedisplay(); } // generate and draw soon after else if(!x->moveDown(board)) { change = false; glutTimerFunc(1, Timer, 0); glutDisplayFunc(draw); glutPostRedisplay(); } } }
std::string Node::nodeName() { int status; char * demangled = abi::__cxa_demangle(typeid(*this).name(),0,0,&status); return std::string(demangled); }
const char* CAViewController::getNibName() { return typeid(*this).name(); }
static inline const std::type_info* get() { return &(typeid(T)); }
ManualService::ManualService() : work_queue(new WorkQueue(typeid(*this))) { }
QgsRasterFileWriter::WriterError QgsRasterFileWriter::writeRaster( const QgsRasterPipe* pipe, int nCols, int nRows, QgsRectangle outputExtent, const QgsCoordinateReferenceSystem& crs, QProgressDialog* progressDialog ) { QgsDebugMsgLevel( "Entered", 4 ); if ( !pipe ) { return SourceProviderError; } mPipe = pipe; //const QgsRasterInterface* iface = iter->input(); const QgsRasterInterface* iface = pipe->last(); if ( !iface ) { return SourceProviderError; } mInput = iface; if ( QgsRasterBlock::typeIsColor( iface->dataType( 1 ) ) ) { mMode = Image; } else { mMode = Raw; } QgsDebugMsgLevel( QString( "reading from %1" ).arg( typeid( *iface ).name() ), 4 ); if ( !iface->srcInput() ) { QgsDebugMsg( "iface->srcInput() == 0" ); return SourceProviderError; } #ifdef QGISDEBUG const QgsRasterInterface &srcInput = *iface->srcInput(); QgsDebugMsgLevel( QString( "srcInput = %1" ).arg( typeid( srcInput ).name() ), 4 ); #endif mProgressDialog = progressDialog; QgsRasterIterator iter( pipe->last() ); //create directory for output files if ( mTiledMode ) { QFileInfo fileInfo( mOutputUrl ); if ( !fileInfo.exists() ) { QDir dir = fileInfo.dir(); if ( !dir.mkdir( fileInfo.fileName() ) ) { QgsDebugMsg( "Cannot create output VRT directory " + fileInfo.fileName() + " in " + dir.absolutePath() ); return CreateDatasourceError; } } } if ( mMode == Image ) { WriterError e = writeImageRaster( &iter, nCols, nRows, outputExtent, crs, progressDialog ); mProgressDialog = nullptr; return e; } else { mProgressDialog = nullptr; WriterError e = writeDataRaster( pipe, &iter, nCols, nRows, outputExtent, crs, progressDialog ); return e; } }
std::string Sacado::ParameterFamilyBase<EntryBase,EntryType>:: getTypeName() const { return typeid(EvalType).name(); }