Пример #1
0
void ClassList::DebugPrint() {
   DEBUG_M("SharedId:\t\tClass Name:\tMemory Address:");
   for(ClassesMap::const_iterator it = classes_.begin(); it != classes_.end(); ++it) {
      DEBUG_M("%d\t%s\t%p", it->first, it->second->getClassName().c_str(), it->second);
   }
   std::cout << std::endl; 
}
Пример #2
0
GameObject::~GameObject() {
   DEBUG_M("Entering deconstructor...");
   if(area_) {
      area_->removeObject(GameObjectPtr(this));
   }
   DEBUG_M("Exiting deconstructor...");
}
Пример #3
0
/**
 * Reads a float array, such as verticies, normals, text cords, etc...
 * @param tempory The ModelTempory struct to hold the array.
 * @param mesh The mesh using the floats
 * @param xnode The XML node containing the data.
 * @return 
 */
FloatArray* RCBC_MiniXML_ProcessGeometries_Mesh_FloatArray(ModelTempory *tempory, Mesh *mesh, mxml_node_t *xnode) {
	DEBUG_M("Entering function...");

	const char* id = mxmlElementGetAttr(xnode, "id");
	const char* count_s = mxmlElementGetAttr(xnode, "count");
	int count = atoi(count_s);

	FloatArray* newarray = NEW(FloatArray, count);
	if(!newarray) {
		return NULL;
	}

	GLfloat f = 0.0f;
	int i = 0;
	char* pch = strtok(xnode->child->value.opaque, " ");
	while(pch && i < count) {
		sscanf(pch, "%f", &f);
		newarray->values[i] = f;
		pch = strtok(NULL, " ");
		i++;
	}

	ListAdd(tempory->deleteme, newarray);

	DEBUG_M("exiting function");
	return newarray;
}
Пример #4
0
void Transaction::release(uint64_t thd_id) {
  DEBUG("Transaction release\n");
  release_accesses(thd_id);
  DEBUG_M("Transaction::release array accesses free\n")
  accesses.release();
  release_inserts(thd_id);
  DEBUG_M("Transaction::release array insert_rows free\n")
  insert_rows.release();
}
Пример #5
0
void Transaction::release_inserts(uint64_t thd_id) {
  for(uint64_t i = 0; i < insert_rows.size(); i++) {
    row_t * row = insert_rows[i];
#if CC_ALG != MAAT && CC_ALG != OCC
    DEBUG_M("TxnManager::cleanup row->manager free\n");
    mem_allocator.free(row->manager, 0);
#endif
    row->free_row();
    DEBUG_M("Transaction::release insert_rows free\n")
    row_pool.put(thd_id,row);
  }
}
Пример #6
0
void Transaction::init() {
  timestamp = UINT64_MAX;
  start_timestamp = UINT64_MAX;
  end_timestamp = UINT64_MAX;
  txn_id = UINT64_MAX;
  batch_id = UINT64_MAX;
  DEBUG_M("Transaction::init array insert_rows\n");
  insert_rows.init(g_max_items_per_txn + 10); 
  DEBUG_M("Transaction::reset array accesses\n");
  accesses.init(MAX_ROW_PER_TXN);  

  reset(0);
}
Пример #7
0
void Initializer::initialize() {
   if(is_initialized_) {
      DEBUG_M("Already initialized this list...");
      return;
   }

   for(VoidFunction vf : init_list_) {
      if(vf) {
         vf();
      } else {
         DEBUG_M("Bad function in initializing list!");
      }
   }
   is_initialized_ = true;
}
Пример #8
0
/**
 * Model Deconstructor.
 * @param model Model to free.
 * @see Model
 * @see Model_Model()
 * \memberof Model
 */
