本文整理汇总了C++中PropertyAccessor::getDefinitionManager方法的典型用法代码示例。如果您正苦于以下问题:C++ PropertyAccessor::getDefinitionManager方法的具体用法?C++ PropertyAccessor::getDefinitionManager怎么用?C++ PropertyAccessor::getDefinitionManager使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PropertyAccessor
的用法示例。
在下文中一共展示了PropertyAccessor::getDefinitionManager方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: setValue
void setValue( const PropertyAccessor & pa, const Variant & data )
{
Key key;
if (!createKey( pa, key ))
{
pa.setValue( data );
return;
}
std::unique_ptr< ReflectedPropertyCommandArgument > args( new ReflectedPropertyCommandArgument );
args->setContextId( key.first );
args->setPath( key.second.c_str() );
args->setValue( data );
// Access is only on the main thread
assert( std::this_thread::get_id() == commandManager_.ownerThreadId() );
const auto commandId = getClassIdentifier< SetReflectedPropertyCommand >();
const auto pArgsDefinition =
pa.getDefinitionManager()->getDefinition< ReflectedPropertyCommandArgument >();
ObjectHandle commandArgs( std::move( args ), pArgsDefinition );
auto command = commandManager_.queueCommand( commandId, commandArgs );
// Queuing may cause it to execute straight away
// Based on the thread affinity of SetReflectedPropertyCommand
if (!command->isComplete())
{
commands_.emplace( std::pair< Key, CommandInstancePtr >( key, command ) );
}
}
示例2: createKey
bool createKey( const PropertyAccessor & pa, Key & o_Key )
{
const auto & obj = pa.getRootObject();
if (obj == nullptr)
{
return false;
}
if (!obj.getId( o_Key.first ))
{
auto om = pa.getDefinitionManager()->getObjectManager();
assert( !om->getObject( obj.data() ).isValid() );
if (!om->getUnmanagedObjectId( obj.data(), o_Key.first ))
{
o_Key.first = om->registerUnmanagedObject( obj );
}
}
o_Key.second = pa.getFullPath();
return true;
}
示例3: invoke
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;
}