コード例 #1
0
std::string NamedHandleObjectWithState::GetName() const
{
  const std::string name(NamedHandleObject::GetName()); // Trigger a NDE, if necessary.

  const State::ConstPointer
      nameState(this->GetState(INamedHandleStateIds::NAME));
  if (nameState.IsNotNull())
  {
    const Object::ConstPointer value(nameState->GetValue());
    if (value.IsNotNull())
    {
      return value->ToString();
    }
  }

  return name;
}
コード例 #2
0
std::string NamedHandleObjectWithState::GetDescription() const
{
  const std::string description(NamedHandleObject::GetDescription()); // Trigger a NDE.

  const State::ConstPointer
      descriptionState(this->GetState(INamedHandleStateIds::DESCRIPTION));
  if (descriptionState.IsNotNull())
  {
    const Object::ConstPointer value(descriptionState->GetValue());
    if (value.IsNotNull())
    {
      return value->ToString();
    }
  }

  return description;
}