void Model_0Model(Model* model) {

	DEBUG_M("Entering function...");

	DEBUG_M("Deleting visual scene %p...", model->visual_scene);
	DELETE(model->visual_scene);

	DEBUG_M("Deleting geometries...");
	//List_DeleteData(model->geometries); //This is handled by List_DeleteMissing and the SceneNode
	List_NullifyData(model->geometries);
	DELETE(model->geometries);

	DEBUG_M("freeing self...");
	free(model);
}
Пример #9
0
// Return call for get_row if waiting 
RC row_t::get_row_post_wait(access_t type, TxnManager * txn, row_t *& row) {

  RC rc = RCOK;
  assert(CC_ALG == WAIT_DIE || CC_ALG == MVCC || CC_ALG == TIMESTAMP);
#if CC_ALG == WAIT_DIE
  assert(txn->lock_ready);
	rc = RCOK;
	//ts_t endtime = get_sys_clock();
	row = this;

#elif CC_ALG == MVCC || CC_ALG == TIMESTAMP
			assert(txn->ts_ready);
			//INC_STATS(thd_id, time_wait, t2 - t1);
			row = txn->cur_row;

			assert(row->get_data() != NULL);
			assert(row->get_table() != NULL);
			assert(row->get_schema() == this->get_schema());
			assert(row->get_table_name() != NULL);
	if (CC_ALG == MVCC && type == WR) {
    DEBUG_M("row_t::get_row_post_wait MVCC alloc \n");
		row_t * newr = (row_t *) mem_allocator.alloc(sizeof(row_t));
		newr->init(this->get_table(), get_part_id());

		newr->copy(row);
		row = newr;
	}
#endif
  return rc;
}
Пример #10
0
/**
 * Adds an Object to the area.
 * @param object The Object's pointer.
 * @see removeObject()
 */
void Area::addObject(Object* object) {
    //object->setArea(this);
    DEBUG_M("Entering function...");
    GameManager* gm = getGameManager();
    if(object->getGameManager() != gm) {
        DEBUG_A("Different GameMangers...");
        object->setGameManager(gm);
        if(gm) {
            DEBUG_A("Registering  object with gamemanager...");
            gm->registerObject(object);
        }
    }

    RigidBody* rb = dynamic_cast<RigidBody*>(object);
    if(rb) {
        rb->addBody(getPhysics());
    }

    Light* pl = dynamic_cast<Light*>(object);
    if(pl) {
        lights_.push_back(pl);
    }

    addChild(object);
}
Пример #11
0
btCollisionShape* RigidBody::loadShapeFromModel(RigidBody* body) {//Visual* visual) {
	DEBUG_M("Entering function...");
	#warning ['TODO']: Store shapes like models...
	Visual& visual = body->getVisual();
	/*if(!visual) {
		return NULL;
	}*/
	btCompoundShape* shape = new btCompoundShape();
	/*Visual& visual = getVisual();*/
	VModel* vmodel = dynamic_cast<VModel*>(&visual);
	if(!vmodel) {
		//return NULL;
		return NULL;
	}

	ResourceManager temprm;
	Model* model = temprm.loadModel(vmodel->getFilename());
	if(!model) {
		return NULL;
	}

	SceneNode* sn = model->visual_scene;
	if(!sn) {
		return NULL;
	}

	return loadShapeFromModel_ProcessNodes_(sn, shape);

	/*Model* model = rm->loadModel(vmodel.getFilename()) ;
	
	btTriangleIndexVertexArray* indexVertexArrays = new
		btTriangleIndexVertexArray(model->count*/
}
Пример #12
0
/* Process the <library_effects><effect><profile_COMMON><newparam> section of COLLADA */
void RCBC_MiniXML_ProcessTextureEffects_Newparam(ModelTempory *tempory, mxml_node_t *node, Hookup* fx_hookup) {
	DEBUG_M("Entering function...");
	mxml_node_t* child;
	//const char* newparam_sid = mxmlElementGetAttr(node, "id");
	//const char* surface_type;
	const char* init_from;

	assert(tempory);
	assert(node);
	assert(fx_hookup);

	DumpNodeInfo(node);

	for(node = node->child; node != NULL; node = node->next) {
		DumpNodeInfo(node);
		if(node->type == MXML_ELEMENT
		&& strcasecmp(node->value.element.name, "surface") == 0) {

			for(child = node->child; child != NULL; child = child->next) {
				if(child->type == MXML_ELEMENT
				&& strcasecmp(child->value.element.name, "init_from") == 0) {

					//surface_type = mxmlElementGetAttr(child, "type");
					init_from = child->child->value.opaque;
					Hookup* img_hookup = NEW(Hookup, (char*)init_from, &fx_hookup->ptr);
					ListAdd(tempory->sinks, img_hookup);
				}
			}

		}
	}
}
Пример #13
0
/* Process the <library_effects> section of COLLADA */
void RCBC_MiniXML_ProcessTextureEffects(ModelTempory *tempory, mxml_node_t *node) {
	DEBUG_M("Entering function...");
	const char* id;
	mxml_node_t* child;

	assert(tempory);
	if(!node) {
		return;
	}
	
	/* Loop through all the effect nodes */
	for(node = node->child; node != NULL; node = node->next) {
		if(node->type == MXML_ELEMENT	&&
			strcasecmp(node->value.element.name, "effect") == 0) {

			id = mxmlElementGetAttr(node, "id");

			for(child = node->child; child != NULL; child = child->next) {
				if(child->type == MXML_ELEMENT &&
					strcasecmp(child->value.element.name, "profile_COMMON") == 0) {

					Hookup* fx_hookup =  NEW(Hookup, (char*)id, NULL);
					ListAdd(tempory->sources, fx_hookup);

					RCBC_MiniXML_ProcessTextureEffects_Profile(tempory, child, fx_hookup);
				}
			}

		}
	}
}
Пример #14
0
/**
 * ModelTempory deconstructor.
 * @param the ModelTempory to free.
 * @see ModelTempory
 * @see ModelTempory_ModelTempory()
 * \memberof ModelTempory
 */
