本文整理汇总了C++中GroupPtr类的典型用法代码示例。如果您正苦于以下问题:C++ GroupPtr类的具体用法?C++ GroupPtr怎么用?C++ GroupPtr使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了GroupPtr类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: assert
ObjectPtr CurveExtrudeOp::doOperation( const CompoundObject * operands )
{
CurvesPrimitive * curves = m_curvesParameter->getTypedValue<CurvesPrimitive>();
assert( curves );
assert( curves->arePrimitiveVariablesValid() );
GroupPtr group = new Group();
const IntVectorData * verticesPerCurve = curves->verticesPerCurve();
assert( verticesPerCurve );
unsigned numCurves = verticesPerCurve->readable().size();
unsigned vertexOffset = 0;
unsigned varyingOffset = 0;
for ( unsigned curveIndex = 0; curveIndex < numCurves; curveIndex++ )
{
int numVertices = curves->variableSize( PrimitiveVariable::Vertex, curveIndex );
PatchMeshPrimitivePtr patchMesh = buildPatchMesh( curves, curveIndex, vertexOffset, varyingOffset );
assert( patchMesh );
group->addChild( patchMesh );
vertexOffset += numVertices;
varyingOffset += curves->variableSize( PrimitiveVariable::Varying, curveIndex );
}
assert( group->children().size() == numCurves );
return group;
}
示例2: GetServer
/**
@brief ReqToBindInnerPort
*/
bool CFarmServer::ReqToBindInnerPort(farm::ReqToBindInnerPort_Packet &packet)
{
GroupPtr pGroup = GetServer()->GetRootGroup().GetChildFromPlayer( packet.senderId );
if (!pGroup)
{// Error!!
clog::Error( log::ERROR_PROBLEM, "ReqToBindInnerPort Error!!, not exist group user id = %d\n", packet.senderId );
m_Protocol.AckToBindOuterPort( packet.senderId, SEND_T, error::ERR_NOT_FOUND_GROUP, packet.bindSubServerSvrType, 0);
return false;
}
SubServerGroupPtr pSubSvrGroup = dynamic_cast<CSubServerGroup*>(pGroup.Get());
if (!pSubSvrGroup)
{// Error!!
clog::Error( log::ERROR_PROBLEM, "ReqToBindInnerPort Error!!, not convert group user id = %d\n", packet.senderId );
m_Protocol.AckToBindOuterPort( packet.senderId, SEND_T, error::ERR_NOT_FOUND_GROUP, packet.bindSubServerSvrType, 0);
return false;
}
const int bindPort = pSubSvrGroup->GetToBindInnerPort( CServerSessionAccess(GetServer()) );
RemoteSubServerPtr pSubServer = dynamic_cast<CRemoteSubServer*>(
GetServer()->GetSession(packet.senderId));
if (!pSubServer)
{// Error!!
clog::Error( log::ERROR_PROBLEM, "ReqToBindInnerPort Error!!, not found user user id = %d\n", packet.senderId );
m_Protocol.AckToBindOuterPort( packet.senderId, SEND_T, error::ERR_NOT_FOUND_USER, packet.bindSubServerSvrType, 0);
return false;
}
pSubServer->SetInnerBindPort( packet.bindSubServerSvrType, bindPort );
m_Protocol.AckToBindInnerPort( packet.senderId, SEND_T, error::ERR_SUCCESS, packet.bindSubServerSvrType, bindPort );
return true;
}
示例3: update
void ViewportViewer::update()
{
auto widget = dynamic_cast<ViewportWidget*>(getWidget());
auto *viewport = widget->getViewport();
Property data = dataCache.getOutput(getStart());
Property settings = settingsCache.getOutput(_settingsNode->getOutSockets()[0]);
PropertyMap properties = settings.getData<PropertyMap>();
GroupPtr grp;
if(data.getType() == "GROUPDATA") {
grp = data.getData<GroupPtr>();
}
else if(data.getType() == "TRANSFORMABLE") {
auto obj = data.getData<AbstractTransformablePtr>();
assert(obj);
grp = std::make_shared<Group>();
grp->addMember(obj);
}
else {
return;
}
for(auto prop : properties) {
viewport->setOption(prop.first, prop.second);
grp->setProperty(prop.first, prop.second);
}
viewport->setData(grp);
widget->setCameras();
}
示例4: group
bool StandardContactList::addGroup(const GroupPtr& newGroup)
{
GroupPtr g = group(newGroup->id());
if(g)
return false;
m_groups.insert(newGroup->id(), newGroup);
return true;
}
示例5: GetChild
//------------------------------------------------------------------------
// delete CGroup Object memory
//------------------------------------------------------------------------
bool CGroup::RemoveChild( netid groupId )
{
GroupPtr pGroup = GetChild(groupId);
if (!pGroup) return false; // not exist
// remove group member
BOOST_FOREACH(auto playerId, m_Players)
{
RemovePlayerNApplyParent(pGroup->GetParent(), playerId);
}
示例6: pointRays
void StandardLightVisualiser::addBasicLightVisualiser( ConstStringDataPtr type, GroupPtr &output, Color3f multiplier, float coneAngle, float penumbraAngle, const std::string *penumbraType, float lensRadius )
{
bool indicatorFaceCamera = false;
if( !type || type->readable() == "point" )
{
output->addChild( const_pointer_cast<IECoreGL::Renderable>( pointRays() ) );
indicatorFaceCamera = true;
}
else if( type->readable() == "spot" )
{
float innerAngle = 0;
float outerAngle = 0;
if( !penumbraType || *penumbraType == "inset" )
{
outerAngle = coneAngle;
innerAngle = coneAngle - 2.0f * penumbraAngle;
}
else if( *penumbraType == "outset" )
{
outerAngle = coneAngle + 2.0f * penumbraAngle;
innerAngle = coneAngle ;
}
else if( *penumbraType == "absolute" )
{
outerAngle = coneAngle;
innerAngle = penumbraAngle;
}
output->addChild( const_pointer_cast<IECoreGL::Renderable>( spotlightCone( innerAngle, outerAngle, lensRadius ) ) );
output->addChild( const_pointer_cast<IECoreGL::Renderable>( ray() ) );
}
else if( type->readable() == "distant" )
{
for ( int i = 0; i < 3; i++ )
{
IECoreGL::GroupPtr rayGroup = new IECoreGL::Group();
Imath::M44f trans;
trans.rotate( V3f( 0, 0, 2.0 * M_PI / 3.0 * i ) );
trans.translate( V3f( 0, 0.4, 0.5 ) );
rayGroup->addChild( const_pointer_cast<IECoreGL::Renderable>( ray() ) );
rayGroup->setTransform( trans );
output->addChild( rayGroup );
}
}
output->addChild( const_pointer_cast<IECoreGL::Renderable>( colorIndicator( multiplier, indicatorFaceCamera ) ) );
}
示例7: createGroup
bool StandardContactList::load_groups(const QDomElement& groups)
{
QDomNodeList list = groups.elementsByTagName("group");
for(int i = 0; i < list.size(); i++)
{
QDomElement el = list.at(i).toElement();
int id = el.attribute("id").toInt();
GroupPtr gr = createGroup(id);
if(!gr->deserialize(el))
return false;
addGroup(gr);
}
return true;
}
示例8: InsertIfAbsent
bool GroupPool::InsertIfAbsent(const GroupPtr& ptr) {
WriteLocker locker(m_map_lock);
if (FindByName(ptr->GetGroupName()))
return false;
Insert(ptr);
return true;
}
示例9: addEnvLightVisualiser
void StandardLightVisualiser::addEnvLightVisualiser( GroupPtr &output, Color3f multiplier, const std::string &textureName )
{
IECoreGL::GroupPtr sphereGroup = new IECoreGL::Group();
Imath::M44f trans;
trans.scale( V3f( 1, 1, -1 ) );
trans.rotate( V3f( -0.5 * M_PI, -0.5 * M_PI, 0 ) );
sphereGroup->setTransform( trans );
IECoreGL::SpherePrimitivePtr sphere = new IECoreGL::SpherePrimitive();
sphereGroup->addChild( sphere );
IECore::CompoundObjectPtr parameters = new CompoundObject;
parameters->members()["lightMultiplier"] = new Color3fData( multiplier );
parameters->members()["previewOpacity"] = new FloatData( 1 );
parameters->members()["mapSampler"] = new StringData( textureName );
parameters->members()["defaultColor"] = new Color3fData( Color3f( textureName == "" ? 1.0f : 0.0f ) );
sphereGroup->getState()->add(
new IECoreGL::ShaderStateComponent( ShaderLoader::defaultShaderLoader(), TextureLoader::defaultTextureLoader(), IECoreGL::Shader::defaultVertexSource(), "", environmentLightDrawFragSource(), parameters )
);
sphereGroup->getState()->add(
new IECoreGL::DoubleSidedStateComponent( false )
);
output->addChild( sphereGroup );
}
示例10: addInstance
void ImmediateRendererImplementation::addInstance( GroupPtr grp )
{
bool visible = static_cast<CameraVisibilityStateComponent *>( getState( CameraVisibilityStateComponent::staticTypeId() ) )->value();
if( visible )
{
grp->render( m_stateStack.top().get() );
}
}
示例11: TransformOp
ConstObjectPtr SOP_SceneCacheSource::transformObject( const IECore::Object *object, const Imath::M44d &transform, bool &hasAnimatedTopology, bool &hasAnimatedPrimVars, std::vector<InternedString> &animatedPrimVars )
{
if ( const Primitive *primitive = IECore::runTimeCast<const Primitive>( object ) )
{
TransformOpPtr transformer = new TransformOp();
transformer->inputParameter()->setValue( const_cast<Primitive*>( primitive ) ); // safe because we set the copy parameter
transformer->copyParameter()->setTypedValue( true );
transformer->matrixParameter()->setValue( new M44dData( transform ) );
ObjectPtr result = transformer->operate();
std::vector<std::string> &primVars = transformer->primVarsParameter()->getTypedValue();
for ( std::vector<std::string>::iterator it = primVars.begin(); it != primVars.end(); ++it )
{
if ( std::find( animatedPrimVars.begin(), animatedPrimVars.end(), *it ) == animatedPrimVars.end() )
{
animatedPrimVars.push_back( *it );
hasAnimatedPrimVars = true;
}
}
return result;
}
else if ( const Group *group = IECore::runTimeCast<const Group>( object ) )
{
GroupPtr result = group->copy();
MatrixTransformPtr matTransform = matrixTransform( transform );
matTransform->matrix *= group->getTransform()->transform();
result->setTransform( matTransform );
return result;
}
else if ( const CoordinateSystem *coord = IECore::runTimeCast<const CoordinateSystem>( object ) )
{
CoordinateSystemPtr result = coord->copy();
MatrixTransformPtr matTransform = matrixTransform( transform );
matTransform->matrix *= coord->getTransform()->transform();
result->setTransform( matTransform );
return result;
}
return object;
}
示例12: assert
std::vector<GroupPtr> FileAuthSourceMapper::get_user_groups(Leosac::Auth::IUserPtr u)
{
assert(u);
std::vector<GroupPtr> grps;
auto lambda_cmp = [&](IUserPtr user) -> bool
{
return user->id() == u->id();
};
for (const auto &grp_map : groups_)
{
GroupPtr grp;
std::tie(std::ignore, grp) = grp_map;
if (std::find_if(grp->members().begin(),
grp->members().end(), lambda_cmp) != grp->members().end())
{
grps.push_back(grp);
}
}
return grps;
}
示例13: isGroupMember
//Item is member of group
bool AbstractGroupableItem::isGroupMember(const GroupPtr group) const
{
//kDebug();
if (!group) {
//kDebug() << "Null Group Pointer";
return false;
}
if (!parentGroup()) {
return false;
}
return group->members().contains(const_cast<AbstractGroupableItem*>(this));
}
示例14: WARN
void FileAuthSourceMapper::permission_group(const std::string &group_name,
const boost::property_tree::ptree &node)
{
GroupPtr group = groups_[group_name];
if (group && group->profile())
WARN("Already had some data for this group. Will override.");
else if (!group)
{
group = groups_[group_name] = GroupPtr(new Group(group_name));
}
SimpleAccessProfilePtr profile(new SimpleAccessProfile());
group->profile(profile);
for (const auto &schedule : node)
{
if (schedule.first == "default_schedule")
build_schedule(profile, schedule.second, true);
if (schedule.first == "schedule")
build_schedule(profile, schedule.second, false);
}
}
示例15: ConfigException
void FileAuthSourceMapper::membership_group(const boost::property_tree::ptree &group_mapping)
{
for (const auto &group_info : group_mapping)
{
const boost::property_tree::ptree &node = group_info.second;
const std::string &group_name = node.get<std::string>("group");
if (group_info.first != "map")
throw ConfigException(config_file_, "Invalid config file content");
GroupPtr grp = groups_[group_name] = GroupPtr(new Group(group_name));
for (const auto &membership : node)
{
if (membership.first != "user")
continue;
std::string user_name = membership.second.data();
IUserPtr user = users_[user_name];
if (!user)
user = users_[user_name] = IUserPtr(new IUser(user_name));
grp->member_add(user);
}
}
}