Example #1
0
TTAudioObjectBase::TTAudioObjectBase(const TTValue& arguments) :
	TTObjectBase(arguments), 
	mMaxNumChannels(0),
	attrMute(0), 
	inputArray(kTTSym_audiosignalarray,2),
	outputArray(kTTSym_audiosignalarray,2),
	startProcessingTime(0.0),
	accumulatedProcessingTime(0.0),
	accumulatedProcessingCalls(0.0)
{
	// Convention: 'Public' attribute names begin with a capital letter, 'Private' attribute names begin with a lower case letter
//	registerAttribute("maxNumChannels",		kTypeUInt8,		&maxNumChannels,	(TTSetterMethod)&TTAudioObjectBase::setMaxNumChannels);
	addAttributeWithSetter(MaxNumChannels,	kTypeUInt16);
	addAttributeProperty(MaxNumChannels,	defaultValue,	1);
	
	registerAttribute(kTTSym_sampleRate,	kTypeUInt32,	&sr,				(TTSetterMethod)&TTAudioObjectBase::setSr);
	registerAttribute("bypass",				kTypeBoolean,	&attrBypass,		(TTSetterMethod)&TTAudioObjectBase::setBypass);
	registerAttribute("mute",				kTypeBoolean,	&attrMute,			(TTSetterMethod)&TTAudioObjectBase::setMute);
	
	registerMessage("test",						(TTMethod)&TTAudioObjectBase::test);
	registerMessage("calculate",				(TTMethod)&TTAudioObjectBase::calculateMessage);
	registerMessage("resetBenchmarking",		(TTMethod)&TTAudioObjectBase::resetBenchmarking, kTTMessagePassNone);
	registerMessage("getProcessingBenchmark",	(TTMethod)&TTAudioObjectBase::getProcessingBenchmark);
	
	// Set Defaults...
		
	setAttributeValue(kTTSym_sampleRate, ttEnvironment->mSampleRate);
	setProcess(&TTAudioObjectBase::bypassProcess);
    setCalculate(&TTAudioObjectBase::defaultCalculateMethod);
	setAttributeValue("bypass",			NO);
}
Example #2
0
DeviceAPI::DeviceAPI(const DeviceDescriptor &device_) :
    device(device_)
{
    registerAttribute("id", device.serial_number(), true);
    registerAttribute("vendorId", utils::hex_encode(device.vendor_id()), true);
    registerAttribute("productId", utils::hex_encode(device.product_id()), true);
    registerAttribute("path", device.path(), true);
}
Example #3
0
void ShaderVariableManager::loadStandards() {
	registerUniform(UniformDescription::MVP_MATRIX);
	registerUniform(UniformDescription::MV_MATRIX);
	registerUniform(UniformDescription::COLOR);
	registerUniform(UniformDescription::COLOR_TEXTURE);
	registerAttribute(AttributeDescription::POSITION);
	registerAttribute(AttributeDescription::COLOR);
	registerAttribute(AttributeDescription::NORMAL);
}
Example #4
0
StatusXMLDocumentHandler::StatusXMLDocumentHandler(StreamerParser *parser) : XMLStreamDocumentHandler(parser)
{
    /**
     * Register Mandatory attributes
     */
    registerAttribute("Led", "id");
    registerAttribute("Led", "color");
    registerAttribute("Led", "blink");
    registerAttribute("StatusText", "name_text_id");
    status.setStatusText(statusData);
}
Example #5
0
File: Bone.cpp Project: bog2k3/bugs
Bone::Bone()
	: BodyPart(BodyPartType::BONE, std::make_shared<BoneInitializationData>())
	, length_(0)
	, width_(0)
{
	auto initData = std::dynamic_pointer_cast<BoneInitializationData>(getInitializationData());
	registerAttribute(GENE_ATTRIB_ASPECT_RATIO, initData->aspectRatio);
	registerAttribute(GENE_ATTRIB_DENSITY, initData->density);

	physBody_.userObjectType_ = ObjectTypes::BPART_BONE;
	physBody_.userPointer_ = this;
}
Example #6
0
UdpService::UdpService(const char *name) 
    : IService(name) {
    registerInterface(static_cast<IUdp *>(this));
    registerAttribute("Timeout", &timeout_);
    registerAttribute("BlockingMode", &blockmode_);
    registerAttribute("HostIP", &hostIP_);
    registerAttribute("BoardIP", &boardIP_);

    timeout_.make_int64(0);
    blockmode_.make_boolean(true);
    hostIP_.make_string("192.168.0.53");
    boardIP_.make_string("192.168.0.51");
}
Example #7
0
SocInfo::SocInfo(const char *name) 
    : IService(name) {
    registerInterface(static_cast<ISocInfo *>(this));
    registerAttribute("PnpBaseAddress", &pnpBase_);
    registerAttribute("DsuBaseAddress", &dsuBase_);
    registerAttribute("GpioBaseAddress", &gpioBase_);
    registerAttribute("ListCSR", &listCSR_);
    registerAttribute("ListRegs", &listRegs_);

    dsuBase_.make_uint64(0);
    listCSR_.make_list(0);
    listRegs_.make_list(0);
}
Example #8
0
Function::Function(Doc* doc, Type t)
    : QObject(doc)
    , m_id(Function::invalidId())
    , m_type(t)
    , m_path(QString())
    , m_visible(true)
    , m_runOrder(Loop)
    , m_direction(Forward)
    , m_tempoType(Time)
    , m_overrideTempoType(Original)
    , m_beatResyncNeeded(false)
    , m_fadeInSpeed(0)
    , m_fadeOutSpeed(0)
    , m_duration(0)
    , m_overrideFadeInSpeed(defaultSpeed())
    , m_overrideFadeOutSpeed(defaultSpeed())
    , m_overrideDuration(defaultSpeed())
    , m_flashing(false)
    , m_elapsed(0)
    , m_elapsedBeats(0)
    , m_stop(true)
    , m_running(false)
    , m_paused(false)
    , m_lastOverrideAttributeId(OVERRIDE_ATTRIBUTE_START_ID)
    , m_preserveAttributes(false)
    , m_blendMode(Universe::NormalBlend)
{
    Q_ASSERT(doc != NULL);
    registerAttribute(tr("Intensity"), Multiply | Single);
}
Example #9
0
void OSRunner::registerValue(const std::string& name,
                             const std::string& displayName,
                             const std::string& value)
{
    Attribute attribute(name,value);
    attribute.setDisplayName(displayName);
    registerAttribute(attribute);
}
Example #10
0
UART::UART(const char *name)  : IService(name) {
    registerInterface(static_cast<IMemoryOperation *>(this));
    registerInterface(static_cast<ISerial *>(this));
    registerAttribute("BaseAddress", &baseAddress_);
    registerAttribute("Length", &length_);
    registerAttribute("IrqLine", &irqLine_);
    registerAttribute("IrqControl", &irqctrl_);

    baseAddress_.make_uint64(0);
    length_.make_uint64(0);
    irqLine_.make_uint64(0);
    irqctrl_.make_string("");
    listeners_.make_list(0);

    memset(&regs_, 0, sizeof(regs_));
    regs_.status = UART_STATUS_TX_EMPTY | UART_STATUS_RX_EMPTY;

    p_rx_wr_ = rxfifo_;
    p_rx_rd_ = rxfifo_;
    rx_total_ = 0;
}
Example #11
0
EFX::EFX(Doc* doc) : Function(doc, Function::EFXType)
{
    m_isRelative = false;

    updateRotationCache();

    m_xFrequency = 2;
    m_yFrequency = 3;
    m_xPhase = M_PI / 2.0;
    m_yPhase = 0;

    m_propagationMode = Parallel;

    m_algorithm = EFX::Circle;

    setName(tr("New EFX"));

    m_fader = NULL;

    setDuration(20000); // 20s

    m_legacyHoldBus = Bus::invalid();
    m_legacyFadeBus = Bus::invalid();

    registerAttribute(tr("Width"), Function::LastWins, 0.0, 127.0, 127.0);
    registerAttribute(tr("Height"), Function::LastWins, 0.0, 127.0, 127.0);
    registerAttribute(tr("Rotation"), Function::LastWins, 0.0, 359.0, 0.0);
    registerAttribute(tr("X Offset"), Function::LastWins, 0.0, 255.0, 127.0);
    registerAttribute(tr("Y Offset"), Function::LastWins, 0.0, 255.0, 127.0);
    registerAttribute(tr("Start Offset"), Function::LastWins, 0.0, 359.0, 0.0);
}
Example #12
0
AttributeRegistry::AttributeRegistry() :
    _guideAttribute(registerAttribute(new SharedObjectAttribute("guide", &MetavoxelGuide::staticMetaObject,
        new DefaultMetavoxelGuide()))),
    _rendererAttribute(registerAttribute(new SharedObjectAttribute("renderer", &MetavoxelRenderer::staticMetaObject,
        new DefaultMetavoxelRenderer()))),
    _spannersAttribute(registerAttribute(new SpannerSetAttribute("spanners", &Spanner::staticMetaObject))),
    _colorAttribute(registerAttribute(new QRgbAttribute("color"))),
    _normalAttribute(registerAttribute(new PackedNormalAttribute("normal"))),
    _spannerColorAttribute(registerAttribute(new SpannerQRgbAttribute("spannerColor"))),
    _spannerNormalAttribute(registerAttribute(new SpannerPackedNormalAttribute("spannerNormal"))),
    _spannerMaskAttribute(registerAttribute(new FloatAttribute("spannerMask"))),
    _heightfieldAttribute(registerAttribute(new HeightfieldAttribute("heightfield"))),
    _heightfieldColorAttribute(registerAttribute(new HeightfieldColorAttribute("heightfieldColor"))) {
    
    // our baseline LOD threshold is for voxels; spanners and heightfields are a different story
    const float SPANNER_LOD_THRESHOLD_MULTIPLIER = 8.0f;
    _spannersAttribute->setLODThresholdMultiplier(SPANNER_LOD_THRESHOLD_MULTIPLIER);
    
    const float HEIGHTFIELD_LOD_THRESHOLD_MULTIPLIER = 32.0f;
    _heightfieldAttribute->setLODThresholdMultiplier(HEIGHTFIELD_LOD_THRESHOLD_MULTIPLIER);
    _heightfieldColorAttribute->setLODThresholdMultiplier(HEIGHTFIELD_LOD_THRESHOLD_MULTIPLIER);
}
Example #13
0
PluginAPI::PluginAPI(const BitcoinTrezorPluginPtr &plugin,
                     const FB::BrowserHostPtr &host) :
    _plugin(plugin),
    _host(host)
{
    registerAttribute("version", FBSTRING_PLUGIN_VERSION, true);
    
    registerMethod("call", make_method(this, &PluginAPI::call));
    registerMethod("close", make_method(this, &PluginAPI::close));
    registerMethod("devices", make_method(this, &PluginAPI::devices));
    registerMethod("configure", make_method(this, &PluginAPI::configure));
    registerMethod("deriveChildNode", make_method(this, &PluginAPI::derive_child_node));
}
Example #14
0
TTProtocol::TTProtocol(const TTValue& arguments) :
TTObjectBase(arguments),
mRunning(NO),
mSelectedApplication(kTTSymEmpty)
{
    mApplicationManager = arguments[0];
    mMonitorInCallback = arguments[1];
    mMonitorOutCallback = arguments[2];
    
	registerAttribute(TTSymbol("applicationNames"), kTypeLocalValue, NULL, (TTGetterMethod)& TTProtocol::getApplicationNames);

	addAttribute(Name, kTypeSymbol);
	addAttributeProperty(Name, readOnly, YES);

	addAttribute(Version, kTypeSymbol);
	addAttributeProperty(Version, readOnly, YES);

	addAttribute(Author, kTypeSymbol);
	addAttributeProperty(Author, readOnly, YES);
    
    addAttribute(Get, kTypeBoolean);
	addAttributeProperty(Get, readOnly, YES);
    
    addAttribute(Set, kTypeBoolean);
	addAttributeProperty(Set, readOnly, YES);
    
    addAttribute(Listen, kTypeBoolean);
	addAttributeProperty(Listen, readOnly, YES);

	addAttribute(Discover, kTypeBoolean);
	addAttributeProperty(Discover, readOnly, YES);
    
    addAttribute(DiscoverAll, kTypeBoolean);
	addAttributeProperty(DiscoverAll, readOnly, YES);
	
	addAttribute(Monitor, kTypeBoolean);

	addMessageWithArguments(ApplicationRegister);
    addMessageWithArguments(ApplicationRename);
	addMessageWithArguments(ApplicationUnregister);
    addMessageWithArguments(ApplicationSelect);
    addMessage(ApplicationSelectLocal);
	
	addMessageWithArguments(isRegistered);
	
    addMessageWithArguments(Scan);
	addMessageWithArguments(Run);
	addMessageWithArguments(Stop);
}
Example #15
0
// Constructor
TTOverdriveExtended::TTOverdriveExtended(TTValue& arguments)
: TTOverdrive(arguments)
{
	registerAttribute(TT("overdrive"), kTypeFloat64, &mDrive, (TTSetterMethod)&TTOverdrive::setDrive);
	registerAttribute(TT("/saturation"), kTypeFloat64, &mDrive, (TTSetterMethod)&TTOverdrive::setDrive);
	registerAttribute(TT("/depth"), kTypeFloat64, &mDrive, (TTSetterMethod)&TTOverdrive::setDrive);
	
	registerAttribute(TT("bypass_dcblocker"), kTypeBoolean, &mDcBlocker, (TTSetterMethod)&TTOverdrive::setDcBlocker);
	registerAttribute(TT("/dcblocker/bypass"), kTypeBoolean, &mDcBlocker, (TTSetterMethod)&TTOverdrive::setDcBlocker);
	
	registerAttribute(TT("/preamp"), kTypeFloat64, &mPreamp, (TTGetterMethod)&TTOverdrive::getPreamp, (TTSetterMethod)&TTOverdrive::setPreamp);
	
	registerAttribute(TT("/mode"), kTypeUInt8, &mMode, (TTSetterMethod)&TTOverdrive::setMode);
	
	registerAttribute(TT("/audio/mute"), kTypeBoolean, &attrMute, (TTSetterMethod)&TTAudioObject::setMute);
	
	registerMessageSimple(anything);
}
Example #16
0
Function::Function(Doc* doc, Type t)
    : QObject(doc)
    , m_id(Function::invalidId())
    , m_type(t)
    , m_path(QString())
    , m_runOrder(Loop)
    , m_direction(Forward)
    , m_fadeInSpeed(0)
    , m_fadeOutSpeed(0)
    , m_duration(0)
    , m_overrideFadeInSpeed(defaultSpeed())
    , m_overrideFadeOutSpeed(defaultSpeed())
    , m_overrideDuration(defaultSpeed())
    , m_flashing(false)
    , m_elapsed(0)
    , m_stop(true)
    , m_running(false)
    , m_startedAsChild(false)
{
    Q_ASSERT(doc != NULL);
    registerAttribute(tr("Intensity"));
}
Example #17
0
EFX::EFX(Doc* doc)
    : Function(doc, Function::EFXType)
    , m_algorithm(EFX::Circle)
    , m_isRelative(false)
    , m_xFrequency(2)
    , m_yFrequency(3)
    , m_xPhase(M_PI / 2.0)
    , m_yPhase(0)
    , m_propagationMode(Parallel)
    , m_legacyFadeBus(Bus::invalid())
    , m_legacyHoldBus(Bus::invalid())
{
    updateRotationCache();
    setName(tr("New EFX"));
    setDuration(20000); // 20s

    registerAttribute(tr("Width"), Function::LastWins, 0.0, 127.0, 127.0);
    registerAttribute(tr("Height"), Function::LastWins, 0.0, 127.0, 127.0);
    registerAttribute(tr("Rotation"), Function::LastWins, 0.0, 359.0, 0.0);
    registerAttribute(tr("X Offset"), Function::LastWins, 0.0, 255.0, 127.0);
    registerAttribute(tr("Y Offset"), Function::LastWins, 0.0, 255.0, 127.0);
    registerAttribute(tr("Start Offset"), Function::LastWins, 0.0, 359.0, 0.0);
}
Example #18
0
TTData::TTData(const TTValue& arguments) :
TTCallback(arguments),
mValue(TTValue(0.0)),
mValueDefault(TTValue(0.0)),
mValueStepsize(TTValue(0.1)),       // this default value is expected in #TTData::setType method
mType(kTTSym_generic),
mTags(TTValue(kTTSym_none)),
mPriority(0),
mDescription(kTTSym_none),
mRepetitionsFilter(NO),
mActive(YES),
mInitialized(NO),
mRangeBounds(0.0, 1.0),             // this default value is expected in #TTData::setType method
mRangeClipmode(kTTSym_none),
mDynamicInstances(NO),
mInstanceBounds(0, -1),
mRampDrive(kTTSym_none),
mRampDriveDefault(TTSymbol("system")),
#ifndef TT_NO_DSP
mRampFunction(kTTSym_none),         // this default value is expected in #TTData::setType method
#endif
mRampStatus(NO),
mDataspace(kTTSym_none),
mDataspaceUnit(kTTSym_none),
mService(kTTSymEmpty)
{
	if (arguments.size() == 1)
		mService = arguments[0];
	
    registerAttribute(kTTSym_value, kTypeNone, NULL, (TTGetterMethod)&TTData::getValue, (TTSetterMethod)&TTData::setGenericValue);
	addAttributeWithGetterAndSetter(ValueDefault, kTypeNone);
	addAttributeWithGetterAndSetter(ValueStepsize, kTypeNone);
	
	addAttributeWithSetter(Type, kTypeSymbol);
	addAttributeWithSetter(Tags, kTypeLocalValue);
	addAttributeWithSetter(Priority, kTypeInt32);
	addAttributeWithSetter(Description, kTypeSymbol);
	addAttributeWithSetter(RepetitionsFilter, kTypeBoolean);
	
	addAttributeWithSetter(Active, kTypeBoolean);
	
	addAttribute(Initialized, kTypeBoolean);
	addAttributeProperty(Initialized, readOnly, YES);
	addAttributeProperty(Initialized, hidden, YES);
	
	addAttributeWithSetter(RangeBounds, kTypeLocalValue);
	addAttributeWithSetter(RangeClipmode, kTypeSymbol);
	
    // this is a temporary solution for Blue YĆ©ti
	addAttribute(DynamicInstances, kTypeBoolean);
	addAttributeProperty(DynamicInstances, hidden, YES);
	addAttributeWithSetter(InstanceBounds, kTypeLocalValue);
	addAttributeProperty(InstanceBounds, hidden, YES);
	
	addAttributeWithSetter(RampDrive, kTypeSymbol);
    addAttribute(RampDriveDefault, kTypeSymbol);
    addAttributeProperty(RampDriveDefault, hidden, YES);
#ifndef TT_NO_DSP    
	addAttributeWithSetter(RampFunction, kTypeSymbol);
#endif
	
	addAttribute(RampFunctionParameters, kTypeLocalValue);
	addAttributeProperty(RampFunctionParameters, readOnly, YES);
	
	addAttribute(RampStatus, kTypeBoolean);
	addAttributeProperty(RampStatus, readOnly, YES);
    addAttributeProperty(RampStatus, hidden, YES);          // hidden for Max
	
	addAttributeWithSetter(Dataspace, kTypeSymbol);
	addAttributeWithSetter(DataspaceUnit, kTypeSymbol);
	
	addAttribute(Service, kTypeSymbol);
    //addAttributeProperty(Service, hidden, YES);           // we don't hide this attribute to mirror it (even if we want to hide it for Max)
	
    registerMessage(kTTSym_Init, (TTMethod)&TTData::GenericInit, kTTMessagePassNone);
	addMessageWithArguments(Inc);
	addMessageWithArguments(Dec);
    
    addMessageWithArguments(Command);
	addMessageProperty(Command, hidden, YES);
    
    addMessageWithArguments(RampSet);
    addMessageProperty(RampSet, hidden, YES);
    addMessageWithArguments(RampTarget);
    addMessageProperty(RampTarget, hidden, YES);
    addMessageWithArguments(RampGo);
    addMessageProperty(RampGo, hidden, YES);
    addMessageWithArguments(RampSlide);
    addMessageProperty(RampSlide, hidden, YES);
	
	// needed to be handled by a TTTextHandler
	addMessageWithArguments(WriteAsText);
	addMessageProperty(WriteAsText, hidden, YES);
	
	mIsSending = NO;
	mIsOverridingDataspaceUnit = NO;
    
    commandMethod = (TTMethodValue)&TTData::GenericCommand;
    
    // cache some message and attribute for observer notification
    this->findAttribute(kTTSym_value, &valueAttribute);
    this->findAttribute(kTTSym_initialized, &initializedAttribute);
    
    // set no time for external ramp drive
    externalRampTime = 0;
}
Example #19
0
TTDataObject::TTDataObject(TTValue& arguments)
	: TTObject(arguments)
{
	registerAttribute(kTTSym_SampleRate, kTypeUInt32, &sr, (TTSetterMethod)&TTDataObject::setSr);
	setAttributeValue(kTTSym_SampleRate, ttEnvironment->mSampleRate);
}
Example #20
0
AttributeRegistry::AttributeRegistry() :
    _guideAttribute(registerAttribute(new PolymorphicAttribute("guide", PolymorphicDataPointer(new DefaultMetavoxelGuide())))),
    _colorAttribute(registerAttribute(new QRgbAttribute("color"))),
    _normalAttribute(registerAttribute(new QRgbAttribute("normal", qRgb(0, 127, 0)))) {
}
Example #21
0
bool OSRunner::validateUserArguments(const std::vector<OSArgument>& script_arguments,
                                     const std::map<std::string, OSArgument>& user_arguments)
{
    bool result(true);
    std::stringstream ss;
    AttributeVector argumentValueAttributes;
    for (const OSArgument& script_argument : script_arguments) {
        auto it = user_arguments.find(script_argument.name());
        if (it == user_arguments.end()) {
            // script_argument is not in user_arguments
            // this is only okay for purely optional arguments
            if (script_argument.required() || script_argument.hasDefaultValue()) {
                ss << "Argument " << script_argument.name() << " is required or has a default value, ";
                ss << "but is not in user_arguments.";
                registerError(ss.str());
                ss.str("");
                result = false;
            }
        }
        else {
            // script_argument is in user_arguments
            OSArgument user_argument = it->second;

            // check that names still match
            if (user_argument.name() != script_argument.name()) {
                ss << "User argument name '" << user_argument.name() << "' does not match map key ";
                ss << script_argument.name() << ".";
                registerWarning(ss.str());
                ss.str("");
            }

            // check that types still match
            if (user_argument.type() != script_argument.type()) {
                ss << "User argument type " << user_argument.type().valueName() << " does not match ";
                ss << "script argument type " << script_argument.type().valueName() << ".";
                registerError(ss.str());
                ss.str("");
                result = false;
            }

            //  check that we have values
            if ((script_argument.required()) &&
                    !(user_argument.hasValue() || user_argument.hasDefaultValue()))
            {
                ss << "Script argument '" << script_argument.name() << "' is required, ";
                ss << "but the user argument does not have a value or default value set.";
                registerError(ss.str());
                ss.str("");
                result = false;
            }

            // check for default value mismatch
            if (script_argument.hasDefaultValue() && !user_argument.hasDefaultValue()) {
                ss << "Script argument '" << script_argument.name() << "' has a default value, but the ";
                ss << "user-supplied version does not.";
                registerWarning(ss.str());
                ss.str("");
            }
            if (!script_argument.hasDefaultValue() && user_argument.hasDefaultValue()) {
                ss << "Script argument '" << script_argument.name() << "' does not have a default value, ";
                ss << "but the user-supplied version does.";
                registerWarning(ss.str());
                ss.str("");
            }
            if (script_argument.hasDefaultValue() && user_argument.hasDefaultValue() &&
                    (user_argument.type() == script_argument.type()))
            {
                ss << "The default value of script argument " << std::endl << script_argument << std::endl;
                ss << "does not match that of the corresponding user argument " << std::endl << user_argument << ".";
                switch (script_argument.type().value()) {
                case OSArgumentType::Boolean :
                    if (user_argument.defaultValueAsBool() != script_argument.defaultValueAsBool()) {
                        registerWarning(ss.str());
                    }
                    break;
                case OSArgumentType::Double :
                    if (user_argument.defaultValueAsDouble() != script_argument.defaultValueAsDouble()) {
                        registerWarning(ss.str());
                    }
                    break;
                case OSArgumentType::Quantity :
                    if (user_argument.defaultValueAsQuantity() != script_argument.defaultValueAsQuantity()) {
                        registerWarning(ss.str());
                    }
                    break;
                case OSArgumentType::Integer :
                    if (user_argument.defaultValueAsInteger() != script_argument.defaultValueAsInteger()) {
                        registerWarning(ss.str());
                    }
                    break;
                case OSArgumentType::String :
                case OSArgumentType::Choice :
                case OSArgumentType::Path :
                    if (user_argument.defaultValueAsString() != script_argument.defaultValueAsString()) {
                        registerWarning(ss.str());
                    }
                    break;
                default :
                    OS_ASSERT(false);
                }
                ss.str("");
            }

            // check for domain mismatch
            if (script_argument.hasDomain() && !user_argument.hasDomain()) {
                ss << "Script argument '" << script_argument.name() << "' has a specified domain, but the ";
                ss << "user-supplied version does not.";
                registerWarning(ss.str());
                ss.str("");
            }
            if (!script_argument.hasDomain() && user_argument.hasDomain()) {
                ss << "Script argument '" << script_argument.name() << "' does not have a specified domain, ";
                ss << "but the user-supplied version does.";
                registerWarning(ss.str());
                ss.str("");
            }
            if (script_argument.hasDomain() && user_argument.hasDomain() &&
                    (user_argument.type() == script_argument.type()))
            {
                ss << "The domain of script argument " << std::endl << script_argument << std::endl;
                ss << "does not match that of the corresponding user argument " << std::endl << user_argument << ".";
                switch (script_argument.type().value()) {
                case OSArgumentType::Boolean:
                    // DLM: should bool's even have domains?
                    if (user_argument.domainAsBool() != script_argument.domainAsBool()) {
                        registerWarning(ss.str());
                    }
                    break;
                case OSArgumentType::Double:
                    if (user_argument.domainAsDouble() != script_argument.domainAsDouble()) {
                        registerWarning(ss.str());
                    }
                    break;
                case OSArgumentType::Quantity:
                    // DLM: deprecated forget about getting this to compile
                    //if (user_argument.domainAsQuantity() != script_argument.domainAsQuantity()) {
                    //  registerWarning(ss.str());
                    //}
                    break;
                case OSArgumentType::Integer:
                    if (user_argument.domainAsInteger() != script_argument.domainAsInteger()) {
                        registerWarning(ss.str());
                    }
                    break;
                case OSArgumentType::String:
                case OSArgumentType::Choice:
                case OSArgumentType::Path:
                    if (user_argument.domainAsString() != script_argument.domainAsString()) {
                        registerWarning(ss.str());
                    }
                    break;
                default:
                    OS_ASSERT(false);
                }
                ss.str("");
            }

            // success, set the values
            if (result) {
                Quantity q;
                switch(user_argument.type().value()) {
                case OSArgumentType::Boolean :
                    if (user_argument.hasValue()) {
                        argumentValueAttributes.push_back(Attribute(user_argument.name(),user_argument.valueAsBool()));
                    } else if (user_argument.hasDefaultValue()) {
                        argumentValueAttributes.push_back(Attribute(user_argument.name(),user_argument.defaultValueAsBool()));
                    }
                    break;
                case OSArgumentType::Double :
                    if (user_argument.hasValue()) {
                        argumentValueAttributes.push_back(Attribute(user_argument.name(),user_argument.valueAsDouble()));
                    } else if (user_argument.hasDefaultValue()) {
                        argumentValueAttributes.push_back(Attribute(user_argument.name(),user_argument.defaultValueAsDouble()));
                    }
                    break;
                case OSArgumentType::Quantity :
                    if (user_argument.hasValue()) {
                        q = user_argument.valueAsQuantity();
                    } else if (user_argument.hasDefaultValue()) {
                        q = user_argument.defaultValueAsQuantity();
                    }
                    argumentValueAttributes.push_back(Attribute(user_argument.name(),q.value(),q.units().print()));
                    break;
                case OSArgumentType::Integer :
                    if (user_argument.hasValue()) {
                        argumentValueAttributes.push_back(Attribute(user_argument.name(),user_argument.valueAsInteger()));
                    } else if (user_argument.hasDefaultValue()) {
                        argumentValueAttributes.push_back(Attribute(user_argument.name(),user_argument.defaultValueAsInteger()));
                    }
                    break;
                case OSArgumentType::String :
                case OSArgumentType::Choice :
                case OSArgumentType::Path :
                    if (user_argument.hasValue()) {
                        argumentValueAttributes.push_back(Attribute(user_argument.name(),user_argument.valueAsString()));
                    } else if (user_argument.hasDefaultValue()) {
                        argumentValueAttributes.push_back(Attribute(user_argument.name(),user_argument.defaultValueAsString()));
                    }
                    break;
                default:
                    OS_ASSERT(false);
                }
            }
        }
    }

    if (result) {
        for (Attribute& attribute : argumentValueAttributes) {
            registerAttribute(attribute);
        }
    }

    return result;
}
Example #22
0
void OSRunner::registerValue(const std::string& name, int value, const std::string& units) {
    Attribute attribute(name,value,units);
    registerAttribute(attribute);
}
Example #23
0
void OSRunner::registerValue(const std::string& name, const std::string& value) {
    Attribute attribute(name,value);
    registerAttribute(attribute);
}