void ModelTempory_0ModelTempory(ModelTempory* tempory) {
	DEBUG_M("Entering function...");

	DEBUG_H("\tDeleting sinks...");
	Hookup_Debug(tempory->sinks);
	List_DeleteData(tempory->sinks);
	DELETE(tempory->sinks);

	DEBUG_H("\tDeleting sources...");
	List_DeleteData(tempory->sources);
	DELETE(tempory->sources);

	DEBUG_H("\tDeleting unsorted...");
	List_DeleteData(tempory->unsorted);
	DELETE(tempory->unsorted);

	DEBUG_H("\tDeleting deleteme...");
	List_DeleteData(tempory->deleteme);
	DELETE(tempory->deleteme);

	DEBUG_H("\tfreeing freeme...");
	List_FreeData(tempory->freeme);
	DELETE(tempory->freeme);

	/*DEBUG_H("\tDeleting image_sources...");
	List_DeleteData(tempory->image_sources);
	DELETE(tempory->image_sources);*/

	free(tempory);
}
Пример #15
0
/**
 * Triangles deconstructor
 * \memberof Triangles
 */
void Triangles_0Triangles(Triangles* triangles) {
	DEBUG_M("Entering function...");

	if(!triangles) {return;}

	if(triangles->vertices) {
		DELETE(triangles->vertices);
		triangles->vertices = NULL;
	}

	if(triangles->normals) {
		DELETE(triangles->normals);
		triangles->normals = NULL;
	}

	if(triangles->texcoords) {
		DELETE(triangles->texcoords);
		triangles->texcoords = NULL;
	}

	if(triangles->image) {
		Image_DeRefrence(triangles->image);
		triangles->image = NULL;
	}

	free(triangles);
}
Пример #16
0
RigidBody::~RigidBody() {
	DEBUG_M("Entering function...");
	setArea(NULL);
	delete body_;
	delete shape_;
	delete motionState_;
}
Пример #17
0
/**
 * SceneNode constructor
 * @return A new SceneNode or NULL on error.
 * \memberof SceneNode
 */
SceneNode* SceneNode_SceneNode() {
	DEBUG_M("Entering function...");

	ALLOCATE(SceneNode, node);
	node->class_ = &SceneNode_c;

	node->mesh = NULL;
	node->translate[0] = 0.0f;
	node->translate[1] = 0.0f;
	node->translate[2] = 0.0f;

	node->rotations = NEW(List);

	node->scale[0] = 1.0f;
	node->scale[1] = 1.0f;
	node->scale[2] = 1.0f;

	node->next = NULL;
	node->prev = NULL;
	node->child = NULL;
	node->parent = NULL;

	DEBUG(DEBUG_MEDIUM, "end of function");

	return node;	
}
Пример #18
0
/**
 * Adds a thing to the container.
 * @param child The thing to be contained.
 */
