示例#1
0
void PortList_Impl::removePort(unsigned port)
{
  unsigned t_numFields = numFields();
  for(unsigned i = port + 1; i < t_numFields; i++ )
  {
    if( boost::optional<Connection> connection = getObject<ModelObject>().getModelObjectTarget<Connection>(i) )
    {
      if( boost::optional<ModelObject> targetObject = connection->targetObject() )
      {
        if( targetObject->handle() == handle() )
        {
          connection->setTargetObjectPort(i - 1);
          continue;
        }
      }

      if( boost::optional<ModelObject> sourceObject = connection->sourceObject() )
      {
        if( sourceObject->handle() == handle() )
        {
          connection->setSourceObjectPort(i - 1);
          continue;
        }
      }
    }
  }
  eraseExtensibleGroup(port - numNonextensibleFields());
}
  bool EnergyManagementSystemProgramCallingManager_Impl::eraseProgram(unsigned index) {
    //erase program at index
    bool result = false;
    auto groups = extensibleGroups();
    unsigned sizeOfGroup = numExtensibleGroups();

    if (index < sizeOfGroup) {
      eraseExtensibleGroup(index);
      result = true;
    }
    return result;
  }
  bool WaterUseConnections_Impl::removeWaterUseEquipment(WaterUseEquipment & _waterUseEquipment)
  {
    std::vector<WaterUseEquipment> equipment = waterUseEquipment();

    int i = 0;

    for( const auto & elem : equipment )
    {
      if( elem.handle() == _waterUseEquipment.handle() )
      {
        eraseExtensibleGroup(i);

        return true;
      }

      i++;
    }

    return false;
  }
 bool PeopleDefinition_Impl::eraseThermalComfortModelType(int i) {
   return !eraseExtensibleGroup(i).empty();
 }