Skip to content
This repository has been archived by the owner on Oct 9, 2018. It is now read-only.

Commit

Permalink
Some minor changes to ParameterValue and StimulusGroup
Browse files Browse the repository at this point in the history
  • Loading branch information
cstawarz committed Mar 29, 2011
1 parent 943fe6f commit d714ceb
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 14 deletions.
2 changes: 1 addition & 1 deletion Core/PluginServices/Component.cpp
Expand Up @@ -27,7 +27,7 @@ void Component::describeComponent(ComponentInfo &info) {


Component::Component(const ParameterValueMap &parameters) :
tag(parameters[TAG].getValue())
tag(parameters[TAG].str())
{
compact_id = _id_count++;
}
Expand Down
6 changes: 0 additions & 6 deletions Core/PluginServices/ParameterValue.cpp
Expand Up @@ -13,12 +13,6 @@
BEGIN_NAMESPACE_MW


template<>
const std::string& ParameterValue::convert(const std::string &s, ComponentRegistryPtr reg) {
return s;
}


template<>
VariablePtr ParameterValue::convert(const std::string &s, ComponentRegistryPtr reg) {
return reg->getVariable(s);
Expand Down
11 changes: 6 additions & 5 deletions Core/PluginServices/ParameterValue.h
Expand Up @@ -32,12 +32,17 @@ class ParameterValue {
reg(reg)
{ }

const std::string& getValue() const {
const std::string& str() const {
return value;
}

template<typename Type>
operator Type() const {
return as<Type>();
}

template<typename Type>
Type as() const {
return convert<Type>(value, reg);
}

Expand Down Expand Up @@ -68,10 +73,6 @@ Type ParameterValue::convert(const std::string &s, ComponentRegistryPtr reg) {
}


template<>
const std::string& ParameterValue::convert(const std::string &s, ComponentRegistryPtr reg);


template<>
VariablePtr ParameterValue::convert(const std::string &s, ComponentRegistryPtr reg);

Expand Down
5 changes: 3 additions & 2 deletions Core/Stimuli/Stimulus.cpp
Expand Up @@ -27,13 +27,14 @@ BEGIN_NAMESPACE_MW


void StimulusGroup::describeComponent(ComponentInfo &info) {
Component::describeComponent(info);
info.setSignature("stimulus_group");
info.addParameter("tag");
info.getParameter(Component::TAG).setRequired(true);
}


StimulusGroup::StimulusGroup(const ParameterValueMap &parameters) :
mw::Component(parameters["tag"].getValue())
Component(parameters)
{ }


Expand Down

0 comments on commit d714ceb

Please sign in to comment.