void Container::addChild(Contained* child) {
	DEBUG_M("Entering function addChild...");
	if(!child) {
		DEBUG_H("\tNo child...");
		return;
	}

	// Stop adding the child more than once
	ChildrenIterator found = find(getChildBegin(), getChildEnd(), child);
	if(found != getChildEnd()) {
		DEBUG_H("\tChild alread in list...");
		return;
	}

	DEBUG_H("Child adding to list...");
	child->setParent(this);
	children_.push_back(child);

	//DEBUG_H("Child adding to list...");
	Tagged* tagged = dynamic_cast<Tagged*>(child);
	if(!tagged) {
		return;
	}

	tags_.insert(ChildrenTagPair(tagged->getTag(), tagged));
}
Пример #19
0
void AbortQueue::process(uint64_t thd_id) {
  if(queue.empty())
    return;
  abort_entry * entry;
  uint64_t mtx_time_start = get_sys_clock();
  pthread_mutex_lock(&mtx);
  INC_STATS(thd_id,mtx[1],get_sys_clock() - mtx_time_start);
  uint64_t starttime = get_sys_clock();
  while(!queue.empty()) {
    entry = queue.top();
    if(entry->penalty_end < starttime) {
      queue.pop();
      // FIXME: add restart to work queue
      DEBUG("AQ Dequeue %ld %f -- %f\n",entry->txn_id,float(starttime - entry->penalty_end)/BILLION,simulation->seconds_from_start(starttime));
      INC_STATS(thd_id,abort_queue_penalty_extra,starttime - entry->penalty_end);
      INC_STATS(thd_id,abort_queue_dequeue_cnt,1);
      Message * msg = Message::create_message(RTXN);
      msg->txn_id = entry->txn_id;
      work_queue.enqueue(thd_id,msg,false);
      //entry = queue.top();
      DEBUG_M("AbortQueue::dequeue entry free\n");
      mem_allocator.free(entry,sizeof(abort_entry));
    } else {
      break;
    }

  }
  pthread_mutex_unlock(&mtx);

  INC_STATS(thd_id,abort_queue_dequeue_time,get_sys_clock() - starttime);

}
Пример #20
0
/**
 * Reads COLLADA mesh child data.
 * @param tempory The ModelTempory struct to hold the data.
 * @param mesh The mesh using the data.
 * @param xnode The XML node containing the data.
 * @return The collada triangles in unsorted form.
 */
int RCBC_MiniXML_ProcessGeometries_Mesh_Children(ModelTempory *tempory, Mesh *mesh, mxml_node_t *xnode) {
	DEBUG_M("Entering function...");
	if(!mesh) {
		ERROR("XML Passed NULL RCBC mesh... %s", SYMBOL_WARNING);
		return 1;
	} 
	if(!xnode) {
		ERROR("XML Passed NULL XML node... %s", SYMBOL_WARNING);
		return 1;
	}

	DumpNodeInfo(xnode);
	if(strcasecmp(xnode->value.element.name, "source") == 0) {
		return RCBC_MiniXML_ProcessGeometries_Mesh_Source(tempory, mesh, xnode);
	} else if(strcasecmp(xnode->value.element.name, "vertices") == 0) {
		return RCBC_MiniXML_ProcessGeometries_Mesh_Verticies(tempory, mesh, xnode);
	} else if(strcasecmp(xnode->value.element.name, "triangles") == 0) {
		if(!RCBC_MiniXML_ProcessGeometries_Mesh_Triangles(tempory, mesh, xnode)) {
			return 0;
		} else {
			return 1;
		}
	} else if(strcasecmp(xnode->value.element.name, "polygons") == 0) {
		#warning ['TODO']: Convert polygons to triangle strips
		//return RCBC_MiniXML_ProcessGeometries_Mesh_Polygons(tempory, mesh, xnode);
		ERROR("Model contains polygon data, convert to triangles.");
		return 1;
	} 
}
Пример #21
0
// FIXME: Rewrite abort queue
uint64_t AbortQueue::enqueue(uint64_t thd_id, uint64_t txn_id, uint64_t abort_cnt) {
  uint64_t starttime = get_sys_clock();
  uint64_t penalty = g_abort_penalty;
#if BACKOFF
  penalty = max(penalty * 2^abort_cnt,g_abort_penalty_max);
#endif
  penalty += starttime;
  //abort_entry * entry = new abort_entry(penalty,txn_id);
  DEBUG_M("AbortQueue::enqueue entry alloc\n");
  abort_entry * entry = (abort_entry*)mem_allocator.alloc(sizeof(abort_entry));
  entry->penalty_end = penalty;
  entry->txn_id = txn_id;
  uint64_t mtx_time_start = get_sys_clock();
  pthread_mutex_lock(&mtx);
  INC_STATS(thd_id,mtx[0],get_sys_clock() - mtx_time_start);
  DEBUG("AQ Enqueue %ld %f -- %f\n",entry->txn_id,float(penalty - starttime)/BILLION,simulation->seconds_from_start(starttime));
  INC_STATS(thd_id,abort_queue_penalty,penalty - starttime);
  INC_STATS(thd_id,abort_queue_enqueue_cnt,1);
  queue.push(entry);
  pthread_mutex_unlock(&mtx);
  
  INC_STATS(thd_id,abort_queue_enqueue_time,get_sys_clock() - starttime);

  return penalty - starttime;
}
Пример #22
0
/**
 * Removes a thing from the container.
 * @param child The thing to be contained.
 */
