예제 #1
0
void DrawGimbal(glutil::MatrixStack &currMatrix, GimbalAxis eAxis, glm::vec4 baseColor)
{
	if(!g_bDrawGimbals)
		return;

	glutil::PushStack pusher(currMatrix);

	switch(eAxis)
	{
	case GIMBAL_X_AXIS:
		break;
	case GIMBAL_Y_AXIS:
		currMatrix.RotateZ(90.0f);
		currMatrix.RotateX(90.0f);
		break;
	case GIMBAL_Z_AXIS:
		currMatrix.RotateY(90.0f);
		currMatrix.RotateX(90.0f);
		break;
	}

	glUseProgram(theProgram);
	//Set the base color for this object.
	glUniform4fv(baseColorUnif, 1, glm::value_ptr(baseColor));
	glUniformMatrix4fv(modelToCameraMatrixUnif, 1, GL_FALSE, glm::value_ptr(currMatrix.Top()));

	g_Gimbals[eAxis]->Render();

	glUseProgram(0);
}
예제 #2
0
void BasicThread::DoRun(std::shared_ptr<Object>&& refTracker) {
  assert(m_running);

  // Make our own session current before we do anything else:
  CurrentContextPusher pusher(GetContext());

  // Set the thread name no matter what:
  if(GetName())
    SetCurrentThreadName();

  // Now we wait for the thread to be good to go:
  try {
    Run();
  }
  catch(dispatch_aborted_exception&) {
    // Okay, this is fine, a dispatcher is terminating--this is a normal way to
    // end a dispatcher loop.
  }
  catch(...) {
    try {
      // Ask that the enclosing context filter this exception, if possible:
      GetContext()->FilterException();
    }
    catch(...) {
      // Generic exception, unhandled, we can't do anything about this
    }

    // Signal shutdown on the enclosing context--cannot wait, if we wait we WILL deadlock
    GetContext()->SignalShutdown(false);
  }

  // Run loop is over, time to clean up
  DoRunLoopCleanup(pusher.Pop(), std::move(refTracker));
}
예제 #3
0
TEST_F(ContextCreatorTest, ClearAndTeardown) {
  // Create a context and verify it gets evicted from the context creator:

  std::weak_ptr<CoreContext> ctxtWeak;

  {
    AutoCreateContext mainContext;
    CurrentContextPusher pusher(mainContext);

    AutoRequired<Creator> creator;
    std::shared_ptr<CoreContext> ctxt;

    // Make a sub-context
    ctxt = creator->CreateContext(0).first;

    // Obtain a weak pointer, in order to ensure proper teardown:
    ctxtWeak = ctxt;

    //Call clear on the creator.
    creator->Clear(true);

    //Make another one!
    ctxt = creator->CreateContext(1).first;
    //Let the creator go out of scope
  }

  // Context must be destroyed as a precondition of the subsequent assertion
  ASSERT_TRUE(ctxtWeak.expired()) << "Expected the context to be destroyed";

  // Verify that our creator is now empty:
 // ASSERT_EQ(0UL, creator->GetSize()) << "Context creator is non-empty after all created contexts were destroyed";
}
예제 #4
0
TEST_F(ContextCreatorTest, TeardownListenerTest) {
  // Create a context and verify teardown happens as expected
  AutoCreateContext mainContext;
  CurrentContextPusher pusher(mainContext);

  AutoRequired<ContextCreator<mySigil, int>> creator;
  {
    auto subctxt = creator->CreateContext(0).first;
    auto brc = subctxt->Inject<Runnable>();
    subctxt->Initiate();
  }
  creator->Clear(true);
  ASSERT_TRUE(true) << "Really all this test has to do is not crash by this point.";
}
예제 #5
0
/**
 * Files are ordered by log.XXX.YYY where XXX is the boot count and YYY is the sequence number
 * Files are rotated by incrementing the YYY within a single boot count.
 * The oldest file is then the least XXX and the least YYY
 *
 * busyrotate assumes the system time is corrupt, and starts over at each
 * power cycle.
 *
 */
log_pattern find_oldest_file(std::string dir)
{
    std::priority_queue<log_pattern,
        std::vector<log_pattern>,
        std::greater<log_pattern>> q;

    dirlist(dir, pusher(q));
    auto t = q.top();
    while(t.is_active)
    {
        q.pop();
        t = q.top();
    }
    return t;
}
예제 #6
0
 inline template<typename T> void push(const T &t) {
   janus_data_stack_pusher<stack_t, T> pusher;
   pusher(raw_stack(), t);
 }