Exemple #1
0
bool node::operator<(const node& n) const
{
	if(type() != n.type()) {
		return type_ < n.type();
	}
	switch(type()) {
	case NODE_TYPE_NULL:
		return true;
	case NODE_TYPE_BOOL:
		return b_ < n.b_;
	case NODE_TYPE_INTEGER:
		return i_ < n.i_;
	case NODE_TYPE_FLOAT:
		return f_ < n.f_;
	case NODE_TYPE_STRING:
		return s_ < n.s_;
	case NODE_TYPE_MAP:
		return m_.size() < n.m_.size();
	case NODE_TYPE_LIST:
		for(unsigned i = 0; i != l_.size() && i != n.l_.size(); ++i) {
			if(l_[i] < n.l_[i]) {
				return true;
			} else if(l_[i] > n.l_[i]) {
				return false;
			}
		}
		return l_.size() < n.l_.size();
	case NODE_TYPE_FUNCTION:
	default: break;
	}
	ASSERT_LOG(false, "operator< unknown type: " << type_as_string());
	return false;
}
qt_tm_widget_rep::~qt_tm_widget_rep () {
  if (DEBUG_QT_WIDGETS)
    debug_widgets << "qt_tm_widget_rep::~qt_tm_widget_rep of widget "
                  << type_as_string() << LF;
  
    // clear any residual waiting menu installation
  waiting_widgets = remove(waiting_widgets, this);
}
Exemple #3
0
bool node::has_key(const node& v) const
{
	if(type() == NODE_TYPE_LIST) {
		return static_cast<size_t>(v.as_int()) < l_.size() ? true : false;
	} else if(type() == NODE_TYPE_MAP) {
		return m_.find(v) != m_.end() ? true : false;
	} else {
		ASSERT_LOG(false, "Tried to index a node that isn't a list or map: " << type_as_string());
	}
	return false;
}
Exemple #4
0
std::vector<std::string> node::as_list_strings() const
{
	std::vector<std::string> res;
	ASSERT_LOG(type() == NODE_TYPE_LIST, "as_list_strings() type conversion error from " << type_as_string() << " to list");
	res.reserve(l_.size());
	for(auto& n : l_) {
		ASSERT_LOG(n.is_string(), "type conversion error from " << type_as_string() << " to string");
		res.emplace_back(n.as_string());
	}
	return res;
}
Exemple #5
0
struct RecordInfo* createRecordInfo(const tree type_decl, const tree record_type)
{
  struct RecordInfo* ri = (struct RecordInfo*) xcalloc(1, sizeof(struct RecordInfo));

  ri->name = xstrdup(type_as_string(record_type, 0));
  ri->fileName = xstrdup(DECL_SOURCE_FILE(type_decl));
  ri->line = DECL_SOURCE_LINE(type_decl);
  ri->size = TREE_INT_CST_LOW(TYPE_SIZE(record_type));
  ri->align = TYPE_ALIGN(record_type);
  ri->isInstance = CLASSTYPE_TEMPLATE_INSTANTIATION(record_type);
  ri->firstField = SIZE_MAX;
  ri->estMinSize = SIZE_MAX;

  size_t fieldCapacity = 4;
  ri->fields = (struct FieldInfo**)xmalloc(fieldCapacity * sizeof(struct FieldInfo*));

  // Fields/variables/constants/functions are chained via TYPE_FIELDS of record
  for (tree field = TYPE_FIELDS(record_type); field; field = TREE_CHAIN(field))
  {
    // We're intersted in fields only
    if (TREE_CODE(field) != FIELD_DECL)
      continue;

    struct FieldInfo* fi = createFieldInfo(field);

    ri->fieldCount++;

    // Allocate more storage for fields if needed
    if (ri->fieldCount > fieldCapacity)
    {
     fieldCapacity *= 2;
     ri->fields = (struct FieldInfo**)xrealloc(ri->fields, fieldCapacity * sizeof(struct FieldInfo*));
    }

    ri->fields[ri->fieldCount - 1] = fi;

    // Mark record as containing bit-fields
    if (fi->isBitField)
      ri->hasBitFields = true;

    // Field is base/vptr
    if (fi->isSpecial)
    {
      // If we encounter special field somewhere after regular fields
      // it means class has virtual base.
      if (ri->firstField != SIZE_MAX)
        ri->hasVirtualBase = true;
    }
    else if (ri->firstField == SIZE_MAX)
      ri->firstField = ri->fieldCount - 1;
  }

