示例#1
0
TEST_F( DeviceEntity, Create )
{
    auto d = ml->addDevice( "dummy", true );
    ASSERT_NE( nullptr, d );
    ASSERT_EQ( "dummy", d->uuid() );
    ASSERT_TRUE( d->isRemovable() );
    ASSERT_TRUE( d->isPresent() );

    Reload();

    d = ml->device( "dummy" );
    ASSERT_NE( nullptr, d );
    ASSERT_EQ( "dummy", d->uuid() );
    ASSERT_TRUE( d->isRemovable() );
    // Since there is no FsFactory to testify that this device is still plugged, the reload
    // will mark it as "absent"
    ASSERT_FALSE( d->isPresent() );
}
示例#2
0
  std::vector<openstudio::IdfObject> CoilHeatingWater_Impl::remove()
  {
    if( isRemovable() )
    {
      return WaterToAirComponent_Impl::remove();
    }

    return std::vector<IdfObject>();
  }
  std::vector<openstudio::IdfObject> CoilCoolingWaterToAirHeatPumpEquationFit_Impl::remove()
  {
    if( isRemovable() )
    {
      return WaterToAirComponent_Impl::remove();
    }

    return std::vector<IdfObject>();
  }
  std::vector<openstudio::IdfObject> CoilCoolingWaterToAirHeatPumpVariableSpeedEquationFit_Impl::remove()
  {
    if( isRemovable() )
    {
      if( auto _stageDataList = speedDataList() ) {
        _stageDataList->remove();
      }
      return WaterToAirComponent_Impl::remove();
    }

    return std::vector<IdfObject>();
  }
示例#5
0
 std::vector<IdfObject> Node_Impl::remove()
 {
   if( isRemovable() )
   {
     this->removeSetpointManagers();
     return ModelObject_Impl::remove();
   }
   else
   {
     return std::vector<IdfObject>();
   }
 }
示例#6
0
std::vector<openstudio::IdfObject> WaterToAirComponent_Impl::remove()
{
    if( isRemovable() )
    {
        removeFromAirLoopHVAC();

        removeFromPlantLoop();

        return HVACComponent_Impl::remove();
    }

    return std::vector<IdfObject>();
}
示例#7
0
        void Context<T>::pushNDArrayToVariableSpace(std::pair<int, int> &pair, NDArray<T> *array, bool removable) {
            if (!_variableSpace->hasVariable(pair)) {
                auto var = new Variable<T>(array, nullptr, pair.first, pair.second);
                _variableSpace->putVariable(pair, var);
                var->markRemovable(removable);
            } else {
                auto var = _variableSpace->getVariable(pair);
                if (var->getNDArray() != array) {
                    if (var->isRemovable() && var->getNDArray() != nullptr)
                        delete var->getNDArray();

                    var->setNDArray(array);
                    var->markRemovable(removable);
                }
            }
        }
示例#8
0
bool LaunchPoint::toFile() const
{
	// NOTE: we only support persisting dynamic launchpoints at this point
	if (!isRemovable() || isDefault())
		return false;

	// dynamic launch points have appinfo files named by their launchpointid's
	std::string	filePath = Settings::LunaSettings()->lunaLaunchPointsPath;
	if (filePath[filePath.size()-1] != '/')
		filePath += "/";
	filePath += launchPointId();

	// persist a launch points appinfo
	json_object* json = toJSON();
	int res = json_object_to_file((char*)filePath.c_str(), json);
	if (json && !is_error(json))
		json_object_put(json);
	return res != -1;
}
示例#9
0
bool Solid::StorageDrive::isRemovable() const
{
    Q_D(const StorageDrive);
    return_SOLID_CALL(Ifaces::StorageDrive *, d->backendObject(), false, isRemovable());
}