本文整理汇总了C++中PNode类的典型用法代码示例。如果您正苦于以下问题:C++ PNode类的具体用法?C++ PNode怎么用?C++ PNode使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了PNode类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: CHECK_ASSERT
void Node::AddChild(PNode node)
{
CHECK_ASSERT(node && node.get() != this);
children_.push_back(node);
childrenHash_.insert(std::make_pair(node->name_, node));
PNode thisNode = SharedFromPointerNode(this);
node->parent_ = thisNode;
PScene scene = scene_.lock();
if (!scene) scene = std::dynamic_pointer_cast<Scene>(thisNode);
node->scene_ = scene;
if (scene)
{
PLight light = std::dynamic_pointer_cast<Light>(node);
if (light)
scene->AddLight(light.get());
else
{
PCamera camera = std::dynamic_pointer_cast<Camera>(node);
if (camera) scene->AddCamera(camera.get());
else
{
auto ps = std::dynamic_pointer_cast<ParticleSystem>(node);
if (ps) scene->AddParticleSystem(ps.get());
}
}
}
node->MarkAsDirty();
}
示例2: RunNode
int Node :: RunNode(const Options & oOptions, Node *& poNode)
{
if (oOptions.bIsLargeValueMode)
{
InsideOptions::Instance()->SetAsLargeBufferMode();
}
poNode = nullptr;
NetWork * poNetWork = nullptr;
Breakpoint::m_poBreakpoint = nullptr;
BP->SetInstance(oOptions.poBreakpoint);
PNode * poRealNode = new PNode();
int ret = poRealNode->Init(oOptions, poNetWork);
if (ret != 0)
{
return ret;
}
//step1 set node to network
//very important, let network on recieve callback can work.
poNetWork->m_poNode = poRealNode;
//step2 run network.
//start recieve message from network, so all must init before this step.
//must be the last step.
poNetWork->RunNetWork();
poNode = poRealNode;
return 0;
}
示例3: ni
void PScene::render(PRenderState *renderState)
{
// Update the world transform of each node in the scene.
PNode::iterator ni(m_root);
PNode *node = *ni;
while (node != P_NULL)
{
// Update the transformation of each node.
node->updateWorldTransform();
// Update the bounding box in the world space.
node->updateBBox();
// Call customized update routing of each node.
node->update();
node = *(++ni);
}
// Do the rendering.
m_renderer->render(renderState);
// Apply the post processing effects to the scene.
PList<PAbstractEffect *>::iterator it = m_effects.begin();
PList<PAbstractEffect *>::iterator ie = m_effects.end();
while (it != ie)
{
(*it)->render(renderState);
++it;
}
}
示例4: new
PNode* SLRParser::reduceRepeatstmt(std::stack<stackElement>& parsing_stack)
{
stackElement e = parsing_stack.top();
PNode* res = Services::memory->alloc<PNode>();
new (res) PNode();
res->Tag = "Repeatstmt";
//Exp
auto q_exp = parsing_stack.top().node;
//res->addChild(parsing_stack.top().node);
parsing_stack.pop();
//UNTIL
reduceMatch(parsing_stack);
//res->addChild(reduceMatch(parsing_stack));
//StSeq
auto q_stseq = parsing_stack.top().node;
//res->addChild(parsing_stack.top().node);
parsing_stack.pop();
//REPEAT
reduceMatch(parsing_stack);
//res->addChild(reduceMatch(parsing_stack));
res->addChild(q_stseq);
res->addChild(q_exp);
return res;
}
示例5: Update
void Node::Update() const
{
if (!dirty_ || hide_)
return;
dirty_ = false;
PNode parent = parent_.lock();
if (parent)
{
globalModel_ = parent->GetGlobalModelMatrix() * GetTransform();
globalPosition_ = Translation(globalModel_);
globalOrientation_ = parent->GetGlobalOrientation() * q_;
globalScale_ = Scale(globalModel_);
}
else
{
globalModel_ = GetTransform();
globalPosition_ = position_;
globalOrientation_ = q_;
globalScale_ = scale_;
}
isScaleUniform_ = NSG::IsScaleUniform(globalScale_);
globalModelInv_ = Inverse(globalModel_);
globalModelInvTransp_ = Transpose(Inverse(Matrix3(globalModel_)));
lookAtDirection_ = globalOrientation_ * VECTOR3_LOOKAT_DIRECTION;
upDirection_ = globalOrientation_ * VECTOR3_UP;
signalUpdated_->Run();
}
示例6: while
void Node::RemoveChild(Node* node)
{
int idx = 0;
for (auto& child : children_)
{
if (child.get() == node)
{
children_.erase(children_.begin() + idx);
auto range = childrenHash_.equal_range(node->name_);
auto it = range.first;
while (it != range.second)
{
PNode child = it->second.lock();
if (!child)
it = childrenHash_.erase(it);
else if (child.get() == node)
it = childrenHash_.erase(it);
else
++it;
}
break;
}
++idx;
}
}
示例7: reduceID
PNode* SLRParser::reduceReadstmt(std::stack<stackElement>& parsing_stack)
{
PNode* id = reduceID(parsing_stack);
PNode* res = Services::memory->alloc<PNode>();
new (res) PNode();
res->Tag = "read-stmt";
res->addChild(id);
parsing_stack.pop();
return res;
}
示例8: WalkTree
//----<DFS nodes of the tree for test>--
void WalkTree(PNode<std::string >* pPNode)
{
pPNode->clearMarks();
std::cout <<"\n "<<pPNode->value();
PNode<std::string >* pTemp;
while (pTemp = pPNode->nextUnmarkedChild())
{
pTemp->setMarkState(true);
WalkTree(pTemp);
}
}
示例9: Remove
bool DataList::Remove(PNode node)
{
if (!node.Ok())
return false;
if (nodes.erase(BA::to_lower_copy(node->Name())) <= 0)
return false;
node->parent = NULL;
node->ListRemove();
return true;
}
示例10: Insert
bool DataList::Insert(PNode node) /// return false if such entry already exists.
{
if (!node.Ok())
return false;
bool inserted = nodes.insert(std::pair<std::string, PNode>(BA::to_lower_copy(node->name), node)).second;
if (!inserted)
return false;
node->parent = this;
node->ListInsertAfter(list_loop.list_prev);
return true;
}
示例11: Find
bool DataList::Remove(const std::string& str)
{
//PNode node=nodes.find(str.Lower())->last;
PNode node = Find(str);
if (!node.Ok())
return false;
if (nodes.erase(BA::to_lower_copy(str)) <= 0)
return false;
node->parent = NULL;
node->ListRemove();
return true;
}
示例12: SetGlobalOrientation
void Node::SetGlobalOrientation(const Quaternion& q)
{
PNode parent = parent_.lock();
if (parent == nullptr)
{
SetOrientation(q);
}
else
{
SetOrientation(Normalize(Quaternion(parent->GetGlobalModelInvMatrix()) * q));
}
}
示例13: SetGlobalPosition
void Node::SetGlobalPosition(const Vertex3& position)
{
PNode parent = parent_.lock();
if (parent == nullptr)
{
SetPosition(position);
}
else
{
SetPosition(Vertex3(parent->GetGlobalModelInvMatrix() * Vertex4(position, 1)));
}
}
示例14: dbResultToJsonObject
LightSpeed::JSON::PNode dbResultToJsonObject(
LightSpeed::JSON::IFactory& factory, LightMySQL::Row& row, bool strDate) {
using namespace LightSpeed::JSON;
using namespace LightSpeed;
PNode obj = factory.newClass();
natural c = row.size();
for (natural i = 0; i < c; i++) {
const MYSQL_FIELD *fld = row.getResultObject().getFieldInfo(i);
ConstStrA name(fld->name,fld->name_length);
PNode nd = nil;
if (row[i].isNull()) {
nd = factory.newNullNode();
} else {
switch (fld->type) {
case MYSQL_TYPE_TINY:
case MYSQL_TYPE_SHORT:
case MYSQL_TYPE_LONG:
case MYSQL_TYPE_LONGLONG:
case MYSQL_TYPE_INT24: nd = factory.newValue(row[i].as<integer>());break;
case MYSQL_TYPE_TIMESTAMP:
case MYSQL_TYPE_DATE:
case MYSQL_TYPE_TIME:
case MYSQL_TYPE_DATETIME:
case MYSQL_TYPE_NEWDATE: nd = parseDateTime(factory,row[i].as<ConstStrA>(),strDate);break;
case MYSQL_TYPE_FLOAT:
case MYSQL_TYPE_DOUBLE: nd = factory.newValue(row[i].as<double>());break;
/* case MYSQL_TYPE_TINY_BLOB:
case MYSQL_TYPE_MEDIUM_BLOB:
case MYSQL_TYPE_LONG_BLOB:
case MYSQL_TYPE_BLOB:nd = factory.newValue(base64_encode(row[i].as<ConstStrA>()));
break;*/
case MYSQL_TYPE_SET: nd = createArrayFromSet(factory,row[i].as<ConstStrA>());break;
default: nd = factory.newValue(row[i].as<ConstStrA>());
break;
}
}
obj->add(name,nd);
}
return obj;
}
示例15: InsertAt
bool DataList::InsertAt(PNode node, PNode where) /// return false if such entry already exists.
{
if (!node.Ok())
return false;
if (!(where->list_prev))
return false;
bool inserted = nodes.insert(std::pair<std::string, PNode>((*node).name, node)).second;
if (!inserted)
return false;
node->parent = this;
node->ListInsertAfter(where->list_prev);
return true;
}