Beispiel #1
0
int main()
{
	Stack st1;
	Stack st2(st1);
	Stack st3;

	cout << st1.isempty() << endl;
	
	st1.push(12123124);
	st1.push(12222222);
	st1.push(33333333);
	cout << "St1: " << endl;
	st1.showItems();

	st2 = Stack(st1);
	cout << "St2: " << endl;
	st2.showItems();

	st1 = Stack();
	cout << "St1 empty:" << endl;
	st1.showItems();

	cout << endl;

	cout << "St2: " << endl;
	st2.showItems();

	st3 = st2;
	cout << "St3: " << endl;
	st3.showItems();

	system("Pause");
    return 0; 
}
Beispiel #2
0
StackOwningThreadInfo::~StackOwningThreadInfo()
{
  PseudoStack* stack = Stack();
  if (stack) {
    stack->deref();
  }
}
Beispiel #3
0
static int Clump_2d (Interval *itvs, int n_itvs, void *parms, int flags) {
    int cnt, i;

    Set_offsets (itvs, n_itvs);

    Stack (STACK_INIT, NULL);
    cnt = 0;
    for (i = 0; i < n_itvs; i++) {
	Params_t *pms;
	if (itvs[i].id != 0)
	    continue;

	if (flags & VDC_PARM_ARRAY)
	    pms = ((Params_t **)parms)[itvs[i].row];
	else
	    pms = (Params_t *)parms;
	if (pms != NULL) {		/* threshold for azimuth direction */
	    Nyq = pms->nyq;
	    Thrl = pms->max_shear;
	    Thrh = Nyq * 2 - pms->am_shear;
	}
	else
	    Nyq = Thrl = Thrh = 0;

	cnt++;
	Mark_connnected_itvs (itvs, n_itvs, i, cnt);
    }
    return (cnt);
}
Beispiel #4
0
static void Mark_connnected_itvs (Interval *its, int n_itvs, 
						int ind, int value) {
    Interval *itend, *prev_it;
    int nind;

    its[ind].id = value;
    Stack (STACK_PUSH, &ind);
    prev_it = its + ind;

    itend = its + n_itvs;
    while (Stack (STACK_POP, &nind)) {
	Interval *nit, *it;
	int end, row, i;

	nit = its + nind;
	end = nit->end;
	if (nit->prev > 0) {
	    it = nit - nit->prev;
	    row = it->row;
	    while (it->row == row && it->begin <= end) {
		if (it->id == 0 && Check_conn (it, nit)) {
		    it->id = value;
		    i = it - its;
		    Stack (STACK_PUSH, &i);
		    prev_it->nind = i;
		    prev_it = it;
		}
		it++;
	    }
	}
	if (nit->next > 0) {
	    it = nit + nit->next;
	    row = it->row;
	    while (it < itend && it->row == row && it->begin <= end) {
		if (it->id == 0 && Check_conn (it, nit)) {
		    it->id = value;
		    i = it - its;
		    Stack (STACK_PUSH, &i);
		    prev_it->nind = i;
		    prev_it = it;
		}
		it++;
	    }
	}
    }
    return;
}
Beispiel #5
0
Wt::WWidget *Navigation::stackedWidget()
{
  Wt::WTemplate *result = new TopicTemplate("navigation-stackedWidget");

  result->bindWidget("Stack", Stack());

  return result;
}
Beispiel #6
0
void
StackOwningThreadInfo::SetPendingDelete()
{
  PseudoStack* stack = Stack();
  if (stack) {
    stack->deref();
  }
  ThreadInfo::SetPendingDelete();
}
Beispiel #7
0
		void RPGApplication::LoadingStackTransition(const std::string& scene, const Engine::ESceneArgsPTR& params){
			LOG("[RPGApplication] LoadingStackTransition\n");
			args->scene = scene;
			args->send_params = params;
			args->type = TransitionType::LOADING_STACK;
			Stack(loadingscene_id, *args);

			args->send_params = nullptr;
		}
Beispiel #8
0
		void RPGApplication::FadeSwitchTransition(const std::string& scene, const Engine::ESceneArgsPTR& params){
			LOG("[RPGApplication] FadeSwitchTransition\n");
			args->scene = scene;
			args->send_params = params;
			args->type = TransitionType::FADE_SWITCH;
			Stack(loadingscene_id, *args);

			args->send_params = nullptr;
		}
Beispiel #9
0
void Test_Stack_PushPop() {
    const unsigned count = 5;
    PStack stack = Stack()->new(sizeof (unsigned));
    Stack()->set_capacity(stack, count);

    for (unsigned i = 0; i < count; i++) {
        Stack()->push(stack, &i);
    }

    TEST_ASSERT(Stack()->get_count(stack) == count)

    for (unsigned i = 1; i <= count; i++) {
        unsigned item = 0;
        Stack()->pop(stack, &item);
        TEST_ASSERT(item == (count - i));
    }

    Stack()->free(stack);
}
Matrix SphericalJoint::GetBackward_sP(){
	cout<<" -----------"<<endl;
	cout<<"Am I coming here "<<endl;
	cout<<" -----------"<<endl;	
  Mat3x3 sPa,sPl;
  Matrix sP;
  sPa.Identity();    
  sPl.Zeros();          
  sPl(3,2)=(point2->position(1));  
  sPl(2,3)=-(point2->position(1));   
  sP=Stack(sPa,sPl);
  return sP;    
}
Beispiel #11
0
const std::string CJavascriptException::GetStackTrace(void)
{
  assert(m_isolate->InContext());

  v8::HandleScope handle_scope(m_isolate);

  if (!m_stack.IsEmpty())
  {
    v8::String::Utf8Value stack(v8::Handle<v8::String>::Cast(Stack()));

    return std::string(*stack, stack.length());
  }

  return std::string();
}
Beispiel #12
0
		Stack::Stack(ICollection* col)
		{
			Stack((!col) ? 0x20 : col->Count());

			if (!col)
			{
#if DEBUG
				printf("ARGUMENT_NULL in function %s, at line %i in file %s, argument \"%s\"\n", __FUNCTION__, __LINE__, __FILE__, "col");
#endif
				return;
			}

			for (int i = 0; i < col->Count(); i++)
			{
				
				// TODO: Push all values in the ICollection into this Stack.
			}
		}
Matrix SphericalJoint::GetForward_sP(){  
  Mat3x3 sPa,sPl;
  Matrix sP(6,3);
  sPa.Identity();    
  sPl.Zeros();
  Vect3 temp = -(point2->position);  
  
  sPl(1,2) = temp(3);
  sPl(1,3) = -temp(2);
  
  sPl(2,1) = -temp(3);
  sPl(2,3) = temp(1);
  
  sPl(3,1) = temp(2);  
  sPl(3,2) = -temp(1);
         
  sP=Stack(sPa,sPl);  
  return sP;    
}
Beispiel #14
0
Scoped<string> Error::ToString() {
	Scoped<string> res(new string(""));
	*res += *message;
	*res += *Stack();
	return res;
}