  return ri;
}
Exemple #6
0
const node& node::operator[](const node& v) const
{
	if(type() == NODE_TYPE_LIST) {
		return l_[size_t(v.as_int())];
	} else if(type() == NODE_TYPE_MAP) {
		auto it = m_.find(v);
		ASSERT_LOG(it != m_.end(), "Couldn't find key in map");
		return it->second;
	} else {
		ASSERT_LOG(false, "Tried to index a node that isn't a list or map: " << type_as_string());
	}
}
Exemple #7
0
float node::as_float() const
{
	switch(type()) {
	case NODE_TYPE_INTEGER:
		return float(i_);
	case NODE_TYPE_FLOAT:
		return f_;
	case NODE_TYPE_BOOL:
		return b_ ? 1.0f : 0.0f;
	default: break;
	}
	ASSERT_LOG(false, "as_float() type conversion error from " << type_as_string() << " to float");
	return 0;
}
Exemple #8
0
int64_t node::as_int() const
{
	switch(type()) {
	case NODE_TYPE_INTEGER:
		return i_;
	case NODE_TYPE_FLOAT:
		return static_cast<int64_t>(f_);
	case NODE_TYPE_BOOL:
		return b_ ? 1 : 0;
	default: break;
	}
	ASSERT_LOG(false, "as_int() type conversion error from " << type_as_string() << " to int");
	return 0;
}
void
qt_tm_embedded_widget_rep::send (slot s, blackbox val) {

  switch (s) {
    case SLOT_INVALIDATE:
    case SLOT_INVALIDATE_ALL:
    case SLOT_EXTENTS:
    case SLOT_SCROLL_POSITION:
    case SLOT_ZOOM_FACTOR:
    case SLOT_MOUSE_GRAB:
      main_widget->send(s, val);
      return;

       /// FIXME: decide what to do with these for embedded widgets
    case SLOT_HEADER_VISIBILITY:
    case SLOT_MAIN_ICONS_VISIBILITY:    
    case SLOT_MODE_ICONS_VISIBILITY:
    case SLOT_FOCUS_ICONS_VISIBILITY:
    case SLOT_USER_ICONS_VISIBILITY:
    case SLOT_FOOTER_VISIBILITY:
    case SLOT_SIDE_TOOLS_VISIBILITY:
    case SLOT_BOTTOM_TOOLS_VISIBILITY:
    case SLOT_LEFT_FOOTER:
    case SLOT_RIGHT_FOOTER:
    case SLOT_SCROLLBARS_VISIBILITY:
    case SLOT_INTERACTIVE_MODE:
    case SLOT_FILE:
      break;
 
    case SLOT_DESTROY:
    {
      ASSERT (is_nil (val), "type mismatch");
      if (!is_nil (quit))
        quit ();
      the_gui->need_update ();
    }
      break;
      
    default:
      qt_widget_rep::send (s, val);
      return;
  }
  if (DEBUG_QT_WIDGETS)
    debug_widgets << "qt_tm_embedded_widget_rep: sent " << slot_name (s) 
                  << "\t\tto widget\t" << type_as_string() << LF;  
}
void
qt_popup_widget_rep::send (slot s, blackbox val) {

  switch (s) {
    case SLOT_SIZE:
    {
      check_type<coord2>(val, s);
      qwid->resize (to_qsize (open_box<coord2> (val)));
    }
      break;
      
    case SLOT_POSITION:
    {
      check_type<coord2>(val, s);
      qwid->move (to_qpoint (open_box<coord2> (val)));
    }
      break;
      
    case SLOT_VISIBILITY:
    {
      check_type<bool> (val, s);
      qwid->setVisible(open_box<bool> (val));
    }
      break;
      
      //FIXME: what's this?
    case SLOT_MOUSE_GRAB:
    {   
      check_type<bool> (val, s);
      bool flag = open_box<bool> (val);  // true= get grab, false= release grab
      
      qwid->hide();
      if (flag) qwid->setWindowModality(Qt::WindowModal); //ok?
      else      qwid->setWindowModality(Qt::NonModal);    //ok?
      qwid->show();
    }   
      break;

    default:
      qt_widget_rep::send(s, val);
  }
  
  if (DEBUG_QT_WIDGETS)
    debug_widgets << "qt_popup_widget_rep: sent " << slot_name (s) 
                  << "\t\tto widget\t"         << type_as_string() << LF;
}
widget
qt_tm_embedded_widget_rep::read (slot s, blackbox index) {
  widget ret;
  
  switch (s) {
    case SLOT_CANVAS:
      check_type_void (index, s);
      ret = main_widget;
      break;
    default:
      return qt_widget_rep::read(s, index);
  }
  
  if (DEBUG_QT_WIDGETS)
    debug_widgets << "qt_tm_widget_rep::read " << slot_name (s) 
                  << "\t\tfor widget\t" << type_as_string() << LF;
  
  return ret;
}
Exemple #12
0
std::string node::as_string() const
{
	switch(type()) {
	case NODE_TYPE_STRING:
		return s_;
	case NODE_TYPE_INTEGER: {
		std::stringstream s;
		s << i_;
		return s.str();
	}
	case NODE_TYPE_FLOAT: {
		std::stringstream s;
		s << f_;
		return s.str();
	}
	default: break;
	}
	ASSERT_LOG(false, "as_string() type conversion error from " << type_as_string() << " to string");
	return "";
}
Exemple #13
0
bool node::as_bool() const
{
	switch(type()) {
	case NODE_TYPE_INTEGER:
		return i_ ? true : false;
	case NODE_TYPE_FLOAT:
		return f_ == 0.0f ? false : true;
	case NODE_TYPE_BOOL:
		return b_;
	case NODE_TYPE_STRING:
		return s_.empty() ? false : true;
	case NODE_TYPE_LIST:
		return l_.empty() ? false : true;
	case NODE_TYPE_MAP:
		return m_.empty() ? false : true;
	default: break;
	}
	ASSERT_LOG(false, "as_bool() type conversion error from " << type_as_string() << " to boolean");
	return 0;
}
Exemple #14
0
node_map& node::as_mutable_map()
{
	ASSERT_LOG(type() == NODE_TYPE_MAP, "as_mutable_map() type conversion error from " << type_as_string() << " to map");
	return m_;
}
Exemple #15
0
bool node::has_key(const std::string& key) const
{
	ASSERT_LOG(type() == NODE_TYPE_MAP, "Tried to index node that isn't a map, was: " << type_as_string());
	return m_.find(node(key)) != m_.end() ? true : false;
}
Exemple #16
0
node node::operator()(node args)
{
	ASSERT_LOG(type() == NODE_TYPE_FUNCTION, "Tried to execute node that wasn't a function, was: " << type_as_string());
	return fn_(args);
}
Exemple #17
0
const node& node::operator[](const std::string& key) const
{
	ASSERT_LOG(type() == NODE_TYPE_MAP, "Tried to index node that isn't a map, was: " << type_as_string());
	auto it = m_.find(node(key));
	ASSERT_LOG(it != m_.end(), "Couldn't find key(" << key << ") in map");
	return it->second;
}
Exemple #18
0
const node& node::operator[](size_t n) const
{
	ASSERT_LOG(type() == NODE_TYPE_LIST, "Tried to index node that isn't a list, was: " << type_as_string());
	ASSERT_LOG(n < l_.size(), "Tried to index a list outside of list bounds: " << n << " >= " << l_.size());
	return l_[n];
}
Exemple #19
0
node_list& node::as_mutable_list()
{
	ASSERT_LOG(type() == NODE_TYPE_LIST, "as_mutable_list() type conversion error from " << type_as_string() << " to list");
	return l_;
}
Exemple #20
0
void
cxx_print_type (FILE *file, tree node, int indent)
{
  switch (TREE_CODE (node))
    {
    case TEMPLATE_TYPE_PARM:
    case TEMPLATE_TEMPLATE_PARM:
    case BOUND_TEMPLATE_TEMPLATE_PARM:
      indent_to (file, indent + 3);
      fprintf (file, "index %d level %d orig_level %d",
	       TEMPLATE_TYPE_IDX (node), TEMPLATE_TYPE_LEVEL (node),
	       TEMPLATE_TYPE_ORIG_LEVEL (node));
      return;

    case FUNCTION_TYPE:
    case METHOD_TYPE:
      if (TYPE_RAISES_EXCEPTIONS (node))
	print_node (file, "throws", TYPE_RAISES_EXCEPTIONS (node), indent + 4);
      return;

    case RECORD_TYPE:
    case UNION_TYPE:
      break;

    case DECLTYPE_TYPE:
      print_node (file, "expr", DECLTYPE_TYPE_EXPR (node), indent + 4);
      return;

    case TYPENAME_TYPE:
      print_node (file, "fullname", TYPENAME_TYPE_FULLNAME (node),
		  indent + 4);
      return;

    case TYPE_PACK_EXPANSION:
      print_node (file, "args", PACK_EXPANSION_EXTRA_ARGS (node), indent + 4);
      return;

    default:
      return;
    }

  if (TYPE_PTRMEMFUNC_P (node))
    print_node (file, "ptrmemfunc fn type", TYPE_PTRMEMFUNC_FN_TYPE (node),
		indent + 4);

  if (! CLASS_TYPE_P (node))
    return;

  indent_to (file, indent + 4);
  fprintf (file, "full-name \"%s\"",
	   type_as_string (node, TFF_CLASS_KEY_OR_ENUM));

  indent_to (file, indent + 3);

  if (TYPE_NEEDS_CONSTRUCTING (node))
    fputs ( " needs-constructor", file);
  if (TYPE_HAS_NONTRIVIAL_DESTRUCTOR (node))
    fputs (" needs-destructor", file);
  if (TYPE_HAS_DEFAULT_CONSTRUCTOR (node))
    fputs (" X()", file);
  if (TYPE_HAS_CONVERSION (node))
    fputs (" has-type-conversion", file);
  if (TYPE_HAS_COPY_CTOR (node))
    {
      if (TYPE_HAS_CONST_COPY_CTOR (node))
	fputs (" X(constX&)", file);
      else
	fputs (" X(X&)", file);
    }
  if (TYPE_HAS_NEW_OPERATOR (node))
    fputs (" new", file);
  if (TYPE_HAS_ARRAY_NEW_OPERATOR (node))
    fputs (" new[]", file);
  if (TYPE_GETS_DELETE (node) & 1)
    fputs (" delete", file);
  if (TYPE_GETS_DELETE (node) & 2)
    fputs (" delete[]", file);
  if (TYPE_HAS_COPY_ASSIGN (node))
    fputs (" this=(X&)", file);
  if (CLASSTYPE_SORTED_FIELDS (node))
    fprintf (file, " sorted-fields %p",
	     (void *) CLASSTYPE_SORTED_FIELDS (node));

  if (TREE_CODE (node) == RECORD_TYPE)
    {
      if (TYPE_BINFO (node))
	fprintf (file, " n_parents=%d",
		 BINFO_N_BASE_BINFOS (TYPE_BINFO (node)));
      else
	fprintf (file, " no-binfo");

      fprintf (file, " use_template=%d", CLASSTYPE_USE_TEMPLATE (node));
      if (CLASSTYPE_INTERFACE_ONLY (node))
	fprintf (file, " interface-only");
      if (CLASSTYPE_INTERFACE_UNKNOWN (node))
	fprintf (file, " interface-unknown");
    }
}
void
qt_tm_widget_rep::send (slot s, blackbox val) {
  switch (s) {
    case SLOT_INVALIDATE:
    case SLOT_INVALIDATE_ALL:
    case SLOT_EXTENTS:
    case SLOT_SCROLL_POSITION:
    case SLOT_ZOOM_FACTOR:
    case SLOT_MOUSE_GRAB:
      main_widget->send(s, val);
      return;
    case SLOT_KEYBOARD_FOCUS:
    {
      check_type<bool> (val, s);
      bool focus = open_box<bool> (val);
      if (focus && canvas() && !canvas()->hasFocus())
        canvas()->setFocus (Qt::OtherFocusReason);
    }
      break;
    case SLOT_HEADER_VISIBILITY:
    {
      check_type<bool>(val, s);
      visibility[0] = open_box<bool> (val);
      update_visibility();
    }
      break;
    case SLOT_MAIN_ICONS_VISIBILITY:
    {
      check_type<bool>(val, s);
      visibility[1] = open_box<bool> (val);
      update_visibility();
    }
      break;
    case SLOT_MODE_ICONS_VISIBILITY:
    {
      check_type<bool>(val, s);
      visibility[2] = open_box<bool> (val);
      update_visibility();
    }
      break;
    case SLOT_FOCUS_ICONS_VISIBILITY:
    {
      check_type<bool>(val, s);
      visibility[3] = open_box<bool> (val);
      update_visibility();
    }
      break;
    case SLOT_USER_ICONS_VISIBILITY:
    {
      check_type<bool>(val, s);
      visibility[4] = open_box<bool> (val);
      update_visibility();
    }
      break;

    case SLOT_FOOTER_VISIBILITY:
    {
      check_type<bool>(val, s);
      visibility[5] = open_box<bool> (val);
      update_visibility();
    }
      break;
    case SLOT_SIDE_TOOLS_VISIBILITY:
    {
      check_type<bool>(val, s);
      visibility[6] = open_box<bool> (val);
      update_visibility();
    }
      break;
    case SLOT_BOTTOM_TOOLS_VISIBILITY:
    {
      check_type<bool>(val, s);
      visibility[7] = open_box<bool> (val);
      update_visibility();
    }
      break;

    case SLOT_LEFT_FOOTER:
    {
      check_type<string>(val, s);
      string msg = open_box<string> (val);
      leftLabel->setText (to_qstring (msg));
      leftLabel->update ();
    }
      break;
    case SLOT_RIGHT_FOOTER:
    {
      check_type<string>(val, s);
      string msg= open_box<string> (val);
      rightLabel->setText (to_qstring (msg));
      rightLabel->update ();
    }
      break;
    case SLOT_SCROLLBARS_VISIBILITY:
        // ignore this: qt handles scrollbars independently
        //                send_int (THIS, "scrollbars", val);
      break;
    case SLOT_INTERACTIVE_MODE:
    {
      check_type<bool>(val, s);

      if (open_box<bool> (val) == true) {
        prompt = new QTMInteractivePrompt (int_prompt, int_input);
        mainwindow()->statusBar()->removeWidget (leftLabel);
        mainwindow()->statusBar()->removeWidget (rightLabel);
        mainwindow()->statusBar()->addWidget (prompt, 1);
        prompt->start();
      } else {
        if (prompt) prompt->end();
        mainwindow()->statusBar()->removeWidget (prompt);
        mainwindow()->statusBar()->addWidget (leftLabel);
        mainwindow()->statusBar()->addPermanentWidget (rightLabel);
        leftLabel->show();
        rightLabel->show();
        prompt->deleteLater();
        prompt = NULL;
      }
    }
      break;
    case SLOT_FILE:
    {
      check_type<string>(val, s);
      string file = open_box<string> (val);
      if (DEBUG_QT_WIDGETS) debug_widgets << "\tFile: " << file << LF;
#if (QT_VERSION >= 0x040400)
      mainwindow()->setWindowFilePath (utf8_to_qstring (file));
#endif
    }
      break;
    case SLOT_POSITION:
    {
      check_type<coord2>(val, s);
      coord2 p= open_box<coord2> (val);
      mainwindow()->move (to_qpoint (p));
    }
      break;
    case SLOT_SIZE:
    {
      check_type<coord2>(val, s);
      coord2 p= open_box<coord2> (val);
      mainwindow()->resize (to_qsize (p));
    }
      break;
    case SLOT_DESTROY:
    {
      ASSERT (is_nil (val), "type mismatch");
      if (!is_nil (quit))
        quit ();
      the_gui->need_update ();
    }
      break;
    case SLOT_FULL_SCREEN:
    {
      check_type<bool> (val, s);
      set_full_screen(open_box<bool> (val));
    }
      break;
    default:
      qt_window_widget_rep::send (s, val);
      return;
  }
  
  if (DEBUG_QT_WIDGETS)
    debug_widgets << "qt_tm_widget_rep: sent " << slot_name (s) 
                  << "\t\tto widget\t"      << type_as_string() << LF;
}
blackbox
qt_tm_widget_rep::query (slot s, int type_id) {
  if (DEBUG_QT_WIDGETS)
    debug_widgets << "qt_tm_widget_rep: queried " << slot_name(s)
                  << "\t\tto widget\t" << type_as_string() << LF;
  
  switch (s) {
    case SLOT_SCROLL_POSITION:
    case SLOT_EXTENTS:
    case SLOT_VISIBLE_PART:
    case SLOT_ZOOM_FACTOR:
      return main_widget->query(s, type_id);

    case SLOT_HEADER_VISIBILITY:
      check_type_id<bool> (type_id, s);
      return close_box<bool> (visibility[0]);
      
    case SLOT_MAIN_ICONS_VISIBILITY:
      check_type_id<bool> (type_id, s);
      return close_box<bool> (visibility[1]);
    
    case SLOT_MODE_ICONS_VISIBILITY:
      check_type_id<bool> (type_id, s);
      return close_box<bool> (visibility[2]);

    case SLOT_FOCUS_ICONS_VISIBILITY:
      check_type_id<bool> (type_id, s);
      return close_box<bool> (visibility[3]);      

    case SLOT_USER_ICONS_VISIBILITY:
      check_type_id<bool> (type_id, s);
      return close_box<bool> (visibility[4]);
      
    case SLOT_FOOTER_VISIBILITY:
      check_type_id<bool> (type_id, s);
      return close_box<bool> (visibility[5]);

    case SLOT_SIDE_TOOLS_VISIBILITY:
      check_type_id<bool> (type_id, s);
      return close_box<bool> (visibility[6]);
    case SLOT_BOTTOM_TOOLS_VISIBILITY:
      check_type_id<bool> (type_id, s);
      return close_box<bool> (visibility[7]);
      
    case SLOT_INTERACTIVE_INPUT:
    {
      check_type_id<string> (type_id, s);
      qt_input_text_widget_rep* w = 
        static_cast<qt_input_text_widget_rep*> (int_input.rep);
      if (w->ok)
        return close_box<string> (scm_quote (w->input));
      else
        return close_box<string> ("#f");
    }

    case SLOT_POSITION:
    {
      check_type_id<coord2> (type_id, s);
      return close_box<coord2> (from_qpoint (mainwindow()->pos()));
    }
      
    case SLOT_SIZE:
    {
      check_type_id<coord2> (type_id, s);
      return close_box<coord2> (from_qsize (mainwindow()->size()));
    }

    case SLOT_INTERACTIVE_MODE:
      check_type_id<bool> (type_id, s);
      return close_box<bool> (prompt && prompt->isActive());

    default:
      return qt_window_widget_rep::query (s, type_id);
  }
}
Exemple #23
0
const node_fn node::as_function() const
{
	ASSERT_LOG(type() == NODE_TYPE_FUNCTION, "as_function() type conversion error from " << type_as_string() << " to function");
	return fn_;
}
Exemple #24
0
 void serialize(Ar& ar) {
     std::string t = type_as_string();
     ar
     & JUBA_NAMED_MEMBER("type", t)
     & JUBA_NAMED_MEMBER("bit_vector_length", bit_vector_length_);
 }
