bool ResourceManager::isResource(const std::type_index& ti) {
		if (Resources.find(ti) == Resources.end())
		{
			Engine::out(Engine::ERROR) << "[ResourceManager] Class " << ti.name() << " not registered as Resource!" << std::endl;
			return false;
		}

		return true;
	}
fcppt::string
fcppt::type_name_from_index(
	std::type_index const &_index
)
{
	return
		fcppt::type_name(
			_index.name()
		);
}
InputPortRepresentation::InputPortRepresentation(std::type_index type, NodeRepresentation* parent, GraphDisplayArea* displayArea, const wxString& name, wxAlignment alignment)
	: PortRepresentationBase(parent, displayArea, "", alignment),
	m_name(name),
	m_type(type)
{
	SetLabelText((name + " : ") + type.name());

	wxStaticText::Bind(wxEVT_LEFT_DOWN, &InputPortRepresentation::OnMouse, this);
	wxStaticText::Bind(wxEVT_LEFT_UP, &InputPortRepresentation::OnMouse, this);
	wxStaticText::Bind(wxEVT_LEFT_DCLICK, &InputPortRepresentation::OnMouse, this);
}
std::string demangleTypeName(const std::type_index& type)
{
    int status = 0;
    std::string result;
    char* p_nice_name = abi::__cxa_demangle(type.name(), NULL, NULL, &status);
    if(0 != status) 
    {
        //if demangling failed return the mangled name
        result = type.name();
    }
    else
    {
        if(nullptr != p_nice_name)
        {
            result = p_nice_name;
            free(p_nice_name);
        }

    }
    return result;  
}
/*!
 * \since v.5.5.3
 * \brief A helper function for creating subscription description.
 */
inline std::string
make_subscription_description(
	const mbox_t & mbox_ref,
	std::type_index msg_type,
	const state_t & state )
	{
		std::ostringstream s;
		s << "(mbox:'" << mbox_ref->query_name()
			<< "', msg_type:'" << msg_type.name() << "', state:'"
			<< state.query_name() << "')";

		return s.str();
	}
int	FITSKeywords::type(std::type_index idx) {
	if (idx == std::type_index(typeid(bool))) {
		return TLOGICAL;
	}
	if (idx == std::type_index(typeid(unsigned char))) {
		return TBYTE;
	}
	if (idx == std::type_index(typeid(char))) {
		return TSBYTE;
	}
	if (idx == std::type_index(typeid(std::string))) {
		return TSTRING;
	}
	if (idx == std::type_index(typeid(unsigned short))) {
		return TUSHORT;
	}
	if (idx == std::type_index(typeid(short))) {
		return TSHORT;
	}
	if (idx == std::type_index(typeid(unsigned int))) {
		return TUINT;
	}
	if (idx == std::type_index(typeid(int))) {
		return TINT;
	}
	if (idx == std::type_index(typeid(unsigned long))) {
		return TULONG;
	}
	if (idx == std::type_index(typeid(long))) {
		return TLONG;
	}
	if (idx == std::type_index(typeid(float))) {
		return TFLOAT;
	}
	if (idx == std::type_index(typeid(double))) {
		return TDOUBLE;
	}
	if (idx == std::type_index(typeid(long long))) {
		return TLONGLONG;
	}
	std::string	msg = stringprintf("type index '%s' not known",
				idx.name());
	debug(LOG_DEBUG, DEBUG_LOG, 0, "%s", msg.c_str());
	throw std::invalid_argument(msg);
}
Exemple #7
0
 std::shared_ptr<type_descriptor> get_type_descriptor(std::type_index type_index)
 {
     VAL& type_descriptor_map = get_type_descriptor_map();
     VAL& type_descriptor_iter = type_descriptor_map.find(type_index);
     if (type_descriptor_iter == std::end(type_descriptor_map))
     {
         VAL& type_map = get_type_map();
         VAL& type_iter = type_map.find(type_index);
         if (type_iter == std::end(type_map)) throw std::runtime_error("Could not find type descriptor for '"_s + type_index.name() + "'.");
         return std::make_shared<reflectable_descriptor>();
     }
     return type_descriptor_iter->second;
 }
			template <> static std::wstring ToString<std::type_index>(const std::type_index& ti) { return to_wstring(ti.name()); }
no_serializer::no_serializer(const std::type_index& type) :
        runtime_error(make_no_serializer_extractor_errmsg("serializer", type)),
        _type_index(type),
        _type_name(demangle(type.name()))
{ }
static std::string make_no_serializer_extractor_errmsg(const char* kind, const std::type_index& type)
{
    std::ostringstream ss;
    ss << "Could not find " << kind << " for type: " << demangle(type.name());
    return ss.str();
}