Esempio n. 1
0
Variant BaseGenericObject::invokeProperty(const char* name, const ReflectedMethodParameters& parameters)
{
	const IClassDefinition& definition = *this->getDefinition();
	ObjectHandle provider = this->getDerivedType();
	PropertyAccessor accessor = definition.bindProperty(name, provider);
	if (!accessor.isValid())
	{
		TF_ASSERT(false && "Property could not be found");
		return Variant();
	}
	return accessor.invoke(parameters);
}
Esempio n. 2
0
	Variant invoke( const PropertyAccessor & pa, const ReflectedMethodParameters & parameters )
	{
		Key key;
		if (!createKey( pa, key ))
		{
			return pa.invoke( parameters );
		}

		std::unique_ptr<ReflectedMethodCommandParameters> commandParameters( new ReflectedMethodCommandParameters() );
		commandParameters->setId( key.first );
		commandParameters->setPath( key.second.c_str() );
		commandParameters->setParameters( parameters );

		const auto itr = commands_.emplace( std::pair< Key, CommandInstancePtr >( key, commandManager_.queueCommand(
			getClassIdentifier<InvokeReflectedMethodCommand>(), ObjectHandle( std::move( commandParameters ),
			pa.getDefinitionManager()->getDefinition<ReflectedMethodCommandParameters>() ) ) ) );

		commandManager_.waitForInstance( itr->second );
		ObjectHandle returnValueObject = itr->second.get()->getReturnValue();
		commands_.erase( itr );
		Variant* returnValuePointer = returnValueObject.getBase<Variant>();
		assert( returnValuePointer != nullptr );
		return *returnValuePointer;
	}