Exemple #1
0
	vector<pair<MarControlPtr, MarControlPtr> >
	MarControl::getLinks()
	{
		vector<pair<MarControlPtr, MarControlPtr> > res;
		vector<pair<MarControl*, MarControl*> >::const_iterator lit;
		for(lit=value_->links_.begin(); lit != value_->links_.end(); ++lit)
		{
			res.push_back(pair<MarControlPtr, MarControlPtr>(MarControlPtr(lit->first),MarControlPtr(lit->second)));
		}
		return res;
	}
Exemple #2
0
	WAS_INLINE
	bool
	MarControl::setValue(MarControlPtr mc, bool update)
	{
		if (value_->type_ != mc->value_->type_)
		{
			std::ostringstream sstr;
			sstr << "MarControl::setValue() - Trying to set value of incompatible type "
				 << "(expected " << value_->type_ << ", given " << mc->value_->type_ << ")";
			MRSWARN(sstr.str());
			return false;
		}

		if (MarControlPtr(this) == mc)
		{
			return true;
		}
	
		value_->copyValue(*(mc->value_));

#ifdef MARSYAS_TRACECONTROLS
		value_->setDebugValue();
#endif

		//check if it's needed to call update()
		if(update)
			value_->callMarSystemsUpdate();

		return true;
	}
Exemple #3
0
MarControlPtr find_control( MarSystem *root_system, const char * path )
{
  size_t path_len = strlen(path);
  const char * path_end = path + path_len;
  const char * component = path;

  MarSystem * system = root_system;

  while(system)
  {
    const char * separator = std::find(component, path_end, '/');
    size_t component_len = separator - component;
    if (separator != path_end)
    {
      system = find_child_system(system, component, component_len );
    }
    else
    {
      return find_local_control(system, component, component_len);
    }
    component = separator + 1;
  }

  return MarControlPtr();
}
Exemple #4
0
MarControlPtr find_local_control(MarSystem * system, const char *name, size_t count)
{
  const auto & controls = system->controls();
  for ( const auto & mapping : controls )
  {
    const MarControlPtr & control = mapping.second;
    const string & id = control->id();
    if (id.size() == count &&
        equal(name, name + count, id.data()))
    {
      return control;
    }
  }

  return MarControlPtr();
}