void Container::removeChild(Contained* child) {
	DEBUG_M("Entering function removeChild...");
	if(!child) {
		return;
	}

	DEBUG_H("\tRemoving object from container object vector.");
	ChildrenIterator found = find(getChildBegin(), getChildEnd(), child);
	//while((found = find(getChildBegin(), getChildEnd(), child)) != getChildEnd()) {
		if(found != getChildEnd()) {
			//Object* object = dynamic_cast<Object*>(*found);

			if(*found && ((*found) == child)) {
				//DEBUG_H("\t\tFound '%s'... Removing...", object->getTag().c_str());
				children_.erase(found);
			}
		}
	//}

	DEBUG_H("\tRemoving object from container tag list.");
	ChildrenTagIterator iter = tags_.begin();
	while(iter != tags_.end()) {
		Contained* contained = dynamic_cast<Object*>(iter->second);
		if(contained  && contained == child) {
			//DEBUG_H("\t\tFound '%s'... Removing...", object->getTag().c_str());
			tags_.erase(iter);
			iter = tags_.begin();
		} else {
			iter++;
		}
	}

	DEBUG_H("\tExiting function...");
	#warning ['TODO']: This...
}
Пример #23
0
/**
 * Area deconstructor, unloads all the tiles from memory.
 */
Area::~Area() {
    DEBUG_M("Entering function...");
#warning ['TODO']: Delete objects?
    setSize(0, 0);
    delete [] tiles_;
    tiles_ = NULL;
    delete(clipbox_);
}
Пример #24
0
void OutputThread::setup() {
  DEBUG_M("OutputThread::setup MessageThread alloc\n");
  messager = (MessageThread *) mem_allocator.alloc(sizeof(MessageThread));
  messager->init(_thd_id);
	while (!simulation->is_setup_done()) {
    messager->run();
  }
}
Пример #25
0
void TPCCQuery::release() {
  BaseQuery::release();
  DEBUG_M("TPCCQuery::release() free\n");
#if CC_ALG != CALVIN
  release_items();
#endif
  items.release();
}
Пример #26
0
RC PPSWorkload::get_txn_man(TxnManager *& txn_manager) {
  DEBUG_M("PPSWorkload::get_txn_man PPSTxnManager alloc\n");
	txn_manager = (PPSTxnManager *)
		mem_allocator.align_alloc( sizeof(PPSTxnManager));
	new(txn_manager) PPSTxnManager();
	//txn_manager->init( this);
	return RCOK;
}
Пример #27
0
void YCSBQuery::release() {
  BaseQuery::release();
  DEBUG_M("YCSBQuery::release() free\n");
#if CC_ALG != CALVIN
  release_requests();
#endif
  requests.release();
}
Пример #28
0
void row_t::free_row() {
  DEBUG_M("row_t::free_row free\n");
#if SIM_FULL
	mem_allocator.free(data, sizeof(char) * get_tuple_size());
#else
	mem_allocator.free(data, sizeof(uint64_t) * 1);
#endif
}
Пример #29
0
void Program::attach(ShaderPtr shader) {
   DEBUG_M("Attaching shader '%d' to program '%d'", shader->getShaderId(), program_id_);
   if(shader == ShaderPtr()) {
      ERROR("Tried to attach NULL shader.");
      return;
   }
   glAttachShader(program_id_, shader->getShaderId());
   shaders_.insert(shader);
}
Пример #30
0
/**
 * Remove a physic body to the physics engine.
 * @param physics The physics engine to remove from.
 */
void RigidBody::removeBody(Physics* physics) {
	DEBUG_M("Entering function...");
	if(!physics) {
		return;
	}
	if(body_) {
		physics->removeRigidBody((btRigidBody*)body_);
	}
}