+Batch::~Batch()
+{
+}
+
+void Batch::set_data_type(DataType t)
+{
+ if(t!=UNSIGNED_BYTE && t!=UNSIGNED_SHORT && t!=UNSIGNED_INT)
+ throw invalid_argument("Batch::set_data_type");
+ if(t==UNSIGNED_BYTE && max_index>0xFE)
+ throw invalid_operation("Batch::set_data_type");
+ else if(t==UNSIGNED_SHORT && max_index>0xFFFE)
+ throw invalid_operation("Batch::set_data_type");
+
+ if(data_type==UNSIGNED_BYTE && t==UNSIGNED_SHORT)
+ expand<unsigned char, unsigned short>(data);
+ else if(data_type==UNSIGNED_BYTE && t==UNSIGNED_INT)
+ expand<unsigned char, unsigned>(data);
+ else if(data_type==UNSIGNED_SHORT && t==UNSIGNED_INT)
+ expand<unsigned short, unsigned>(data);
+ else if(data_type==UNSIGNED_INT && t==UNSIGNED_BYTE)
+ shrink<unsigned, unsigned char>(data);
+ else if(data_type==UNSIGNED_INT && t==UNSIGNED_SHORT)
+ shrink<unsigned, unsigned short>(data);
+ else if(data_type==UNSIGNED_SHORT && t==UNSIGNED_BYTE)
+ shrink<unsigned short, unsigned char>(data);
+
+ data_type = t;
+ update_offset();
+ dirty = true;
+}
+
+Batch &Batch::append(unsigned i)
+{
+ append_index(i);
+
+ update_offset();
+ dirty = true;
+
+ return *this;
+}
+
+Batch &Batch::append(const vector<unsigned> &ind)