Exemplo n.º 1
0
void CSensor::load()
{
  if (m_handle)
  {
    char *error; error = nullptr;
    TFGetStatistics       getStatistics;
    TFGetFrameAvialable   getFrameAvialable;
    MON_IMPORT(TFInitSensor         , initSensor         );
    MON_IMPORT(TFGetName            , getName            );
    MON_IMPORT(TFGetDefinition      , getDefinition      );
    MON_IMPORT(TFGetDefinitionLength, getDefinitionLength);
    MON_IMPORT(TFGetStatistics      , getStatistics      );
    MON_IMPORT(TFGetFrameAvialable  , getFrameAvialable  );
    initSensor(MON_ST_LOGGER, MON_ST_CONFIG->folder("sensors")->folder(name()));
    setDefinition(getDefinition());
    if(name().compare(getName()) != 0)
    {
      MON_LOG_ERR("Detected try to load sensor " << getName() << ", renamed to " << name());
    }
    for(auto &frame : definition()->frames())
    {
      m_frames[frame] = new CFrame(this, getStatistics, getFrameAvialable, frame);
    }
  }
}
Exemplo n.º 2
0
void Tree::insertBuiltInTypesInGlobalNameBindings() {

    // Start generating the object class.
    auto objectClass =
        ClassDefinition::create(Keyword::objectString, &globalNameBindings);
    globalNameBindings.insertClass(Keyword::objectString, objectClass);

    objectClass->generateDefaultConstructor();

    // Add method:
    // virtual bool equals(object obj)
    auto equalsMethod =
        MethodDefinition::create(BuiltInTypes::objectEqualsMethodName,
                                 Type::create(Type::Boolean),
                                 false,
                                 objectClass);
    auto objectType = Type::create(Type::Object);
    objectType->setDefinition(objectClass);
    equalsMethod->addArgument(objectType, "obj");
    equalsMethod->setIsVirtual(true);
    objectClass->appendMember(equalsMethod);

    // Add method:
    // virtual int hash()
    auto hashMethod =
        MethodDefinition::create(BuiltInTypes::objectHashMethodName,
                                 Type::create(Type::Boolean),
                                 false,
                                 objectClass);
    hashMethod->setIsVirtual(true);
    objectClass->appendMember(hashMethod);

    // Create the primitive types (and some other types).
    auto viodClass = insertBuiltInType("void");
    insertBuiltInType("_");
    insertBuiltInType("lambda");
    insertBuiltInType(Keyword::funString);
    insertBuiltInType("implicit");
    auto byteClass = insertBuiltInType(Keyword::byteString);
    auto charClass = insertBuiltInType(Keyword::charString);
    auto floatClass = insertBuiltInType(Keyword::floatString);
    auto intClass = insertBuiltInType(Keyword::intString);
    auto longClass = insertBuiltInType(Keyword::longString);
    auto boolClass = insertBuiltInType(Keyword::boolString);

    // Now that the primitive types exist we can set the definitions of the
    // return types of the methods in the object class.
    objectClass->getDefaultConstructor()->getReturnType()->setDefinition(
        viodClass);
    equalsMethod->getReturnType()->setDefinition(boolClass);
    hashMethod->getReturnType()->setDefinition(intClass);

    // Add equals() methods to the primitive types.
    addEqualsMethod(byteClass, Type::Byte);
    addEqualsMethod(charClass, Type::Char);
    addEqualsMethod(floatClass, Type::Float);
    addEqualsMethod(intClass, Type::Integer);
    addEqualsMethod(longClass, Type::Integer);
    addEqualsMethod(boolClass, Type::Boolean);
}
Exemplo n.º 3
0
OrthotropicSecantCoefficientOfThermalExpansion::OrthotropicSecantCoefficientOfThermalExpansion(PropertyModel *propmodel,
                                                                                               ParameterModel* paramodel,
                                                                                                   int id) :
    Property(id)
{
    setName("Orthotropic Secant Coefficient of Thermal Expansion");
    setDisplayName(QObject::tr("Orthotropic Secant Coefficient of Thermal Expansion"));
    setCategory(PhysicalProperty);
    setType(CoefficientOfThermalExpansion);
    setBehavior(Orthotropic);
    setDefinition(Secant);
    Parameter *par;
    par = paramodel->getParameter("Coefficient of Thermal Expansion X direction");
    addParameter(par->clone());
    par = paramodel->getParameter("Coefficient of Thermal Expansion Y direction");
    addParameter(par->clone());
    par = paramodel->getParameter("Coefficient of Thermal Expansion Z direction");
    addParameter(par->clone());
    referenceTemperatureProperty_ = dynamic_cast<ReferenceTemperatureProperty*>(propmodel->getProperty("Reference Temperature"));
    referenceTemperatureProperty_->setBehavior(Orthotropic);
    referenceTemperatureProperty_->setDefinition(Secant);
    referenceTemperatureProperty_->setMaterialProperty("Coefficient of Thermal Expansion");
    par = referenceTemperatureProperty_->getParameter("Reference Temperature");
    addParameter(par);
}
Exemplo n.º 4
0
 bool SpaceLoadInstance_Impl::setDefinitionAsModelObject(const boost::optional<ModelObject>& modelObject) {
   if (modelObject) {
     OptionalSpaceLoadDefinition intermediate = modelObject->optionalCast<SpaceLoadDefinition>();
     if (intermediate) {
       return setDefinition(*intermediate);
     }
   }
   return false;
 }
