static PyObject *UnaryPredicate1D___call__(BPy_UnaryPredicate1D *self, PyObject *args, PyObject *kwds) { static const char *kwlist[] = {"inter", NULL}; PyObject *py_if1D; if (!PyArg_ParseTupleAndKeywords(args, kwds, "O!", (char **)kwlist, &Interface1D_Type, &py_if1D)) return NULL; Interface1D *if1D = ((BPy_Interface1D *)py_if1D)->if1D; if (!if1D) { string class_name(Py_TYPE(self)->tp_name); PyErr_SetString(PyExc_RuntimeError, (class_name + " has no Interface1D").c_str()); return NULL; } if (typeid(*(self->up1D)) == typeid(UnaryPredicate1D)) { PyErr_SetString(PyExc_TypeError, "__call__ method not properly overridden"); return NULL; } if (self->up1D->operator()(*if1D) < 0) { if (!PyErr_Occurred()) { string class_name(Py_TYPE(self)->tp_name); PyErr_SetString(PyExc_RuntimeError, (class_name + " __call__ method failed").c_str()); } return NULL; } return PyBool_from_bool(self->up1D->result); }
void Halftone_TX::activate_layer_textures() { GLSLShader_Layer_Base::activate_layer_textures(); for (vector<layer_base_t*>::size_type i=0; i<_layers.size(); i++) { //main tone correction map halftone_layer_t* layer = get_layer(i); if (layer->_use_tone_correction) { if (!activate_texture( tone_correction_maps[layer->_tone_correction_tex_stage]) ) cerr << class_name() << ": can't activate tone correction texture at stage: " << layer->_tone_correction_tex_stage << endl; } // forward R function if (layer->_use_lod_only) { if (!activate_texture(r_function_maps[layer->_r_function_tex_stage])) cerr << class_name() << ": can't activate R function texture at stage: " << layer->_r_function_tex_loc << endl; } } }
fsm_env::fsm_env(xcs_config_mgr2& xcs_config) { if (!fsm_env::init) { if (!xcs_config.exist(tag_name())) { xcs_utility::error(class_name(), "constructor", "section <" + tag_name() + "> not found", 1); } try { state_bits = (long) xcs_config.Value(tag_name(), "number of bits"); states_number = (long) xcs_config.Value(tag_name(), "number of states"); } catch (const char *attribute) { string msg = "attribute \'" + string(attribute) + "\' not found in <" + tag_name() + ">"; xcs_utility::error(class_name(), "constructor", msg, 1); } //! look for the init section in the configuration file string input_configuration; if ((states_number%2) == 0) xcs_utility::error(class_name(),"class constructor", "Number of states must be even", 1); current_state = 0; final_state = (states_number-1)/2; set_state(); } fsm_env::init = true; }
static void gf_stat( obj gf ) { int i; obj p, k; fprintf( foo, "%s status: ", symbol_text( gvec_ref( gf, SLOT(3) ) ) ); for (i=0; i<4; i++) { k = gvec_ref( gf, SLOT(i*2) + GF_CACHE_0_K ); if (truish(k)) fprintf( foo, " %s", symbol_text(class_name(k)) ); else fprintf( foo, " #f" ); } fprintf( foo, " |" ); k = gvec_ref( gf, GF_VICTIM_K ); if (truish(k)) fprintf( foo, " %s", symbol_text(class_name(k)) ); else fprintf( foo, " #f" ); fprintf( foo, " |" ); for (p=gvec_ref(gf,GF_CACHE_OVERFLOW);truish(p);p=gvec_ref(p,0)) { k = gvec_ref(p,SLOT(1)); fprintf( foo, " %s", symbol_text(class_name(k)) ); } fprintf( foo, "\n" ); }
fbstring exception_wrapper::what() const { if (item_) { return exceptionStr(*item_); } else if (eptr_ && eobj_) { return class_name() + ": " + eobj_->what(); } else if (eptr_ && etype_) { return class_name(); } else { return class_name(); } }
/*! Constructor \param name name used for error reporting */ atomic_base( const std::string& name) : index_( class_object().size() ) , sparsity_( set_sparsity_enum ) { CPPAD_ASSERT_KNOWN( ! thread_alloc::in_parallel() , "atomic_base: constructor cannot be called in parallel mode." ); class_object().push_back(this); class_name().push_back(name); CPPAD_ASSERT_UNKNOWN( class_object().size() == class_name().size() ); }
jboolean ClassMatchModifier::class_match(DebuggerEvent *d_event) { UsingFastOops fast_oops; JavaClass::Fast clazz = JavaDebugger::get_object_by_id(d_event->clazz_id()); TypeSymbol::Fast class_name = clazz().name(); Symbol::Fast mod_name = class_match_name(); if (mod_name.is_null() || class_name.is_null()) return true; if (clazz().is_obj_array_class()) { juint klass_index = class_name().decode_ushort_at(0); JavaClass::Raw klass = Universe::class_from_id(klass_index); ObjArrayClass::Raw oac = klass.obj(); klass = oac().element_class(); class_name = klass().name(); } else if (clazz().is_type_array_class()) { // just a basic type array, no match here. return false; } // class names in the VM are not necessarily stored with the current OS // file separator character, Win32 can use either type of slash if (mod_name().byte_at(0) == '*' || mod_name().byte_at(mod_name().length()-1) == '*') { // We have a wildcard match. int complen = mod_name().length() - 1; int req_start = class_name().length() - complen; int mod_start = 0; if (req_start < 0) { return false; } else { if (mod_name().byte_at(0) == '*') { // suffix match // just compare the end of classname mod_start = 1; // point to just past the '*' } else { req_start = 0; // prefix match } return (jvm_memcmp(mod_name().utf8_data() + mod_start, class_name().utf8_data() + req_start, complen) == 0); } } else { // not a suffix/prefix match so just compare the two. return mod_name().matches(&class_name()); } }
static PyObject *UnaryFunction1DVectorViewShape___call__(BPy_UnaryFunction1DVectorViewShape *self, PyObject *args, PyObject *kwds) { static const char *kwlist[] = {"inter", NULL}; PyObject *obj = 0; if (!PyArg_ParseTupleAndKeywords(args, kwds, "O!", (char **)kwlist, &Interface1D_Type, &obj)) return NULL; if (typeid(*(self->uf1D_vectorviewshape)) == typeid(UnaryFunction1D<std::vector<ViewShape *>>)) { PyErr_SetString(PyExc_TypeError, "__call__ method not properly overridden"); return NULL; } if (self->uf1D_vectorviewshape->operator()(*(((BPy_Interface1D *)obj)->if1D)) < 0) { if (!PyErr_Occurred()) { string class_name(Py_TYPE(self)->tp_name); PyErr_SetString(PyExc_RuntimeError, (class_name + " __call__ method failed").c_str()); } return NULL; } const unsigned int list_len = self->uf1D_vectorviewshape->result.size(); PyObject *list = PyList_New(list_len); for (unsigned int i = 0; i < list_len; i++) { ViewShape *v = self->uf1D_vectorviewshape->result[i]; PyList_SET_ITEM(list, i, v ? BPy_ViewShape_from_ViewShape(*v) : (Py_INCREF(Py_None), Py_None)); } return list; }
void shade::shaders::VertexToFragmentCopy<T>::init_vertex_inline(formatter::Generator& generator) const { std::string class_name(VertexToFragmentCopy::get_class_name()); generator.handle_statement_begin(); generator.handle_function_call_begin(); generator.handle_function_call_name_begin(); generator.handle_identifier(class_name+"_set_copy"); generator.handle_function_call_name_end(); generator.handle_function_call_parameter_list_begin(); generator.handle_function_call_parameter_begin(); generator.handle_identifier("self"); generator.handle_function_call_parameter_end(); generator.handle_function_call_parameter_begin(); { generator.handle_function_call_begin(); generator.handle_function_call_name_begin(); generator.handle_identifier("Gettable_"+T<Type>().get_uniq_id()+"_get"); generator.handle_function_call_name_end(); generator.handle_function_call_parameter_list_begin(); generator.handle_function_call_parameter_begin(); generator.handle_identifier("value"); generator.handle_function_call_parameter_end(); generator.handle_function_call_parameter_list_end(); generator.handle_function_call_end(); } generator.handle_function_call_parameter_end(); generator.handle_function_call_parameter_list_end(); generator.handle_function_call_end(); generator.handle_statement_end(); }
void PlotCellTree( TString fin = "weights/TMVAClassification_PDEFoam.weights_foams.root", TString cv_long, bool useTMVAStyle=kTRUE ) { // Draw the PDEFoam cell tree cout << "read file: " << fin << endl; TFile *file = TFile::Open(fin); if (useTMVAStyle) TMVAGlob::SetTMVAStyle(); // find foams TListIter foamIter(gDirectory->GetListOfKeys()); TKey *foam_key = NULL; // the foam key TCanvas *canv = NULL; // the canvas while (foam_key = (TKey*) foamIter()) { TString name(foam_key->GetName()); TString class_name(foam_key->GetClassName()); if (!class_name.Contains("PDEFoam")) continue; cout << "PDEFoam found: " << class_name << " " << name << endl; // read the foam TMVA::PDEFoam *foam = (TMVA::PDEFoam*) foam_key->ReadObj(); canv = new TCanvas(Form("canvas_%s",name.Data()), Form("%s of %s",cv_long.Data(),name.Data()), 640, 480); // get cell tree depth const UInt_t depth = foam->GetRootCell()->GetTreeDepth(); const Double_t ystep = 1.0 / depth; DrawCell(foam->GetRootCell(), foam, 0.5, 1.-0.5*ystep, 0.25, ystep); } file->Close(); }
char const * Standard_Low_Level_Exception::plain_what() const { m_buffer=class_name(); m_buffer+=": "; m_buffer+=m_plain_what; return m_buffer.c_str(); }
void PluginChoooserWidget::loadImpl() { clear(); Config group = Config().group("plugins/list"); QStandardItem *parent_item = m_model->invisibleRootItem(); QList<QWeakPointer<Plugin> > plugins = pluginsList(); QStringList helper; for (int i = 0; i < plugins.size(); i++) { const PluginInfo &info = plugins.at(i).data()->info(); QLatin1String class_name(plugins.at(i).data()->metaObject()->className()); if (!m_plugin_items.contains(info.name())) { QIcon icon = info.icon(); if (icon.isNull() || !icon.availableSizes().count()) icon = Icon("applications-system"); QString name = info.name(); int index = qLowerBound(helper, name) - helper.constBegin(); helper.insert(index, name); ServiceItem *item = new ServiceItem(icon, name); item->setToolTip(html(info)); item->setCheckable(true); item->setData(true,ServiceItem::ExclusiveRole); item->setData(info.description().toString(), DescriptionRole); item->setCheckState((group.value(class_name, true) ? Qt::Checked : Qt::Unchecked)); parent_item->insertRow(index, item); m_plugin_items.insert(class_name, item); m_plugins.insert(class_name, plugins.at(i).data()); } } }
CubitString CubitCoordinateSystem::entity_name() const { CubitString name = class_name(); name += " "; name += CubitString( this->id() ); return name; }
int main(int arg_count, char *args[]) { generator gen; int first_non_flag_index = process_options(gen, arg_count, args); int num_non_flag_args = arg_count - first_non_flag_index; if(num_non_flag_args != 1 && num_non_flag_args != 2) { std::cerr << "Usage: cppclassgen --<flags> <class_name> <module_name(optional)>" << std::endl; std::exit(-1); } std::string class_name(args[first_non_flag_index]); gen.m_tokens.push_back(std::make_pair("%CLASS_NAME%", class_name)); auto class_name_upper = toupper(class_name); gen.m_tokens.push_back(std::make_pair("%CLASS_NAME_UPPER%", class_name_upper)); if(num_non_flag_args == 2) { std::string module_name(args[first_non_flag_index + 1]); gen.m_tokens.push_back(std::make_pair("%MODULE_NAME%", module_name)); toupper(module_name); auto module_name_upper = toupper(module_name); gen.m_tokens.push_back(std::make_pair("%MODULE_NAME_UPPER%", module_name_upper)); } read_tokens_from_config_file(gen); create_new_file_from_template(gen, class_name, ".h"); create_new_file_from_template(gen, class_name, ".cpp"); return 0; }
//fix: We can't we just tell the head to print? Are nodes not connected //between chains? If not, why not? void ArpIndexedList::Print() { //printf("Printing ArpIndexedList..\n"); if (chain == 0) { printf("ArpIndexedList::Print() chain was NULL\n"); return; } for(long i=0; i<count; i++) { printf("Chain %d", (int)i); if (chain[i] == NULL) { printf("\tNULL\n"); } else { printf("\n"); chain[i]->PrintListUntil(NextChainHeadFrom(i+1)); } } if (tailNode == 0) { printf("No tail node\n"); } else { const char *cn = class_name(tailNode); if (cn == 0) { printf("Tail node class: No class name\n"); } else { printf("Tail node class: %s\n", cn); } fflush(stdout); tailNode->PrintContents(); } }
status_t TRotationEffect::TRotationState::Archive(BMessage* data, bool deep) const { status_t err; err = data->AddString("class", class_name(this)); if (err == B_OK) err = data->AddFloat(kRotationLabel, m_rotation); return err; }
void engine::fill_class_data ( cs::lua_debugger::backend& backend, cs::lua_debugger::value_to_expand& value_to_expand, lua_State* const state ) { luabind::detail::object_rep *object = static_cast<luabind::detail::object_rep*>(lua_touserdata(state,-2)); luabind::detail::class_rep *_class = static_cast<luabind::detail::class_rep*>(lua_touserdata(state,-1)); R_ASSERT2 (_class, "invalid class userdata"); { string4096 type; typedef luabind::detail::class_rep::base_info base_info; vector_class<base_info>::const_iterator i = _class->bases().begin(); vector_class<base_info>::const_iterator e = _class->bases().end(); for ( ; i != e; ++i) value_to_expand.add_value ( (*i).base->name(), class_name(type, sizeof(type), *(*i).base), "{...}", cs::lua_debugger::icon_type_class_base ); } if (!object) return; typedef luabind::detail::class_rep::property_map property_map; property_map::const_iterator i = _class->properties().begin(); property_map::const_iterator e = _class->properties().end(); for ( ; i != e; ++i) { lua_pushstring (state,(*i).first); lua_insert (state,1); lua_pushlightuserdata (state,object); lua_insert (state,1); (*i).second.func (state, (*i).second.pointer_offset); bool use_in_description; string4096 type; backend.type_to_string (type, sizeof(type), state, -1, use_in_description); cs::lua_debugger::icon_type icon_type; string4096 value; backend.value_to_string (value, sizeof(value), state, -1, icon_type, true); lua_pop_value (state,1); lua_remove (state,1); lua_remove (state,1); value_to_expand.add_value ( (*i).first, type, value, icon_type ); } }
bool engine::type_convert_instance (char *buffer, unsigned int const size, lua_State *state, int index) { if (!is_luabind_class(state, index)) return (false); class_name (buffer, size, *static_cast<luabind::detail::class_rep*>(lua_touserdata(state, index))); return (true); }
inline void register_value_type(TPythonClass &pyClass){ typedef details::pair_exposer_t< TValueType, TValueCallPolicies > exposer_type; object class_name(pyClass.attr("__name__")); extract<std::string> class_name_extractor(class_name); std::string pair_name = class_name_extractor() + "_entry"; exposer_type expose( pair_name ); }
void engine::expand_class_instance ( cs::lua_debugger::backend& backend, cs::lua_debugger::value_to_expand& value_to_expand, lua_State* const state ) { typedef luabind::detail::object_rep object_rep; object_rep *object = luabind::detail::is_class_object(state,-1); VERIFY2 (object, "invalid object userdata"); if (object->crep()) { luabind::detail::class_rep *class_rep = object->crep(); string4096 type; class_name (type, sizeof(type), *class_rep); cs::lua_debugger::icon_type icon_type; string4096 value; backend.value_to_string (value, sizeof(value), state, -1, icon_type, true); value_to_expand.add_value ( class_rep->name(), type, value, cs::lua_debugger::icon_type_class ); } typedef luabind::detail::lua_reference lua_reference; lua_reference const &tbl = object->get_lua_table(); if (!tbl.is_valid()) return; tbl.get (state); int i; lua_pushnil (state); for (i=0; lua_next(state,-2); ++i) { cs::lua_debugger::icon_type icon_type; bool use_in_description; pcstr name = lua_to_string(state,-2); string4096 type; backend.type_to_string (type, sizeof(type), state, -1, use_in_description); string4096 value; backend.value_to_string (value, sizeof(value), state, -1, icon_type, true); value_to_expand.add_value ( name, type, value, icon_type ); lua_pop_value (state, 1); } lua_pop_value (state, 1); }
char const * Invalid_Category_Name::plain_what() const { m_buffer = class_name(); m_buffer += ": "; m_buffer += name(); m_buffer += " "; return m_buffer.c_str(); }
/** Tree output to stream. */ void basic::do_print_tree(const print_tree & c, unsigned level) const { c.s << std::string(level, ' ') << class_name() << " @" << this << std::hex << ", hash=0x" << hashvalue << ", flags=0x" << flags << std::dec; if (nops()) c.s << ", nops=" << nops(); c.s << std::endl; for (size_t i=0; i<nops(); ++i) op(i).print(c, level + c.delta_indent); }
status_t TRotationEffect::Archive(BMessage* data, bool deep) const { // Start by calling inherited archive status_t err = TTransformEffect::Archive(data, deep); if (err != B_OK) return err; // Add our class name to the archive return data->AddString("class", class_name(this)); }
const char * create_classes_list( const int count, int *classes ) { char buf[MAX_STRING_LENGTH]; buf[0] = '\0'; // construct classes list for ( int i = 0; i < count; i++ ) { strcat( buf, quotify( class_name( classes[i] ) ) ); if ( i < count-1 ) strcat( buf, ", " ); } return str_dup(buf); }
CubitBoolean RefEdge::is_tolerant() { Curve* curve_ptr = get_curve_ptr(); if (curve_ptr == NULL) { PRINT_WARNING("\tWARNING: Null underlying curve for %s, (%s %d)\n", entity_name().c_str(), class_name(), id()); return CUBIT_FALSE; } return curve_ptr->is_tolerant(); }
BFilePanel * SketchApp::FindFilePanel() { BFilePanel *win = NULL; int32 i = 0; while((win = (BFilePanel *)be_app->WindowAt(i++)) != NULL) { if(!strcmp(class_name(win), "BFilePanel")) return cast_as(win, BFilePanel); } return NULL; }
// Parse a destructor-id. A destuctor-id naems the destructor of // a class or a decltype-type that refers to a class. // // destructor-id: // '~' class-name // '~' decltype-type Name& Parser::destructor_id() { Token tok = match(tilde_tok); if (lookahead() == decltype_tok) { Type& t = decltype_type(); return on_destructor_id(tok, t); } else { Type& t = class_name(); return on_destructor_id(tok, t); } }
void shade::shaders::PerStageGettable<T>::get_inline(formatter::Generator& generator) { std::string class_name(PerStageGettable::get_class_name()); generator.handle_environment_begin(vertex_stage); generator.handle_return_begin(); generator.handle_function_call_begin(); generator.handle_function_call_name_begin(); generator.handle_identifier(class_name + "_get_vertex"); generator.handle_function_call_name_end(); generator.handle_function_call_parameter_list_begin(); generator.handle_function_call_parameter_begin(); generator.handle_identifier("self"); generator.handle_function_call_parameter_end(); generator.handle_function_call_parameter_list_end(); generator.handle_function_call_end(); generator.handle_return_end(); generator.handle_environment_end(); generator.handle_environment_begin(fragment_stage); generator.handle_return_begin(); generator.handle_function_call_begin(); generator.handle_function_call_name_begin(); generator.handle_identifier(class_name + "_get_fragment"); generator.handle_function_call_name_end(); generator.handle_function_call_parameter_list_begin(); generator.handle_function_call_parameter_begin(); generator.handle_identifier("self"); generator.handle_function_call_parameter_end(); generator.handle_function_call_parameter_list_end(); generator.handle_function_call_end(); generator.handle_return_end(); generator.handle_environment_end(); generator.handle_environment_begin(geometry_stage); generator.handle_return_begin(); generator.handle_function_call_begin(); generator.handle_function_call_name_begin(); generator.handle_identifier(class_name + "_get_geometry"); generator.handle_function_call_name_end(); generator.handle_function_call_parameter_list_begin(); generator.handle_function_call_parameter_begin(); generator.handle_identifier("self"); generator.handle_function_call_parameter_end(); generator.handle_function_call_parameter_list_end(); generator.handle_function_call_end(); generator.handle_return_end(); generator.handle_environment_end(); get_default_inline(generator); }
void print_talent(talent_type const *t) { std::string t_class = class_name(t->m_class); printf("Talent '%s' (%u):\n", t->name, t->id); printf(" Tab page: %u\n", t->tab_page); printf(" Class: %s\n", t_class.c_str()); printf(" Depends on: %u\n", t->dependance); printf(" Column: %u\n", t->col); printf(" Row: %u\n", t->row); for (int i = 0; i < 3 && t->rank_id[i]; ++i) { printf(" Rank #%d id: %u\n", i+1, t->rank_id[i]); } }
void engine::type_convert_class (char* const buffer, unsigned int const size, lua_State *state, int index) { luabind::detail::object_rep *object = luabind::detail::is_class_object(state, index); VERIFY2 (object, "invalid object userdata"); sz_cpy (buffer, size, ""); sz_cat (buffer, size, "class \""); sz_cat (buffer, size, object->crep()->name()); sz_cat (buffer, size, "\" ("); u32 const length = sz_len(buffer); class_name (buffer + length, size - length, *object->crep()); sz_cat (buffer, size, " instance)"); }