本文整理汇总了C++中ObjectPtr::get方法的典型用法代码示例。如果您正苦于以下问题:C++ ObjectPtr::get方法的具体用法?C++ ObjectPtr::get怎么用?C++ ObjectPtr::get使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ObjectPtr
的用法示例。
在下文中一共展示了ObjectPtr::get方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: initialize
virtual void
initialize(const ObjectAdapterPtr&, const Identity&, const string&, const ObjectPtr& servant)
{
Test::ServantI* servantI = dynamic_cast<Test::ServantI*>(servant.get());
if(servantI != 0)
{
servantI->init(_remoteEvictor, _evictor);
}
else
{
Test::AccountI* account = dynamic_cast<Test::AccountI*>(servant.get());
test(account != 0);
account->init(Freeze::TransactionalEvictorPtr::dynamicCast(_evictor));
}
}
示例2:
ObjectPtr<> deserialize_object(const ArchiveNode& node, IUniverse& universe) {
if (!node.is_map()) {
std::cerr << "Expected object, got non-map.\n";
return nullptr;
}
std::string error;
const DerivedType* type = get_type_from_map(node, error);
if (type == nullptr) {
std::cerr << "ERROR: " << error << '\n';
return nullptr;
}
std::string id;
if (!node["id"].get(id)) {
std::cerr << "WARNING: Object without id.\n";
}
ObjectPtr<> ptr = universe.create_object(type, id);
if (ptr->object_id() != id) {
std::cerr << "WARNING: Object '" << id << "' was renamed to '" << ptr->object_id() << "' because of a collision.\n";
}
type->deserialize(reinterpret_cast<byte*>(ptr.get()), node, universe);
return ptr;
}
示例3: readObject
ConstObjectPtr LiveScene::readObject( double time ) const
{
tbb::mutex::scoped_lock l( s_mutex );
if( m_dagPath.length() == 0 && !m_isRoot )
{
throw Exception( "IECoreMaya::LiveScene::readObject: Dag path no longer exists!" );
}
if( fabs( MAnimControl::currentTime().as( MTime::kSeconds ) - time ) > 1.e-4 )
{
throw Exception( "IECoreMaya::LiveScene::readObject: time must be the same as on the maya timeline!" );
}
for ( std::vector< CustomReader >::const_reverse_iterator it = customObjectReaders().rbegin(); it != customObjectReaders().rend(); it++ )
{
if ( it->m_has( m_dagPath ) )
{
return it->m_read( m_dagPath );
}
}
// if no custom object was detected, we try the general cortex converter
unsigned int childCount = 0;
m_dagPath.numberOfShapesDirectlyBelow(childCount);
for ( unsigned int c = 0; c < childCount; c++ )
{
MDagPath childDag = m_dagPath;
if( childDag.extendToShapeDirectlyBelow( c ) )
{
MFnDagNode fnChildDag(childDag);
if ( fnChildDag.isIntermediateObject() )
{
continue;
}
FromMayaShapeConverterPtr shapeConverter = FromMayaShapeConverter::create( childDag );
if( shapeConverter )
{
return shapeConverter->convert();
}
FromMayaDagNodeConverterPtr dagConverter = FromMayaDagNodeConverter::create( childDag );
if( dagConverter )
{
ObjectPtr result = dagConverter->convert();
Camera *cam = runTimeCast< Camera >( result.get() );
if( cam )
{
// Cameras still carry the transform when converted from maya,
// so we have to remove them after conversion.
cam->setTransform( new MatrixTransform( Imath::M44f() ) );
}
return result;
}
}
}
return IECore::NullObject::defaultNullObject();
}
示例4: doOperation
ObjectPtr ModifyOp::doOperation( const CompoundObject *operands )
{
ObjectPtr object = m_inputParameter->getValue();
if( m_copyParameter->getTypedValue() )
{
object = object->copy();
}
if( m_enableParameter->getTypedValue() )
{
modify( object.get(), operands );
}
return object;
}
示例5: Indicator
void
AddLightObjectPlugin::onAddObject(const ObjectPtr& object)
{
Ogre::String type = object->getType();
// 判断,如果是能处理的类型(LightObject),就处理
if ( type == "Light" )
{
LightObject *lightObject = static_cast<LightObject *> (object.get());
Indicator *indicator = new Indicator(object,mSceneManipulator->getSceneManager(),
mSceneManipulator );
std::pair<Indicators::iterator, bool> inserted =
mIndicators.insert(Indicators::value_type(object, indicator));
assert(inserted.second);
}
}
示例6: addObject
void Scene::addObject(ObjectPtr pObject) {
SIACheckRet(!pObject.get());
SIAAssert(m_pGameLayer);
auto pEntity = pObject->entity();
SIAAssert(pEntity);
m_modelController.addCommand(std::make_shared<Commands::AddEntity>(pEntity),
[pObject, this] () {
auto pView = pObject->view();
SIAAssert(pView);
m_pGameLayer->addGameView(pView);
m_pObjects.push_back(pObject);
SIADebug("Added object on scene.");
}, nullptr);
}
示例7: OnContextMenu
void SceneBrowser::OnContextMenu( ObjectPtr &object, wxTreeEvent& event )
{
const Ogre::String &type = object->getType();
if ( type == "Actor" )
{
ActorAnimationSettingDialog *dlg = new ActorAnimationSettingDialog(this, wxID_ANY,
_("ActorAnimationSetting Dialog"), object, mSceneManipulator, event.GetPoint());
int result = dlg->Show(true);
//if (result == wxID_CANCEL)
//{
// // 如果异常列表中仍有内容,就给出提示
// if (dlg->mListBox->GetCount() > 0)
// {
// wxMessageBox(_("Thera are still some wrongs in scene,remember to fix them!"));
// }
// else
// {
// wxMessageBox(_("All wrongs in scene have been fixed,remember to save the scene!"));
// }
//}
}
else if ( type == "Effect" )
{
Fairy::Effect *effect = static_cast<Fairy::EffectObject *>(object.get())->getEffect();
if ( effect )
{
if ( NULL == mEffectDialog )
{
mEffectDialog = new WXEffectEditDialog(this, wxID_ANY, _("Effect Setting"));
}
if ( false == mEffectDialog->IsShown() )
mEffectDialog->Show();
mEffectDialog->InitEffectDialog(effect, mSceneManipulator);
}
}
mSceneManipulator->setActiveAction(NULL);
}
示例8: NoObjectFactoryException
void
throwUOE(const string& expectedType, const ObjectPtr& v)
{
//
// If the object is an unknown sliced object, we didn't find an
// object factory, in this case raise a NoObjectFactoryException
// instead.
//
UnknownSlicedObject* uso = dynamic_cast<UnknownSlicedObject*>(v.get());
if(uso)
{
throw NoObjectFactoryException(__FILE__, __LINE__, "", uso->getUnknownTypeId());
}
string type = v->ice_id();
throw Ice::UnexpectedObjectException(__FILE__, __LINE__,
"expected element of type `" + expectedType + "' but received '" +
type, type, expectedType);
}
示例9: eraseObject
void Scene::eraseObject(ObjectPtr pObject) {
SIACheckRet(!pObject);
SIAAssert(m_pGameLayer);
auto pEntity = pObject->entity();
SIAAssert(pEntity);
m_modelController.addCommand(std::make_shared<Commands::EraseEntity>(pEntity),
[pObject, this] () {
auto pView = pObject->view();
SIAAssert(pView);
m_pGameLayer->eraseGameView(pView);
m_pObjects.erase(std::remove_if(m_pObjects.begin(), m_pObjects.end(), [&pObject] (ObjectPtr& pObj) {
return pObject.get() == pObj.get();
}), m_pObjects.end());
SIADebug("Removed object from scene.");
}, nullptr);
}
示例10: tequals
Bool Object::tequals(ObjectPtr other) const
{
return this->tequals(other.get());
}
示例11: run
// >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
bool AmpTool::run() {
if ( !_originID.empty() ) {
OriginPtr org = Origin::Cast(query()->getObject(Origin::TypeInfo(), _originID));
if ( !org ) {
cerr << "Origin not found!" << endl;
return false;
}
_fetchMissingAmplitudes = false;
query()->loadArrivals(org.get());
process(org.get());
return true;
}
if ( !_strTimeWindowStartTime.empty() || !_strTimeWindowEndTime.empty() ) {
if ( database() == NULL ) {
cerr << "No database currently active for time window reprocessing" << endl;
return false;
}
Core::Time startTime, endTime;
if ( !_strTimeWindowStartTime.empty()
&& !startTime.fromString(_strTimeWindowStartTime.c_str(), "%F %T") ) {
cerr << "Invalid start time: " << _strTimeWindowStartTime << endl;
return false;
}
if ( !_strTimeWindowEndTime.empty()
&& !endTime.fromString(_strTimeWindowEndTime.c_str(), "%F %T") ) {
cerr << "Invalid end time: " << _strTimeWindowEndTime << endl;
return false;
}
std::string dbQuery;
dbQuery += "select PPick." + _T("publicID") + ", Pick.* from Pick,PublicObject as PPick,Amplitude "
"where Pick._oid=PPick._oid and Amplitude." + _T("pickID") + "=PPick." + _T("publicID");
if ( startTime.valid() )
dbQuery += " and Pick." + _T("time_value") + ">='" + startTime.toString("%F %T") + "'";
if ( endTime.valid() )
dbQuery += " and Pick." + _T("time_value") + "<'" + endTime.toString("%F %T") + "'";
dbQuery += " group by Amplitude." + _T("pickID");
if ( !commandline().hasOption("commit") )
_testMode = true;
EventParametersPtr ep;
if ( _testMode )
ep = new EventParameters;
typedef list<PickPtr> PickList;
PickList picks;
cerr << "Collecting picks ... " << flush;
DatabaseIterator db_it = query()->getObjectIterator(dbQuery, Pick::TypeInfo());
ObjectPtr obj;
while ( obj = db_it.get() ) {
Pick *pick = static_cast<Pick*>(obj.get());
try {
pick->waveformID().networkCode();
pick->waveformID().stationCode();
pick->waveformID().locationCode();
pick->waveformID().channelCode();
pick->time().value();
}
catch ( ... ) {
continue;
}
++db_it;
picks.push_back(pick);
if ( ep ) ep->add(pick);
}
db_it.close();
cerr << picks.size() << endl;
_report << std::endl;
_report << "Reprocessing report" << std::endl;
_report << "-------------------" << std::endl;
_report << " + Picks" << std::endl;
int errors = 0;
int ampsRecomputed = 0;
int messagesSent = 0;
int idx = 1;
for ( PickList::iterator it = picks.begin(); it != picks.end(); ++it, ++idx ) {
PickPtr pick = *it;
SingleAmplitudeMap dbAmps;
if ( isExitRequested() ) break;
//.........这里部分代码省略.........
示例12: setValidatedValue
void Parameter::setValidatedValue( ObjectPtr value )
{
validate( value.get() );
setValue( value );
}
示例13: style_ctxt
qlib::LScrSp<qlib::LScrObjBase> SceneXMLReader::fromByteArray(const qlib::LScrSp<qlib::LByteArray> &pbuf)
{
qlib::uid_t nSceneID = m_pClient->getUID();
// Enter the context
AutoStyleCtxt style_ctxt(nSceneID);
MB_DPRINTLN("fromXML\n%s<<<", pbuf->data());
MB_DPRINTLN("Length: %d", pbuf->size());
//
// Setup streams
//
qlib::StrInStream fis(pbuf);
qlib::LDom2InStream ois(fis);
qlib::LDom2Tree tree;
ois.read(tree);
qlib::LDom2Node *pNode = tree.top();
//pNode->dump();
qlib::LScrSp<qlib::LScrObjBase> pSObj;
LString tag = pNode->getTagName();
LString type_name = pNode->getTypeName();
if (tag.equals("renderer") && !type_name.isEmpty()) {
// pbuf contains Renderer
RendererFactory *pRF = RendererFactory::getInstance();
RendererPtr pRend = pRF->create(type_name);
pRend->resetAllProps();
pRend->readFrom2(pNode);
pSObj = pRend;
}
else if (tag.equals("object") && !type_name.isEmpty()) {
ObjectPtr pObj = pNode->createObjByTypeNameT<Object>();
pObj->readFrom2(pNode);
LString src = pObj->getSource();
LString altsrc = pObj->getAltSource();
LString srctype = pObj->getSourceType();
pNode->requestDataLoad(src, altsrc, srctype, pObj.get());
pSObj = pObj;
// clearChunkMap();
procDataSrcLoad(ois, pNode);
procDataChunks(ois, pNode);
// clearChunkMap();
}
else if (tag.equals("camera")) {
// pbuf contains Camera
CameraPtr pCam(MB_NEW Camera);
pCam->readFrom2(pNode);
pSObj = pCam;
}
else {
MB_DPRINTLN("readRendFromXML> ERROR, Invalid QSC XML");
return pSObj;
}
return pSObj;
}
示例14: sync
//.........这里部分代码省略.........
break;
}
case destroyed:
{
size_t index = streamedObjectQueue.size();
streamedObjectQueue.resize(index + 1);
streamedObjectQueue[index] = new StreamedObject;
stream(element, streamStart, streamedObjectQueue[index]);
element->status = dead;
deadObjects.push_back(element);
break;
}
case dead:
{
deadObjects.push_back(element);
break;
}
default:
{
//
// Nothing to do (could be a duplicate)
//
break;
}
}
if(servant == 0)
{
lockElement.release();
}
else
{
IceUtil::AbstractMutex* mutex = dynamic_cast<IceUtil::AbstractMutex*>(servant.get());
if(mutex != 0)
{
//
// Lock servant and then element so that user can safely lock
// servant and call various Evictor operations
//
IceUtil::AbstractMutex::TryLock lockServant(*mutex);
if(!lockServant.acquired())
{
lockElement.release();
IceUtil::TimerTaskPtr watchDogTask;
if(_timer)
{
watchDogTask = new WatchDogTask(*this);
_timer->schedule(watchDogTask, IceUtil::Time::milliSeconds(_streamTimeout));
}
lockServant.acquire();
if(watchDogTask)
{
_timer->cancel(watchDogTask);
watchDogTask = 0;
}
lockElement.acquire();
status = element->status;
}
switch(status)
{
case created:
示例15: Indicator
void
AddParticleSystemObjectPlugin::onAddObject(const ObjectPtr& object)
{
Ogre::String type = object->getType();
// 判断,如果是能处理的类型(ParticleSystemObject),就处理
if ( type == "ParticleSystem" )
{
ParticleSystemObject *particleSystemObject = static_cast<ParticleSystemObject *> (object.get());
Indicator *indicator = new Indicator(object, mSceneManipulator);
std::pair<Indicators::iterator, bool> inserted =
mIndicators.insert(Indicators::value_type(object, indicator));
assert(inserted.second);
}
}