Exemplo n.º 5
0
IsotropicInstantaneousCoefficientOfThermalExpansion::IsotropicInstantaneousCoefficientOfThermalExpansion(const IsotropicInstantaneousCoefficientOfThermalExpansion& property) :
    Property(property.getId())
{
    setName("Isotropic Instantaneous Coefficient of Thermal Expansion");
    setDisplayName(QObject::tr("Isotropic Instantaneous Coefficient of Thermal Expansion"));
    setCategory(PhysicalProperty);
    setType(CoefficientOfThermalExpansion);
    setBehavior(Isotropic);
    setDefinition(Instantaneous);
    const Parameter *par = property.getParameter("Coefficient of Thermal Expansion");
    addParameter(par->cloneWithData());
}
Exemplo n.º 6
0
IsotropicInstantaneousCoefficientOfThermalExpansion::IsotropicInstantaneousCoefficientOfThermalExpansion(PropertyModel* /* propmodel */,
                                                                                                         ParameterModel* paramodel,
                                                                                               int id) :
    Property(id)
{
    setName("Isotropic Instantaneous Coefficient of Thermal Expansion");
    setDisplayName(QObject::tr("Isotropic Instantaneous Coefficient of Thermal Expansion"));
    setCategory(PhysicalProperty);
    setType(CoefficientOfThermalExpansion);
    setBehavior(Isotropic);
    setDefinition(Instantaneous);
    Parameter *par = paramodel->getParameter("Coefficient of Thermal Expansion");
    addParameter(par->clone());
}
Exemplo n.º 7
0
OrthotropicInstantaneousCoefficientOfThermalExpansion::OrthotropicInstantaneousCoefficientOfThermalExpansion(const OrthotropicInstantaneousCoefficientOfThermalExpansion& property) :
    Property(property.getId())
{
    setName("Orthotropic Instantaneous Coefficient of Thermal Expansion");
    setDisplayName(QObject::tr("Orthotropic Instantaneous Coefficient of Thermal Expansion"));
    setCategory(PhysicalProperty);
    setType(CoefficientOfThermalExpansion);
    setBehavior(Orthotropic);
    setDefinition(Instantaneous);
    const Parameter *par1 = property.getParameter("Coefficient of Thermal Expansion X direction");
    addParameter(par1->cloneWithData());
    const Parameter *par2 = property.getParameter("Coefficient of Thermal Expansion Y direction");
    addParameter(par2->cloneWithData());
    const Parameter *par3 = property.getParameter("Coefficient of Thermal Expansion Z direction");
    addParameter(par3->cloneWithData());
}
Exemplo n.º 8
0
IsotropicSecantCoefficientOfThermalExpansion::IsotropicSecantCoefficientOfThermalExpansion(const IsotropicSecantCoefficientOfThermalExpansion& property) :
    Property(property.getId())
{
    setName("Isotropic Secant Coefficient of Thermal Expansion");
    setDisplayName(QObject::tr("Isotropic Secant Coefficient of Thermal Expansion"));
    setCategory(PhysicalProperty);
    setType(CoefficientOfThermalExpansion);
    setBehavior(Isotropic);
    setDefinition(Secant);
    const Parameter *par1 = property.getParameter("Coefficient of Thermal Expansion");
    addParameter(par1->clone());
    referenceTemperatureProperty_ = dynamic_cast<ReferenceTemperatureProperty*>(property.referenceTemperatureProperty_->clone());
    referenceTemperatureProperty_->setBehavior(Isotropic);
    referenceTemperatureProperty_->setDefinition(Secant);
    referenceTemperatureProperty_->setMaterialProperty("Coefficient of Thermal Expansion");
    addParameter(referenceTemperatureProperty_->getParameter("Reference Temperature"));
}
Exemplo n.º 9
0
Type* Tree::convertToClosureInterfaceInCurrentTree(Type* type) {
    if (!type->isFunction()) {
        return nullptr;
    }

    auto closureInterfaceDef =
        globalNameBindings.lookupType(type->getClosureInterfaceName());
    if (closureInterfaceDef == nullptr) {
        auto closureInterfaceClass = Closure::generateInterface(*this, type);
        insertClassPostParse(closureInterfaceClass);
        closureInterfaceDef = closureInterfaceClass;
    }

    auto closureInterfaceType =
        Type::create(closureInterfaceDef->cast<ClassDefinition>()->getName());
    closureInterfaceType->setDefinition(closureInterfaceDef);
    return closureInterfaceType;
}
Exemplo n.º 10
0
 void Entity::setProperty(const PropertyKey& key, const PropertyValue* value) {
     const PropertyValue* oldValue = propertyForKey(key);
     if (oldValue == value)
         return;
     if (oldValue != NULL && value != NULL && *oldValue == *value)
         return;
     
     if (key == ClassnameKey && value != classname()) {
         m_worldspawn = *value == WorldspawnClassname;
         setDefinition(NULL);
     }
     
     if (isNumberedProperty(TargetKey, key)) {
         if (oldValue != NULL && !oldValue->empty())
             removeLinkTarget(*oldValue);
         if (value != NULL && !value->empty())
             addLinkTarget(*value);
         if (m_map != NULL)
             m_map->updateEntityTarget(*this, value, oldValue);
     } else if (isNumberedProperty(KillTargetKey, key)) {
         if (oldValue != NULL && !oldValue->empty())
             removeKillTarget(*oldValue);
         if (value != NULL && !value->empty())
             addKillTarget(*value);
         if (m_map != NULL)
             m_map->updateEntityKillTarget(*this, value, oldValue);
     } else if (key == TargetnameKey) {
         removeAllLinkSources();
         removeAllKillSources();
         if (value != NULL && !value->empty()) {
             addAllLinkSources(*value);
             addAllKillSources(*value);
         }
         if (m_map != NULL)
             m_map->updateEntityTargetname(*this, value, oldValue);
     }
     
     if (value == NULL)
         m_propertyStore.removeProperty(key);
     else
         m_propertyStore.setPropertyValue(key, *value);
     invalidateGeometry();
 }
Exemplo n.º 11
0
CheckConstraint::CheckConstraint(Table* table, const QString& name, const QString& definition) :
	TableConstraint(table), _d(0) {
	_d = new CheckConstraintData;
	setName(name);
	setDefinition(definition);
}
Exemplo n.º 12
0
 Entity::~Entity() {
     setMap(NULL);
     Utility::deleteAll(m_brushes);
     setDefinition(NULL);
     m_geometryValid = false;
 }
Exemplo n.º 13
0
void IceVariable::replaceDefinition(IceInst *Inst, const IceCfgNode *Node) {
  DefInst = NULL;
  setDefinition(Inst, Node);
}
Exemplo n.º 14
0
QuickButton::QuickButton(const QString &label,const QString &newDefinition,QWidget* parent) :
QPushButton(label,parent)
{
    setDefinition(newDefinition);
    connect(this,SIGNAL (clicked()),this,SLOT (wasClicked()) );
}