Ejemplo n.º 1
0
/** Move attached rows to somewhere else in same storage
 *
 * There is a lot of trickery going on here.  The whole point of this
 * code is that moving rows between (compatible!) subviews should not
 * use copying when potentially large memo's and subviews are involved.
 * In that case, the best solution is really to move pointers, not data.
 */
void c4_View::RelocateRows(int from_, int count_, c4_View& dest_, int pos_)
{
  if (count_ < 0)
    count_ = GetSize() - from_;
  if (pos_ < 0)
    pos_ = dest_.GetSize();

  d4_assert(0 <= from_ && from_ <= GetSize());
  d4_assert(0 <= count_ && from_ + count_ <= GetSize());
  d4_assert(0 <= pos_ && pos_ <= dest_.GetSize());

  if (count_ > 0) {
      // the destination must not be inside the source rows
    d4_assert(&dest_ != this || from_ > pos_ || pos_ >= from_ + count_);

      // this test is slow, so do it only as a debug check
    d4_assert(IsCompatibleWith(dest_));

      // make space, swap rows, drop originals
    c4_Row empty;
    dest_.InsertAt(pos_, empty, count_);

      // careful if insert moves origin
    if (&dest_ == this && pos_ <= from_)
      from_ += count_;

    for (int i = 0; i < count_; ++i)
      ((c4_HandlerSeq*) _seq)->ExchangeEntries(from_ + i,
				*(c4_HandlerSeq*) dest_._seq, pos_ + i);

    RemoveAt(from_, count_);
  }
}
Ejemplo n.º 2
0
	LipsyncController::LipsyncController(const attrib::Pose &pose) :
		TargetController(AnimationLayer::preCollision, .25)
	{
		assert(IsCompatibleWith(pose));
	}