本文整理汇总了C++中ObjectPtr类的典型用法代码示例。如果您正苦于以下问题:C++ ObjectPtr类的具体用法?C++ ObjectPtr怎么用?C++ ObjectPtr使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了ObjectPtr类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: convertObject
static ObjectPtr convertObject(ObjectPtr x) {
switch (x->objKind) {
case RECORD : {
Record *y = (Record *)x.ptr();
if (y->params.empty() && !y->varParam.ptr())
return recordType(y, vector<ObjectPtr>()).ptr();
return x;
}
case VARIANT : {
Variant *y = (Variant *)x.ptr();
if (y->params.empty() && !y->varParam.ptr())
return variantType(y, vector<ObjectPtr>()).ptr();
return x;
}
default :
return x;
}
}
示例2: addObject
//-----------------------------------------------------------------------
void Scene::addObject(const ObjectPtr& object)
{
if (!mObjects.get<by_identity>().insert(object).second)
{
OGRE_EXCEPT(Ogre::Exception::ERR_DUPLICATE_ITEM,
"The given object with name '" + object->getName() + "' already contain by this scene",
"Scene::addObject");
}
}
示例3: 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);
}
}
示例4: removeObject
//-----------------------------------------------------------------------
void Scene::removeObject(const ObjectPtr& object)
{
if (mObjects.get<by_identity>().erase(object) <= 0)
{
OGRE_EXCEPT(Ogre::Exception::ERR_ITEM_NOT_FOUND,
"The given object with name '" + object->getName() + "' doesn't contain by this scene",
"Scene::removeObject");
}
}
示例5: TEST
TEST(ObjectTests, NilObject)
{
ObjectPtr object = createObject();
ASSERT_EQ(Object::NIL, object->getNativeType());
ASSERT_TRUE(object->isNil());
ASSERT_EQ(false, object->getBoolean());
ASSERT_EQ(0.f, object->getNumber());
ASSERT_TRUE(object->getString().empty());
ASSERT_EQ(0, object->getUserdata());
ASSERT_STREQ("nil", object->getReadableString().c_str());
}
示例6: 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);
}
示例7: material_
DX11DeferredRendererMaterial::DX11DeferredRendererMaterial(const ObjectPtr<DX11Material>& base_material) :
material_(base_material->Instantiate()){
auto& resources = DX11Graphics::GetInstance().GetResources();
shader_parameters_ = resources.Load<IStructuredBuffer, IStructuredBuffer::FromSize>({ sizeof(ShaderParameters) });
material_->SetInput(kShaderParameters, ObjectPtr<IStructuredBuffer>(shader_parameters_));
}
示例8: insert
void ObjectSet::insert(ObjectPtr object)
{
std::pair<ObjectSet::SetType::iterator, bool> result =
objects.insert(object);
if (result.second)
{
objectMap[object->getId()] = result.first;
}
}
示例9: guard
IException* User::Channel::SendAndReceive(TypeInfo::MethodAttributes_t attribs, Remoting::IMessage* pSend, Remoting::IMessage*& pRecv)
{
// Get the object manager
OOBase::Guard<OOBase::SpinLock> guard(m_lock);
ObjectPtr<Remoting::IMarshaller> ptrMarshaller = m_ptrMarshaller;
if (!ptrMarshaller)
throw Remoting::IChannelClosedException::Create(OMEGA_CREATE_INTERNAL("SendAndReceive() called on disconnected channel"));
guard.release();
// We need to wrap the message
ObjectPtr<ObjectImpl<OOCore::CDRMessage> > ptrEnvelope = ObjectImpl<OOCore::CDRMessage>::CreateObject();
ptrMarshaller->MarshalInterface(string_t::constant("payload"),ptrEnvelope,OMEGA_GUIDOF(Remoting::IMessage),pSend);
OOBase::CDRStream response;
try
{
OOServer::MessageHandler::io_result::type res = Manager::instance()->send_request(m_channel_id,ptrEnvelope->GetCDRStream(),&response,attribs);
if (res != OOServer::MessageHandler::io_result::success)
{
if (res == OOServer::MessageHandler::io_result::channel_closed)
{
disconnect();
throw Omega::Remoting::IChannelClosedException::Create(OMEGA_CREATE_INTERNAL("Failed to send request"));
}
disconnect();
OMEGA_THROW("Internal server exception");
}
}
catch (...)
{
ptrMarshaller->ReleaseMarshalData(string_t::constant("payload"),ptrEnvelope,OMEGA_GUIDOF(Remoting::IMessage),pSend);
throw;
}
if (!(attribs & TypeInfo::Asynchronous))
{
try
{
// Wrap the response
ObjectPtr<ObjectImpl<OOCore::CDRMessage> > ptrRecv = ObjectImpl<OOCore::CDRMessage>::CreateObject();
ptrRecv->init(response);
// Unwrap the payload...
IObject* pObj = NULL;
ptrMarshaller->UnmarshalInterface(string_t::constant("payload"),ptrRecv,OMEGA_GUIDOF(Remoting::IMessage),pObj);
pRecv = static_cast<Remoting::IMessage*>(pObj);
}
catch (IException* pE)
{
return pE;
}
}
return NULL;
}
示例10: printStaticName
void printStaticName(llvm::raw_ostream &out, ObjectPtr x)
{
if (x->objKind == IDENTIFIER) {
Identifier *y = (Identifier *)x.ptr();
out << y->str;
}
else {
printName(out, x);
}
}
示例11: Inside_Object
bool Inside_Object (const Vector3d& IPoint, ObjectPtr Object, TraceThreadData *Thread)
{
for (vector<ObjectPtr>::iterator Sib = Object->Clip.begin(); Sib != Object->Clip.end(); Sib++)
{
if(!Inside_Object(IPoint, *Sib, Thread))
return false;
}
return (Object->Inside(IPoint, Thread));
}
示例12: configureTab
void HistogramDialog::configureTab(ObjectPtr object) {
if (!object) {
_histogramTab->setRealTimeAutoBin(dialogDefaults().value("histogram/realTimeAutoBin", false).toBool());
_histogramTab->setNormalizationType(Histogram::NormalizationType(dialogDefaults().value("histogram/normalizationType",Histogram::Number).toInt()));
} else if (HistogramPtr histogram = kst_cast<Histogram>(object)) {
_histogramTab->setVector(histogram->vector());
_histogramTab->setMin(histogram->xMin());
_histogramTab->setMax(histogram->xMax());
_histogramTab->setBins(histogram->numberOfBins());
_histogramTab->setRealTimeAutoBin(histogram->realTimeAutoBin());
_histogramTab->setNormalizationType(histogram->normalizationType());
_histogramTab->hideCurveOptions();
if (_editMultipleWidget) {
HistogramList objects = _document->objectStore()->getObjects<Histogram>();
_editMultipleWidget->clearObjects();
foreach(HistogramPtr object, objects) {
_editMultipleWidget->addObject(object->Name(), object->descriptionTip());
}
}
示例13: SetAgent
void Player::SetAgent( sf::Uint16 id ) {
m_tentative_agent_id = id;
ObjectPtr object = Game::GetGame()->GetObjectManager()->GetObjectById( id );
if( !object ) {
return;
}
if( object->GetType() != ObjectType::SHIP ) {
return;
}
ShipPtr agent = std::static_pointer_cast<Ship>( Game::GetGame()->GetObjectManager()->GetObjectById( id ) );
agent->SetPlayer( true );
LogConsole( "Set player ship to object: " + string_cast( id ) );
m_tentative_agent_id = 0xffff;
m_agent = agent;
}
示例14: DeserializeInstance
void ArchiveBinary::DeserializeInstance(ObjectPtr& object)
{
//
// If we don't have an object allocated for deserialization, pull one from the stream
//
if (!object.ReferencesObject())
{
object = Allocate();
}
//
// We should now have an instance (unless data was skipped)
//
if (object.ReferencesObject())
{
#ifdef REFLECT_ARCHIVE_VERBOSE
m_Indent.Get(stdout);
Log::Print(TXT("Deserializing %s\n"), object->GetClass()->m_Name);
m_Indent.Push();
#endif
object->PreDeserialize( NULL );
Data* data = SafeCast<Data>(object);
if ( data )
{
data->Deserialize(*this);
}
else
{
DeserializeFields(object);
}
object->PostDeserialize( NULL );
#ifdef REFLECT_ARCHIVE_VERBOSE
m_Indent.Pop();
#endif
}
}
示例15: throwUOE
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);
}