Exemple #25
0
void attribute::set( const std::string& value )
{
    VmbErrorType status = VmbErrorSuccess;

    if( comma::verbose )
    {
        std::cerr << "Setting \"" << name_ << "\" feature";
        if( !value.empty() )
        {
            std::cerr << " to " << type_as_string() << " value \"" << value << "\"";
        }
        std::cerr << std::endl;
    }

    switch( type_ )
    {
        case VmbFeatureDataUnknown:               // Unknown feature type
            COMMA_THROW( comma::exception, "unknown feature \"" << name_ << "\"" );
            break;
        case VmbFeatureDataInt:                   // 64 bit integer feature
            status = feature_->SetValue( boost::lexical_cast< VmbInt64_t >( value ));
            break;
        case VmbFeatureDataFloat:                 // 64 bit floating point feature
            status = feature_->SetValue( boost::lexical_cast< double >( value ));
            break;
        case VmbFeatureDataEnum:                  // Enumeration feature
        case VmbFeatureDataString:                // String feature
            status = feature_->SetValue( value.c_str() );
            break;
        case VmbFeatureDataBool:                  // Boolean feature
            status = feature_->SetValue( boost::lexical_cast< bool >( value ));
            break;
        case VmbFeatureDataCommand:               // Command feature
            status = feature_->RunCommand();
            if( status == VmbErrorSuccess )
            {
                bool is_command_done = false;
                do
                {
                    status = feature_->IsCommandDone( is_command_done );
                    if( status != VmbErrorSuccess ) break;
                } while( !is_command_done );
            }
            break;
        case VmbFeatureDataRaw:                   // Raw (direct register access) feature
            COMMA_THROW( comma::exception, "feature \"" << name_ << "\" is a direct register - setting this type is unsupported" );
            break;
        case VmbFeatureDataNone:                  // Feature with no data
            COMMA_THROW( comma::exception, "feature \"" << name_ << "\" has no data" );
            break;
    }

    if( status != VmbErrorSuccess )
    {
        std::string allowed_error_msg;
        if( !allowed_values_.empty() )
        {
            allowed_error_msg = "; allowed values: ";
            allowed_error_msg += allowed_values_as_string();
        }
        COMMA_THROW( comma::exception
                   , "failed to set feature \"" << name_ << " to " << value
                   << ", Error: " << status << ": " << error_code_to_string( status )
                   << allowed_error_msg );
    }
}