您当前的位置:首页 > IT编程 > C++
| C语言 | Java | VB | VC | python | Android | TensorFlow | C++ | oracle | 学术与代码 | cnn卷积神经网络 | gnn | 图像修复 | Keras | 数据集 | Neo4j | 自然语言处理 | 深度学习 | 医学CAD | 医学影像 | 超参数 | pointnet | pytorch | 异常检测 | Transformers | 情感分类 | 知识图谱 |

自学教程:C++ type函数代码示例

51自学网 2021-06-03 09:02:06
  C++
这篇教程C++ type函数代码示例写得很实用,希望能帮到您。

本文整理汇总了C++中type函数的典型用法代码示例。如果您正苦于以下问题:C++ type函数的具体用法?C++ type怎么用?C++ type使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。

在下文中一共展示了type函数的21个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: type

type EmptyMapType::clone_and_bind_params(string_v &formal, type_v &actual){  return type(new EmptyMapType);}
开发者ID:gianantonio71,项目名称:amber,代码行数:4,


示例2: error

/** * Read part of a 512 byte block from an SD card. * * /param[in] block Logical block to be read. * /param[in] offset Number of bytes to skip at start of block * /param[out] dst Pointer to the location that will receive the data. * /param[in] count Number of bytes to read * /return The value one, true, is returned for success and * the value zero, false, is returned for failure. */uint8_t Sd2Card::readData(uint32_t block,        uint16_t offset, uint16_t count, uint8_t* dst) {  uint16_t n;  if (count == 0) return true;  if ((count + offset) > 512) {    goto fail;  }  if (!inBlock_ || block != block_ || offset < offset_) {    block_ = block;    // use address if not SDHC card    if (type()!= SD_CARD_TYPE_SDHC) block <<= 9;    if (cardCommand(CMD17, block)) {      error(SD_CARD_ERROR_CMD17);      goto fail;    }    if (!waitStartBlock()) {      goto fail;    }    offset_ = 0;    inBlock_ = 1;  }#ifdef OPTIMIZE_HARDWARE_SPI  // start first spi transfer  SPDR = 0XFF;  // skip data before offset  for (;offset_ < offset; offset_++) {    while (!(SPSR & (1 << SPIF)))      ;    SPDR = 0XFF;  }  // transfer data  n = count - 1;  for (uint16_t i = 0; i < n; i++) {    while (!(SPSR & (1 << SPIF)))      ;    dst[i] = SPDR;    SPDR = 0XFF;  }  // wait for last byte  while (!(SPSR & (1 << SPIF)))    ;  dst[n] = SPDR;#else  // OPTIMIZE_HARDWARE_SPI#ifdef ESP8266  // skip data before offset  SPI.transferBytes(NULL, NULL, offset_);  // transfer data  SPI.transferBytes(NULL, dst, count);#else  // skip data before offset  for (;offset_ < offset; offset_++) {    spiRec();  }  // transfer data  for (uint16_t i = 0; i < count; i++) {    dst[i] = spiRec();  }#endif#endif  // OPTIMIZE_HARDWARE_SPI  offset_ += count;  if (!partialBlockRead_ || offset_ >= 512) {    // read rest of data, checksum and set chip select high    readEnd();  }  return true; fail:  chipSelectHigh();  return false;}
开发者ID:9mrcookie9,项目名称:Arduino,代码行数:86,


示例3: type

 void l_function::dump_all_function() {          std::cout   << "function ( args:"     << m_args_size     << ", up value: "     << m_up_val_size     << ", consts: "     << m_costants.size()     << ", bytecode: "     << m_commands.size()     << " )/n/n";               size_t id_consts = 0;     std::string type ("unknow");     std::string value("none");               for(l_variable& variable : m_costants)     {         switch (variable.m_type)         {             case l_variable::INT: type = "int"; value = std::to_string(variable.m_value.m_i); break;             case l_variable::FLOAT: type = "float"; value = std::to_string(variable.m_value.m_f); break;             case l_variable::STRING: type = "string"; value = variable.string()->str(); break;             case l_variable::FUNCTION: type = "function"; value = std::to_string(variable.m_value.m_i);  break;             case l_variable::CFUNCTION: type = "c-function"; value = std::to_string((unsigned long)variable.m_value.m_pcfun);  break;             case l_variable::OBJECT: type = "object"; value = std::to_string((unsigned long)variable.m_value.m_pobj); break;                              default: break;         }                           std::cout         << "const["         << id_consts++         << "]: type: "         << type         << ", value: "         << compiler_utilities::compile_string(value,false)         << "/n";     }     std::cout<< " /n";          //constants     const int spaces = 20;     //..     size_t last = 0;     size_t line = 0;          for(auto& cmd : m_commands)     {                  if(cmd.m_line > last)         {             last = cmd.m_line;             std::cout<< std::to_string(cmd.m_line) << "/t";         }         else         {             std::cout<< " /t";         }                  std::cout         <<  line++         <<  "/t"         <<  l_op_code_str[cmd.m_op_code];                  //cmd len         size_t len = std::strlen(l_op_code_str[cmd.m_op_code]);         for(int i=0; i< (spaces-len); ++i) std::cout << " ";                  //..         std::cout  <<  cmd.m_arg;                  //print var name         if(  cmd.m_op_code == L_GET_GLOBAL            ||cmd.m_op_code == L_GET_LOCAL         // ||cmd.m_op_code == L_GET_AT_VAL            ||cmd.m_op_code == L_GET_UP_VALUE            ||cmd.m_op_code == L_SET_GLOBAL            ||cmd.m_op_code == L_SET_LOCAL         // ||cmd.m_op_code == L_SET_AT_VAL            ||cmd.m_op_code == L_SET_UP_VALUE)         {             std::cout << "/t;" << m_costants[cmd.m_arg].to_string();         }         else if ( cmd.m_op_code == L_PUSHK )         {             std::cout << "/t;" <<  compiler_utilities::compile_string( m_costants[cmd.m_arg].to_string(), false );         }                  //end line         std::cout << std::endl;     } }
开发者ID:Gabriele91,项目名称:LLanguage,代码行数:97,


示例4: throw

/** * copy constructor - generic * * If the rhs is not an EVB_GLOM_INFO item, we'll throw a bad_cast. * * @param rhs - CRingItem reference from which we will construct. */CGlomParameters::CGlomParameters(const CRingItem& rhs) throw(std::bad_cast) :    CRingItem(rhs){    if (type() != EVB_GLOM_INFO) throw std::bad_cast();        }
开发者ID:jrtomps,项目名称:nscldaq,代码行数:12,


示例5: TIMER_START

//.........这里部分代码省略.........        tbb::concurrent_vector<mapbox::util::optional<InputRestrictionContainer>>            resulting_restrictions;        // setup restriction parser        const RestrictionParser restriction_parser(scripting_environment.get_lua_state());        while (const osmium::memory::Buffer buffer = reader.read())        {            // create a vector of iterators into the buffer            std::vector<osmium::memory::Buffer::const_iterator> osm_elements;            for (auto iter = std::begin(buffer); iter != std::end(buffer); ++iter)            {                osm_elements.push_back(iter);            }            // clear resulting vectors            resulting_nodes.clear();            resulting_ways.clear();            resulting_restrictions.clear();            // parse OSM entities in parallel, store in resulting vectors            tbb::parallel_for(                tbb::blocked_range<std::size_t>(0, osm_elements.size()),                [&](const tbb::blocked_range<std::size_t> &range)                {                    ExtractionNode result_node;                    ExtractionWay result_way;                    lua_State *local_state = scripting_environment.get_lua_state();                    for (auto x = range.begin(); x != range.end(); ++x)                    {                        const auto entity = osm_elements[x];                        switch (entity->type())                        {                        case osmium::item_type::node:                            result_node.clear();                            ++number_of_nodes;                            luabind::call_function<void>(                                local_state, "node_function",                                boost::cref(static_cast<const osmium::Node &>(*entity)),                                boost::ref(result_node));                            resulting_nodes.push_back(std::make_pair(x, result_node));                            break;                        case osmium::item_type::way:                            result_way.clear();                            ++number_of_ways;                            luabind::call_function<void>(                                local_state, "way_function",                                boost::cref(static_cast<const osmium::Way &>(*entity)),                                boost::ref(result_way));                            resulting_ways.push_back(std::make_pair(x, result_way));                            break;                        case osmium::item_type::relation:                            ++number_of_relations;                            resulting_restrictions.push_back(restriction_parser.TryParse(                                static_cast<const osmium::Relation &>(*entity)));                            break;                        default:                            ++number_of_others;                            break;                        }                    }                });            // put parsed objects thru extractor callbacks
开发者ID:Androidized,项目名称:osrm-backend,代码行数:67,


示例6: type

Machine::Machine(const Config& c)    :p_elements()    ,p_trace(NULL)    ,p_info(){    std::string type(c.get<std::string>("sim_type"));    info_mutex_t::scoped_lock G(info_mutex);    p_state_infos_t::iterator it = p_state_infos.find(type);    if(it==p_state_infos.end()) {        std::ostringstream msg;        msg<<"Unsupport sim_type '"<<type<<"'";        throw key_error(msg.str());    }    p_info = it->second;    typedef Config::vector_t elements_t;    elements_t Es(c.get<elements_t>("elements"));    p_elements_t result;    result.reserve(Es.size());    size_t idx=0;    for(elements_t::iterator it=Es.begin(), end=Es.end(); it!=end; ++it)    {        const Config& EC = *it;        const std::string& etype(EC.get<std::string>("type"));        state_info::elements_t::iterator eit = p_info.elements.find(etype);        if(eit==p_info.elements.end())            throw key_error(etype);        element_builder_t* builder = eit->second;        ElementVoid *E;        try{            E = builder->build(EC);        }catch(key_error& e){            std::ostringstream strm;            strm<<"Error while initializing element "<<idx<<" '"<<EC.get<std::string>("name", "<invalid>")               <<"' : missing required parameter '"<<e.what()<<"'";            throw key_error(strm.str());        }catch(std::exception& e){            std::ostringstream strm;            strm<<"Error while constructing element "<<idx<<" '"<<EC.get<std::string>("name", "<invalid>")               <<"' : "<<e.what();            throw std::runtime_error(strm.str());        }        *const_cast<size_t*>(&E->index) = idx++; // ugly        result.push_back(E);    }    G.unlock();    p_elements.swap(result);}
开发者ID:kryv,项目名称:jmbgsddb,代码行数:62,


示例7: type

bool GField::canCompare(IGCMPObject* pOther){    return type() == pOther->type();}
开发者ID:zhangh-t,项目名称:GCMP,代码行数:4,


示例8: MemoryState

void StructuredScript::Storage::Memory::assign(IAny::Ptr object, IStorage *storage, IExceptionManager *exception, INode *expr){	auto value = value_.lock();	if (attributes_ != nullptr){//Validate access		if (value != nullptr && !Query::Object::isUndefined(value) && (attributes_->hasAttribute(""))){			Query::ExceptionManager::set(exception, PrimitiveFactory::createString(Query::ExceptionManager::combine(				"Cannot modify object!", expr)));			return;		}	}	auto states = MemoryState(type_->states());	if ((states.isConstant() || states.isFinal()) && value != nullptr && !Query::Object::isUndefined(value)){//Cannot assign to a const | final memory		Query::ExceptionManager::set(exception, PrimitiveFactory::createString(Query::ExceptionManager::combine(			"Cannot modify memory!", expr)));		return;	}	object = object->base();	if (object == nullptr || Query::Object::isUndefined(object) || Query::Object::isExpansion(object) || Query::Object::isExpanded(object)){		Query::ExceptionManager::set(exception, PrimitiveFactory::createString(Query::ExceptionManager::combine(			"Cannot assign an invalid object!", expr)));		return;	}	auto type = object->type();	if (type == nullptr){//Expected type		Query::ExceptionManager::set(exception, PrimitiveFactory::createString(Query::ExceptionManager::combine(			"Expected type of object during assignment!", expr)));		return;	}	bool mustCast;	if (type_ != nullptr){//Validate assignment		auto compatibleType = type_->getCompatibleType(type);		if (compatibleType == nullptr){//Incompatible types -- use type as is			if (states.isReference() && !states.isRValReference()){//Compatible type required				Query::ExceptionManager::set(exception, PrimitiveFactory::createString(Query::ExceptionManager::combine(					"Incompatible types!", expr)));				return;			}			mustCast = true;			compatibleType = type_;		}		else			mustCast = false;		if (states.isReference()){//Get reference			auto memory = object->memory();			if (states.isRValReference()){//Value | Reference				if (mustCast){					object = object->cast(compatibleType->base(), storage, exception, expr);					if (Query::ExceptionManager::has(exception))						return;				}				else if (memory != nullptr){					auto objectType = memory->type();					auto objectStates = MemoryState((objectType == nullptr) ? MemoryState::STATE_NONE : objectType->states());					if (!objectStates.isRValReference()){//Only get reference if object is not an rvalue reference						object = PrimitiveFactory::createReference(memory->ptr());						dynamic_cast<IDeclaredType *>(type_.get())->states((states -= MemoryState::STATE_RVALUE).states());					}				}			}			else if (memory == nullptr){//Reference requires an lvalue				Query::ExceptionManager::set(exception, PrimitiveFactory::createString(Query::ExceptionManager::combine(					"Cannot get reference of an rvalue!", expr)));				return;			}			else//Reference				object = PrimitiveFactory::createReference(memory->ptr());		}		else if (!compatibleType->isAny()){//Cast object to compatible type			object = object->cast(compatibleType->base(), storage, exception, expr);			if (Query::ExceptionManager::has(exception))				return;			if (object == nullptr){//Failed to do conversion				Query::ExceptionManager::set(exception, PrimitiveFactory::createString(Query::ExceptionManager::combine(					"Incompatible types!", expr)));				return;			}		}		if (object->memory() != nullptr)//Create object copy			object = object->clone(storage, exception, expr);		if (Query::ExceptionManager::has(exception))			return;	}	assign(object);}
开发者ID:benbraide,项目名称:StructuredScript,代码行数:100,


示例9: load

    void load(Archive& ar, boost::exception_ptr& e, unsigned int)    {        hpx::util::exception_type type(hpx::util::unknown_exception);        std::string what;        int err_value = hpx::success;        std::string err_message;        boost::uint32_t throw_locality_ = 0;        std::string throw_hostname_;        boost::int64_t throw_pid_ = -1;        std::size_t throw_shepherd_ = 0;        std::size_t throw_thread_id_ = 0;        std::string throw_thread_name_;        std::string throw_function_;        std::string throw_file_;        std::string throw_back_trace_;        int throw_line_ = 0;        std::string throw_env_;        std::string throw_config_;        std::string throw_state_;        std::string throw_auxinfo_;        ar & type & what & throw_function_ & throw_file_ & throw_line_           & throw_locality_ & throw_hostname_ & throw_pid_ & throw_shepherd_           & throw_thread_id_ & throw_thread_name_ & throw_back_trace_           & throw_env_ & throw_config_ & throw_state_ & throw_auxinfo_;        if (hpx::util::hpx_exception == type) {            ar & err_value;        }        else if (hpx::util::boost_system_error == type) {            ar & err_value & err_message;        }        switch (type) {        default:        case hpx::util::std_exception:        case hpx::util::unknown_exception:            e = hpx::detail::construct_exception(                    hpx::detail::std_exception(what),                    throw_function_, throw_file_, throw_line_, throw_back_trace_,                    throw_locality_, throw_hostname_, throw_pid_,                    throw_shepherd_, throw_thread_id_, throw_thread_name_,                    throw_env_, throw_config_, throw_state_, throw_auxinfo_);            break;        // standard exceptions        case hpx::util::std_runtime_error:            e = hpx::detail::construct_exception(                    std::runtime_error(what),                    throw_function_, throw_file_, throw_line_, throw_back_trace_,                    throw_locality_, throw_hostname_, throw_pid_,                    throw_shepherd_, throw_thread_id_, throw_thread_name_,                    throw_env_, throw_config_, throw_state_, throw_auxinfo_);            break;        case hpx::util::std_invalid_argument:            e = hpx::detail::construct_exception(                    std::invalid_argument(what),                    throw_function_, throw_file_, throw_line_, throw_back_trace_,                    throw_locality_, throw_hostname_, throw_pid_,                    throw_shepherd_, throw_thread_id_, throw_thread_name_,                    throw_env_, throw_config_, throw_state_, throw_auxinfo_);            break;        case hpx::util::std_out_of_range:            e = hpx::detail::construct_exception(                    std::out_of_range(what),                    throw_function_, throw_file_, throw_line_, throw_back_trace_,                    throw_locality_, throw_hostname_, throw_pid_,                    throw_shepherd_, throw_thread_id_, throw_thread_name_,                    throw_env_, throw_config_, throw_state_, throw_auxinfo_);            break;        case hpx::util::std_logic_error:            e = hpx::detail::construct_exception(                    std::logic_error(what),                    throw_function_, throw_file_, throw_line_, throw_back_trace_,                    throw_locality_, throw_hostname_, throw_pid_,                    throw_shepherd_, throw_thread_id_, throw_thread_name_,                    throw_env_, throw_config_, throw_state_, throw_auxinfo_);            break;        case hpx::util::std_bad_alloc:            e = hpx::detail::construct_exception(                    hpx::detail::bad_alloc(what),                    throw_function_, throw_file_, throw_line_, throw_back_trace_,                    throw_locality_, throw_hostname_, throw_pid_,                    throw_shepherd_, throw_thread_id_, throw_thread_name_,                    throw_env_, throw_config_, throw_state_, throw_auxinfo_);            break;        case hpx::util::std_bad_cast:            e = hpx::detail::construct_exception(                    hpx::detail::bad_cast(what),                    throw_function_, throw_file_, throw_line_, throw_back_trace_,                    throw_locality_, throw_hostname_, throw_pid_,                    throw_shepherd_, throw_thread_id_, throw_thread_name_,                    throw_env_, throw_config_, throw_state_, throw_auxinfo_);            break;//.........这里部分代码省略.........
开发者ID:7ev3n,项目名称:hpx,代码行数:101,


示例10: type_nr

 /// Returns the type number for the element at position `pos`. inline uint16_t type_nr(size_t pos) const noexcept {   return type(pos).first; }
开发者ID:crudbug,项目名称:actor-framework,代码行数:4,


示例11: save

    void save(Archive& ar, boost::exception_ptr const& ep, unsigned int)    {        hpx::util::exception_type type(hpx::util::unknown_exception);        std::string what;        int err_value = hpx::success;        std::string err_message;        boost::uint32_t throw_locality_ = 0;        std::string throw_hostname_;        boost::int64_t throw_pid_ = -1;        std::size_t throw_shepherd_ = 0;        std::size_t throw_thread_id_ = 0;        std::string throw_thread_name_;        std::string throw_function_;        std::string throw_file_;        std::string throw_back_trace_;        int throw_line_ = 0;        std::string throw_env_;        std::string throw_config_;        std::string throw_state_;        std::string throw_auxinfo_;        // retrieve information related to boost::exception        try {            boost::rethrow_exception(ep);        }        catch (boost::exception const& e) {            char const* const* func =                boost::get_error_info<boost::throw_function>(e);            if (func) {                throw_function_ = *func;            }            else {                std::string const* s =                    boost::get_error_info<hpx::detail::throw_function>(e);                if (s)                    throw_function_ = *s;            }            char const* const* file =                boost::get_error_info<boost::throw_file>(e);            if (file) {                throw_file_ = *file;            }            else {                std::string const* s =                    boost::get_error_info<hpx::detail::throw_file>(e);                if (s)                    throw_file_ = *s;            }            int const* line =                boost::get_error_info<boost::throw_line>(e);            if (line)                throw_line_ = *line;            boost::uint32_t const* locality =                boost::get_error_info<hpx::detail::throw_locality>(e);            if (locality)                throw_locality_ = *locality;            std::string const* hostname_ =                boost::get_error_info<hpx::detail::throw_hostname>(e);            if (hostname_)                throw_hostname_ = *hostname_;            boost::int64_t const* pid_ =                boost::get_error_info<hpx::detail::throw_pid>(e);            if (pid_)                throw_pid_ = *pid_;            std::size_t const* shepherd =                boost::get_error_info<hpx::detail::throw_shepherd>(e);            if (shepherd)                throw_shepherd_ = *shepherd;            std::size_t const* thread_id =                boost::get_error_info<hpx::detail::throw_thread_id>(e);            if (thread_id)                throw_thread_id_ = *thread_id;            std::string const* thread_name =                boost::get_error_info<hpx::detail::throw_thread_name>(e);            if (thread_name)                throw_thread_name_ = *thread_name;            std::string const* back_trace =                boost::get_error_info<hpx::detail::throw_stacktrace>(e);            if (back_trace)                throw_back_trace_ = *back_trace;            std::string const* env_ =                boost::get_error_info<hpx::detail::throw_env>(e);            if (env_)                throw_env_ = *env_;            std::string const* config_ =                boost::get_error_info<hpx::detail::throw_config>(e);            if (config_)                throw_config_ = *config_;//.........这里部分代码省略.........
开发者ID:7ev3n,项目名称:hpx,代码行数:101,


示例12: class_header_formatter_stitch

dogen::formatters::file class_header_formatter_stitch(    formatters::entity_formatting_assistant& fa,    const formattables::class_info& c) {    {        auto sbf(fa.make_scoped_boilerplate_formatter());        {            auto snf(fa.make_scoped_namespace_formatter());            fa.stream() << std::endl;            fa.comment(c.documentation());            if (c.parents().empty()) {                fa.stream() << "class " << c.name() << " " << fa.make_final_keyword_text(c) << "{" << std::endl;            } else if (c.parents().size() == 1) {                fa.stream() << "class " << c.name() << " " << fa.make_final_keyword_text(c) << ": public " << c.parents().front().qualified_name() << " {" << std::endl;            } else {                dogen::formatters::sequence_formatter sf(c.parents().size());                for (const auto p : c.parents()) {                    fa.stream() << "    public " << p.qualified_name() << sf.postfix() << std::endl;                    sf.next();                }            }            fa.stream() << "public:" << std::endl;            /*             * Compiler generated constructors and destructors.             */            if (!c.requires_manual_default_constructor())                fa.stream() << "    " << c.name() << "() = default;" << std::endl;            fa.stream() << "    " << c.name() << "(const " << c.name() << "&) = default;" << std::endl;            if (!c.requires_manual_move_constructor())                fa.stream() << "    " << c.name() << "(" << c.name() << "&&) = default;" << std::endl;            if (!c.is_parent() && c.parents().empty())                fa.stream() << "    ~" << c.name() << "() = default;" << std::endl;            if (c.is_immutable())                fa.stream() << "    " << c.name() << "& operator=(const " << c.name() << "&) = delete;" << std::endl;            else if (c.all_properties().empty())                fa.stream() << "    " << c.name() << "& operator=(const " << c.name() << "&) = default;" << std::endl;            fa.stream() << std::endl;            /*             * Manually generated default constructor.             */            if (c.requires_manual_default_constructor()) {                fa.stream() << "public:" << std::endl;                fa.stream() << "    " << c.name() << "();" << std::endl;                fa.stream() << std::endl;            }            /*             * Manually generated destructor.             *             * according to MEC++, item 33, base classes should always be             * abstract. this avoids all sorts of tricky problems with             * assignment and swap.             *             * incidentally, this also fixes some strange clang errors:             * undefined reference to `vtable.             */            if (c.is_parent()) {                fa.stream() << "    virtual ~" << c.name() << "() noexcept = 0;" << std::endl;                fa.stream() << std::endl;            } else if (c.parents().size() != 0) {                fa.stream() << "    virtual ~" << c.name() << "() noexcept { }" << std::endl;                fa.stream() << std::endl;            }            /*             * Manually generated move constructor.             */            if (c.requires_manual_move_constructor()) {                fa.stream() << "public:" << std::endl;                fa.stream() << "    " << c.name() << "(" << c.name() << "&& rhs);" << std::endl;                fa.stream() << std::endl;            }            /*             * Manually generated complete constructor.             */            if (!fa.is_complete_constructor_disabled() && !c.all_properties().empty()) {                fa.stream() << "public:" << std::endl;                const auto prop_count(c.all_properties().size());                if (prop_count == 1) {                    const auto p(*c.all_properties().begin());                    fa.stream() << "    explicit " << c.name() << "(const " << p.type().complete_name() << fa.make_by_ref_text(p) << " " << p.name() << ");" << std::endl;                } else {                    fa.stream() << "    " << c.name() << "(" << std::endl;                    dogen::formatters::sequence_formatter sf(prop_count);                    sf.postfix_configuration().last(");");                    for (const auto& p : c.all_properties()) {                        fa.stream() << "        const " << p.type().complete_name() << fa.make_by_ref_text(p) << " " << p.name() << sf.postfix() << std::endl;                        sf.next();                    }                }                fa.stream() << std::endl;            }            /*             * Friends             */            if (fa.is_serialization_enabled()) {                fa.stream() << "private:" << std::endl;                fa.stream() << "    template<typename Archive>" << std::endl;//.........这里部分代码省略.........
开发者ID:pgannon,项目名称:dogen,代码行数:101,


示例13: SetShared

 /** @brief Set whether this layer is actually shared by other nets  *         If ShareInParallel() is true and using more than one GPU and the  *         net has TRAIN phase, then is_shared should be set true.  */ inline void SetShared(bool is_shared) {   CHECK(ShareInParallel() || !is_shared)       << type() << "Layer does not support sharing.";   is_shared_ = is_shared; }
开发者ID:encorechow,项目名称:caffe_BD,代码行数:9,


示例14: return

/*!    Returns true if this feedback has the same parameters as the feedback    /a feedback, otherwise returns false.*/bool HbAbstractFeedback::operator==(const HbAbstractFeedback &feedback) const{    return (d->cRect == feedback.rect()            && d->cWindow == feedback.window()            && type() == feedback.type());}
开发者ID:kuailexs,项目名称:symbiandump-mw1,代码行数:10,


示例15: while

bool CBotClass::CompileDefItem(CBotToken* &p, CBotCStack* pStack, bool bSecond){    bool    bStatic = false;    int     mProtect = PR_PUBLIC;    bool    bSynchro = false;    while (IsOfType(p, ID_SEP)) ;    CBotTypResult   type( -1 );    if ( IsOfType(p, ID_SYNCHO) ) bSynchro = true;    CBotToken*      pBase = p;    if ( IsOfType(p, ID_STATIC) ) bStatic = true;    if ( IsOfType(p, ID_PUBLIC) ) mProtect = PR_PUBLIC;    if ( IsOfType(p, ID_PRIVATE) ) mProtect = PR_PRIVATE;    if ( IsOfType(p, ID_PROTECTED) ) mProtect = PR_PROTECT;    if ( IsOfType(p, ID_STATIC) ) bStatic = true;//  CBotClass* pClass = NULL;    type = TypeParam(p, pStack);        // type of the result    if ( type.Eq(-1) )    {        pStack->SetError(TX_NOTYP, p);        return false;    }    while (pStack->IsOk())     {        CBotToken*  pp = p;        IsOfType(p, ID_NOT);    // skips ~ eventual (destructor)        if (IsOfType(p, TokenTypVar))        {            CBotInstr* limites = NULL;            while ( IsOfType( p, ID_OPBRK ) )   // a table?            {                CBotInstr* i = NULL;                if ( p->GetType() != ID_CLBRK )                    i = CBotExpression::Compile( p, pStack );           // expression for the value                else                    i = new CBotEmpty();                            // special if not a formula                type = CBotTypResult(CBotTypArrayPointer, type);                if (!pStack->IsOk() || !IsOfType( p, ID_CLBRK ) )                {                    pStack->SetError(TX_CLBRK, p->GetStart());                    return false;                }/*              CBotVar* pv = pStack->GetVar();                if ( pv->GetType()>= CBotTypBoolean )                {                    pStack->SetError(TX_BADTYPE, p->GetStart());                    return false;                }*/                if (limites == NULL) limites = i;                else limites->AddNext3(i);            }            if ( p->GetType() == ID_OPENPAR )            {                if ( !bSecond )                {                    p = pBase;                    CBotFunction* f =                     CBotFunction::Compile1(p, pStack, this);                    if ( f == NULL ) return false;                    if (m_pMethod == NULL) m_pMethod = f;                    else m_pMethod->AddNext(f);                }                else                {                    // return a method precompiled in pass 1                    CBotFunction*   pf = m_pMethod;                    CBotFunction*   prev = NULL;                    while ( pf != NULL )                     {                        if (pf->GetName() == pp->GetString()) break;                        prev = pf;                        pf = pf->Next();                    }                    bool bConstructor = (pp->GetString() == GetName());                    CBotCStack* pile = pStack->TokenStack(NULL, true);                    // make "this" known                    CBotToken TokenThis(CBotString("this"), CBotString());                    CBotVar* pThis = CBotVar::Create(&TokenThis, CBotTypResult( CBotTypClass, this ) );                    pThis->SetUniqNum(-2);                    pile->AddVar(pThis);                    if ( m_pParent )                    {//.........这里部分代码省略.........
开发者ID:PaweX,项目名称:colobot,代码行数:101,


示例16: switch

//// Convert one type to another.//// Returns the node representing the conversion, which could be the same// node passed in if no conversion was needed.//// Return 0 if a conversion can't be done.//TIntermTyped* TIntermediate::addConversion(TOperator op, const TType& type, TIntermTyped* node){    //    // Does the base type allow operation?    //    switch (node->getBasicType()) {    case EbtVoid:    case EbtSampler1D:    case EbtSampler2D:    case EbtSampler3D:    case EbtSamplerCube:    case EbtSampler1DShadow:    case EbtSampler2DShadow:    case EbtSamplerRect:        // ARB_texture_rectangle    case EbtSamplerRectShadow:  // ARB_texture_rectangle        return 0;    default: break;    }    //    // Otherwise, if types are identical, no problem    //    if (type == node->getType())        return node;    //    // If one's a structure, then no conversions.    //    if (type.getStruct() || node->getType().getStruct())        return 0;    //    // If one's an array, then no conversions.    //    if (type.isArray() || node->getType().isArray())        return 0;    TBasicType promoteTo;        switch (op) {    //    // Explicit conversions    //    case EOpConstructBool:        promoteTo = EbtBool;        break;    case EOpConstructFloat:        promoteTo = EbtFloat;        break;    case EOpConstructInt:        promoteTo = EbtInt;        break;    default:        //        // implicit conversions were removed from the language.        //        if (type.getBasicType() != node->getType().getBasicType())            return 0;        //        // Size and structure could still differ, but that's        // handled by operator promotion.        //        return node;    }        if (node->getAsConstantUnion()) {        return (promoteConstantUnion(promoteTo, node->getAsConstantUnion()));    } else {            //        // Add a new newNode for the conversion.        //        TIntermUnary* newNode = 0;        TOperator newOp = EOpNull;        switch (promoteTo) {        case EbtFloat:            switch (node->getBasicType()) {            case EbtInt:   newOp = EOpConvIntToFloat;  break;            case EbtBool:  newOp = EOpConvBoolToFloat; break;            default:                 infoSink.info.message(EPrefixInternalError, "Bad promotion node", node->getLine());                return 0;            }            break;        case EbtBool:            switch (node->getBasicType()) {            case EbtInt:   newOp = EOpConvIntToBool;   break;            case EbtFloat: newOp = EOpConvFloatToBool; break;            default:                 infoSink.info.message(EPrefixInternalError, "Bad promotion node", node->getLine());//.........这里部分代码省略.........
开发者ID:Aetherdyne,项目名称:glintercept,代码行数:101,


示例17: pinMode

uint8_t Sd2Card::init(uint8_t sckRateID, uint8_t chipSelectPin) {#endif  errorCode_ = inBlock_ = partialBlockRead_ = type_ = 0;  chipSelectPin_ = chipSelectPin;  // 16-bit init start time allows over a minute  uint16_t t0 = (uint16_t)millis();  uint32_t arg;  // set pin modes  pinMode(chipSelectPin_, OUTPUT);  digitalWrite(chipSelectPin_, HIGH);#ifndef USE_SPI_LIB  pinMode(SPI_MISO_PIN, INPUT);  pinMode(SPI_MOSI_PIN, OUTPUT);  pinMode(SPI_SCK_PIN, OUTPUT);#endif#ifndef SOFTWARE_SPI#ifndef USE_SPI_LIB  // SS must be in output mode even it is not chip select  pinMode(SS_PIN, OUTPUT);  digitalWrite(SS_PIN, HIGH); // disable any SPI device using hardware SS pin  // Enable SPI, Master, clock rate f_osc/128  SPCR = (1 << SPE) | (1 << MSTR) | (1 << SPR1) | (1 << SPR0);  // clear double speed  SPSR &= ~(1 << SPI2X);#else // USE_SPI_LIB  SPI.begin();  settings = SPISettings(250000, MSBFIRST, SPI_MODE0);#endif // USE_SPI_LIB#endif // SOFTWARE_SPI  // must supply min of 74 clock cycles with CS high.#ifdef USE_SPI_LIB  SPI.beginTransaction(settings);#endif  for (uint8_t i = 0; i < 10; i++) spiSend(0XFF);#ifdef USE_SPI_LIB  SPI.endTransaction();#endif  chipSelectLow();  // command to go idle in SPI mode  while ((status_ = cardCommand(CMD0, 0)) != R1_IDLE_STATE) {    if (((uint16_t)(millis() - t0)) > SD_INIT_TIMEOUT) {      error(SD_CARD_ERROR_CMD0);      goto fail;    }  }  // check SD version  if ((cardCommand(CMD8, 0x1AA) & R1_ILLEGAL_COMMAND)) {    type(SD_CARD_TYPE_SD1);  } else {    // only need last byte of r7 response    for (uint8_t i = 0; i < 4; i++) status_ = spiRec();    if (status_ != 0XAA) {      error(SD_CARD_ERROR_CMD8);      goto fail;    }    type(SD_CARD_TYPE_SD2);  }  // initialize card and send host supports SDHC if SD2  arg = type() == SD_CARD_TYPE_SD2 ? 0X40000000 : 0;  while ((status_ = cardAcmd(ACMD41, arg)) != R1_READY_STATE) {    // check for timeout    if (((uint16_t)(millis() - t0)) > SD_INIT_TIMEOUT) {      error(SD_CARD_ERROR_ACMD41);      goto fail;    }  }  // if SD2 read OCR register to check for SDHC card  if (type() == SD_CARD_TYPE_SD2) {    if (cardCommand(CMD58, 0)) {      error(SD_CARD_ERROR_CMD58);      goto fail;    }    if ((spiRec() & 0XC0) == 0XC0) type(SD_CARD_TYPE_SDHC);    // discard rest of ocr - contains allowed voltage range    for (uint8_t i = 0; i < 3; i++) spiRec();  }  chipSelectHigh();#ifndef SOFTWARE_SPI  return setSckRate(sckRateID);#else  // SOFTWARE_SPI  return true;#endif  // SOFTWARE_SPI fail:  chipSelectHigh();  return false;}
开发者ID:9mrcookie9,项目名称:Arduino,代码行数:94,


示例18: startElement

    bool startElement(const QString &namespaceURI,                      const QString &localName,                      const QString &qName,                      const QXmlAttributes &attributes)    {        // add to elements stack:        m_elementStack.append(new ElementData(qName.utf8()));        // First we need a node.        if (DBUS("node"))        {            CONDITION(!m_currentNode.isEmpty(), "Node inside a node.");            const int idx(indexOf(attributes, "name"));            COND_DOC_ERROR(idx < 0, QCString("Anonymous node found."));            m_currentNode = attributes.value(idx).utf8();            // A node is actually of little interest, so do nothing here.            return true;        }        // Then we need an interface.        if (DBUS("interface"))        {            // We need a nodeName for interfaces:            CONDITION(m_currentNode.isEmpty(), "Interface without a node.");            CONDITION(m_currentInterface, "Interface within another interface.");            const int idx(indexOf(attributes, "name"));            COND_DOC_ERROR(idx < 0, QString("Interface without a name found."));            // A interface is roughly equivalent to a class:            m_currentInterface = createEntry();            m_currentInterface->section = Entry::CLASS_SEC;            m_currentInterface->spec |= Entry::Interface;            m_currentInterface->type = "Interface";            m_currentInterface->name = substitute(attributes.value(idx).utf8(), ".", "::");            openScopes(m_currentInterface);            return true;        }        if (DBUS("method") || DBUS("signal"))        {            // We need a interfaceName for methods and signals:            CONDITION(!m_currentInterface, "Method or signal found outside a interface.");            CONDITION(m_currentMethod, "Method or signal found inside another method or signal.");            CONDITION(m_currentProperty, "Methor or signal found inside a property.");            CONDITION(!m_structStack.isEmpty(), "Method or signal found inside a struct.");            CONDITION(m_currentEnum, "Methor or signal found inside a enum.");            const int idx(indexOf(attributes, "name"));            COND_DOC_ERROR(idx < 0, QString("Method or signal without a name found."));            m_currentMethod = createEntry();            m_currentMethod->section = Entry::FUNCTION_SEC;            m_currentMethod->name = attributes.value(idx).utf8();            m_currentMethod->mtype = Method;            m_currentMethod->type = "void";            if (DBUS("signal"))            { m_currentMethod->mtype = Signal; }        }        if (DBUS("arg"))        {            // We need a method for arguments:            CONDITION(!m_currentMethod, "Argument found outside a method or signal.");            CONDITION(m_currentArgument, "Argument found inside another argument.");            const int name_idx(indexOf(attributes, "name"));            COND_DOC_ERROR(name_idx < 0, QString("Argument without a name found."));            COND_DOC_ERROR(!hasType(attributes), QString("Argument without a type found."));            const int direction_idx(indexOf(attributes, "direction"));            if ((m_currentMethod->mtype == Signal &&                 direction_idx >= 0 &&                 attributes.value(direction_idx) != "in") ||                (m_currentMethod->mtype == Method &&                 direction_idx >= 0 &&                 attributes.value(direction_idx) != "in" &&                 attributes.value(direction_idx) != "out"))            {                m_errorString = "Invalid direction found.";                return false;            }            m_currentArgument = new Argument;            m_currentArgument->type = getType(attributes).utf8();            m_currentArgument->name = attributes.value(name_idx).utf8();            if (direction_idx >= 0)            { m_currentArgument->attrib = attributes.value(direction_idx).utf8(); }            else            {                if (m_currentMethod->mtype == Signal)                { m_currentArgument->attrib = "in"; }//.........这里部分代码省略.........
开发者ID:AmesianX,项目名称:doxygen,代码行数:101,


示例19: type

MethodBind *godot_icall_Object_ClassDB_get_method(MonoString *p_type, MonoString *p_method) {	StringName type(GDMonoMarshal::mono_string_to_godot(p_type));	StringName method(GDMonoMarshal::mono_string_to_godot(p_method));	return ClassDB::get_method(type, method);}
开发者ID:Paulloz,项目名称:godot,代码行数:5,


示例20: switch

bool TextBase::edit(EditData& ed)      {      TextEditData* ted = static_cast<TextEditData*>(ed.getData(this));      TextCursor* _cursor = &ted->cursor;      // do nothing on Shift, it messes up IME on Windows. See #64046      if (ed.key == Qt::Key_Shift)            return false;      QString s         = ed.s;      bool ctrlPressed  = ed.modifiers & Qt::ControlModifier;      bool shiftPressed = ed.modifiers & Qt::ShiftModifier;      QTextCursor::MoveMode mm = shiftPressed ? QTextCursor::KeepAnchor : QTextCursor::MoveAnchor;      bool wasHex = false;      if (hexState >= 0) {            if (ed.modifiers == (Qt::ControlModifier | Qt::ShiftModifier | Qt::KeypadModifier)) {                  switch (ed.key) {                        case Qt::Key_0:                        case Qt::Key_1:                        case Qt::Key_2:                        case Qt::Key_3:                        case Qt::Key_4:                        case Qt::Key_5:                        case Qt::Key_6:                        case Qt::Key_7:                        case Qt::Key_8:                        case Qt::Key_9:                              s = QChar::fromLatin1(ed.key);                              ++hexState;                              wasHex = true;                              break;                        default:                              break;                        }                  }            else if (ed.modifiers == (Qt::ControlModifier | Qt::ShiftModifier)) {                  switch (ed.key) {                        case Qt::Key_A:                        case Qt::Key_B:                        case Qt::Key_C:                        case Qt::Key_D:                        case Qt::Key_E:                        case Qt::Key_F:                              s = QChar::fromLatin1(ed.key);                              ++hexState;                              wasHex = true;                              break;                        default:                              break;                        }                  }            }      if (!wasHex) {//printf("======%x/n", s.isEmpty() ? -1 : s[0].unicode());            switch (ed.key) {                  case Qt::Key_Z:         // happens when the undo stack is empty                        if (ed.modifiers == Qt::ControlModifier)                              return true;                        break;                  case Qt::Key_Enter:                  case Qt::Key_Return:                        deleteSelectedText(ed);                        score()->undo(new SplitText(_cursor), &ed);                        return true;                  case Qt::Key_Delete:                        if (!deleteSelectedText(ed))                              score()->undo(new RemoveText(_cursor, QString(_cursor->currentCharacter())), &ed);                        return true;                  case Qt::Key_Backspace:                        if (!deleteSelectedText(ed)) {                              if (_cursor->column() == 0 && _cursor->row() != 0)                                    score()->undo(new JoinText(_cursor), &ed);                              else {                                    if (!_cursor->movePosition(QTextCursor::Left))                                          return false;                                    score()->undo(new RemoveText(_cursor, QString(_cursor->currentCharacter())), &ed);                                    }                              }                        return true;                  case Qt::Key_Left:                        if (!_cursor->movePosition(ctrlPressed ? QTextCursor::WordLeft : QTextCursor::Left, mm) && type() == ElementType::LYRICS)                              return false;                        s.clear();                        break;                  case Qt::Key_Right:                        if (!_cursor->movePosition(ctrlPressed ? QTextCursor::NextWord : QTextCursor::Right, mm) && type() == ElementType::LYRICS)                              return false;                        s.clear();                        break;                  case Qt::Key_Up:#if defined(Q_OS_MAC)//.........这里部分代码省略.........
开发者ID:MarcSabatella,项目名称:MuseScore,代码行数:101,


示例21: UncertaintyDescription

GeometricDistribution::GeometricDistribution(std::shared_ptr<detail::UncertaintyDescription_Impl> impl)  : UncertaintyDescription(impl){  OS_ASSERT(type() == GeometricDistribution::type());}
开发者ID:jtanaa,项目名称:OpenStudio,代码行数:5,



注:本文中的type函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


C++ type2char函数代码示例
C++ typ函数代码示例
万事OK自学网:51自学网_软件自学网_CAD自学网自学excel、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。