Exemple #1
0
void Card::setAll(const char* allch) {
		String all = allch;
		int indexof = all.find(delim);
		if (indexof > -1) {
			setQuantity(all.substr(0,indexof++).c_str());
			all=all.substr(indexof);
			indexof = all.find(delim);
			setText(all.substr(0,indexof++).c_str());
			all=all.substr(indexof);
			indexof = all.find(delim);
			setThumb(all.substr(0,indexof++).c_str());
			all=all.substr(indexof);
			indexof = all.find(delim);
			setFront(all.substr(0,indexof++).c_str());
			all=all.substr(indexof);
			indexof = all.find(delim);
			setBack(all.substr(0,indexof++).c_str());
			all=all.substr(indexof);
			indexof = all.find(delim);
			setId(all.substr(0,indexof++).c_str());
			all=all.substr(indexof);
			indexof = all.find(delim);
			setRate(all.substr(0,indexof++).c_str());
			all=all.substr(indexof);
			indexof = all.find(delim);
			setValue(all.substr(0,indexof++).c_str());
			all=all.substr(indexof);
			indexof = all.find(delim);
			setNote(all.substr(0,indexof++).c_str());
			all=all.substr(indexof);

			setLoaded(true);
			if ((getText().length() <= 0)||(getQuantity().length() <= 0)) {
				setQuantity("");
				setText("");
				setLoaded(false);
			}
		} else {
			setQuantity("");
			setText("");
			setThumb("");
			setFront("");
			setBack("");
			setId("");
			setRate("");
			setValue("");
			setNote("");
			setLoaded(false);
		}
}
Exemple #2
0
void Order::fromJson(web::json::value& val)
{
    if(val.has_field(utility::conversions::to_string_t("id")))
    {
        setId(ModelBase::int64_tFromJson(val[utility::conversions::to_string_t("id")]));
    }
    if(val.has_field(utility::conversions::to_string_t("petId")))
    {
        setPetId(ModelBase::int64_tFromJson(val[utility::conversions::to_string_t("petId")]));
    }
    if(val.has_field(utility::conversions::to_string_t("quantity")))
    {
        setQuantity(ModelBase::int32_tFromJson(val[utility::conversions::to_string_t("quantity")]));
    }
    if(val.has_field(utility::conversions::to_string_t("shipDate")))
    {
        setShipDate(ModelBase::dateFromJson(val[utility::conversions::to_string_t("shipDate")]));
    }
    if(val.has_field(utility::conversions::to_string_t("status")))
    {
        setStatus(ModelBase::stringFromJson(val[utility::conversions::to_string_t("status")]));
    }
    if(val.has_field(utility::conversions::to_string_t("complete")))
    {
        setComplete(ModelBase::boolFromJson(val[utility::conversions::to_string_t("complete")]));
    }
}
Exemple #3
0
Invoice::Invoice(Date d, string num, string des, int q, float p) {
	setDateOrdered(d);
	setPartNumber(num);
	setDescription(des);
	setQuantity(q);
	setPrice(p);
}
void Kit::ingestCsvInput(std::vector<std::vector<std::string>> csvFieldList)
{
	std::vector<std::string> csvField;
	std::string firstField;
	std::string quantity;
	std::string partNumber;
	std::string description;
	int line;

	for (int i = 0; i < csvFieldList.size(); i++)
	{

		line = i;
		csvField = csvFieldList[i];

		if (line == 0)
		{
			firstField = csvField[0];
			setKitName(firstField);
		}

		//checks if field is size 3 and if not header
		if (csvField.size() >= 3 && csvField[0] != "Qty")
		{
			quantity = csvField[0];
			partNumber = csvField[1];
			description = csvField[2];
			setQuantity(quantity);
			setPartNumber(partNumber);
			setDescription(description);
			setAttributes(getQuantity(), getDescription());
			addParts();
		}
	}
}//end ingestCsvInput()
Exemple #5
0
Stock::Stock(int newItemNumber, int newQuantity, double newCost)
{
	setItemNumber(newItemNumber);
	setQuantity(newQuantity);
	setCost(newCost);

}
Exemple #6
0
void Order::fromMultiPart(std::shared_ptr<MultipartFormData> multipart, const utility::string_t& prefix)
{
    utility::string_t namePrefix = prefix;
    if(namePrefix.size() > 0 && namePrefix.substr(namePrefix.size() - 1) != utility::conversions::to_string_t("."))
    {
        namePrefix += utility::conversions::to_string_t(".");
    }

    if(multipart->hasContent(utility::conversions::to_string_t("id")))
    {
        setId(ModelBase::int64_tFromHttpContent(multipart->getContent(utility::conversions::to_string_t("id"))));
    }
    if(multipart->hasContent(utility::conversions::to_string_t("petId")))
    {
        setPetId(ModelBase::int64_tFromHttpContent(multipart->getContent(utility::conversions::to_string_t("petId"))));
    }
    if(multipart->hasContent(utility::conversions::to_string_t("quantity")))
    {
        setQuantity(ModelBase::int32_tFromHttpContent(multipart->getContent(utility::conversions::to_string_t("quantity"))));
    }
    if(multipart->hasContent(utility::conversions::to_string_t("shipDate")))
    {
        setShipDate(ModelBase::dateFromHttpContent(multipart->getContent(utility::conversions::to_string_t("shipDate"))));
    }
    if(multipart->hasContent(utility::conversions::to_string_t("status")))
    {
        setStatus(ModelBase::stringFromHttpContent(multipart->getContent(utility::conversions::to_string_t("status"))));
    }
    if(multipart->hasContent(utility::conversions::to_string_t("complete")))
    {
        setComplete(ModelBase::boolFromHttpContent(multipart->getContent(utility::conversions::to_string_t("complete"))));
    }
}
void InventorySlotButton::setSellPrice( int inSellPrice ) {
    mSellPrice = inSellPrice;

    // reset object (potentially change to tool tip)
    int oldQuantity = mQuantity;
    setObject( mObjectID );
    setQuantity( oldQuantity );
    }
void InventorySlotButton::setTransferStatus( int inStatus ) {
    mTransferStatus = inStatus;
    
    // reset object (potentially change to tool tip)
    int oldQuantity = mQuantity;
    setObject( mObjectID );
    setQuantity( oldQuantity );
    }
Exemple #9
0
void NewBook::on_buttonBox_accepted()
{
    setName(ui->nameEdit->text());
    setAuthor(ui->authorEdit->text());
    setIsbn(ui->isbnEdit->text());
    setQuantity(ui->quantityEdit->text());
    setAvailable(ui->availableEdit->text());
    setStudentid(ui->studentidEdit->text());
}
Kit::Kit()
{
	setKitName("");
	setPartNumber("");
	setQuantity("");
	setDescription("");
	setAttributes("", "");

}//end Kit()
bool TargetData::setSlotQuantity(const Basic::Number* const msg)
{
   bool ok = false;
   if (msg != 0) {
      int v = msg->getInt();
      if (v >= 0) {
         ok = setQuantity(static_cast<unsigned int>(msg->getInt()));
      }
   }
   return ok;
}
Exemple #12
0
void update(FoodRepoDynamic* v,char Name[],Food f){
    int i=0,pos=-1;
    while(i<v->length && pos==-1){
        if(strcasecmp(v->foodstuff[i].name,Name)==0){
            pos=i;
        }
        i++;
    }
    setName(v->foodstuff[pos].name,f.name);
    setQuantity(v->foodstuff[pos].quantity,f.quantity);
    setCategory(v->foodstuff[pos].category,f.category);
    setExpDate(v->foodstuff[pos].ExpDate,f.ExpDate.day,f.ExpDate.month,f.ExpDate.year);
}
void Ingredient::removeUnits( int quantityToRemove )
{
///     WARNING         ///
/// THIS METHOD DOES   ///
/// NOT CHECK IF IT   ///
/// IS TAKING MORE   ///
/// THAN WHAT IS IN ///
///     STOCK      ///
/// IT WILL SET   ///
/// QUANTITY TO  ///
///____ZERO_____///
///   WARNING  ///
    setQuantity( getQuantity() - quantityToRemove );
}
void ResourceContainerImplementation::combine(ResourceContainer* fromContainer) {
	Locker _locker(_this.get());

	ManagedReference<SceneObject*> parent =
			fromContainer->getParent();

	setQuantity(getQuantity() + fromContainer->getQuantity());
	fromContainer->setQuantity(0);

	//parent->removeObject(fromContainer, true);
	fromContainer->destroyObjectFromWorld(true);

	fromContainer->destroyObjectFromDatabase(true);
}
void ResourceContainerImplementation::split(int newStackSize, CreatureObject* player) {

	ManagedReference<SceneObject*> inventory = player->getSlottedObject("inventory");

	ManagedReference<ResourceContainer*> newResource = spawnObject->createResource(newStackSize);

	if (newResource == NULL || newResource->getSpawnObject() == NULL)
		return;

	if(inventory->transferObject(newResource, -1, true)) {
		newResource->sendTo(player, true);

		setQuantity(getQuantity() - newStackSize);
	} else {
		error("Unable to split resource to player: " + player->getFirstName());
	}
}
void ResourceContainerImplementation::split(int newStackSize) {
	if (getQuantity() <= newStackSize)
		return;

	if(newStackSize > getQuantity())
		newStackSize = getQuantity();

	ManagedReference<ResourceContainer*> newResource = spawnObject->createResource(newStackSize);

	if(parent == NULL || newResource == NULL || newResource->getSpawnObject() == NULL)
		return;

	ManagedReference<SceneObject*> sceneParent = cast<SceneObject*>(parent.get().get());

	if(sceneParent->transferObject(newResource, -1, true)) {
		sceneParent->broadcastObject(newResource, true);

		setQuantity(getQuantity() - newStackSize);
	} else {
		StringBuffer errorMessage;
		errorMessage << "Unable to split resource in container type: " << sceneParent->getGameObjectType() << " " << sceneParent->getDisplayedName();
		error(errorMessage.toString());
	}
}
Exemple #17
0
// 1-param Constructor
Part::Part(const std::string& line) throw(BadPartException)
{
   // Simple validation
   // Line must have characters
   // and first ones need to be numbers
   // Short-circuits to avoid dereferencing line[0] when invalid
   if(line.length() <= 1 ||
         !std::isdigit(line[0])
     )
   {
      BOOST_THROW_EXCEPTION(BadPartException());
   }
   // Use Boost.Tokenizer to parse the line
   boost::tokenizer< boost::escaped_list_separator< char > > tok(line);
   boost::tokenizer< boost::escaped_list_separator< char > >::iterator 
      iter = tok.begin();

   try
   {
      // First field is Quantity
      setQuantity(boost::lexical_cast<int>(*iter++));
   }
   catch(boost::bad_lexical_cast& exception)
   {
      // We've tried to do a bad cast.
      // Simply throw our custom exception
      BOOST_THROW_EXCEPTION(BadPartException());
   }
   // Next is the part number
   setNumber(*iter++);
   // Finally, set the name
   // Trim off any whitespace at the end
   std::string trimmed_name = *iter++;
   boost::trim(trimmed_name);
   setName(trimmed_name);
}
//------------------------------------------------------------------------------
// setSlotQuantity() -- sets the number of tick marks
//------------------------------------------------------------------------------
bool DialTickMarks::setSlotQuantity(const Basic::Number* const newQ)
{
    bool ok = true;
    if (newQ != 0) ok = setQuantity(newQ->getInt());
    return ok;
}
//Constructor with 2 strings an interger and a double as parameters to initialize 
//Item Name, Unit, Quantity, and Price
ClubItems::ClubItems(string itemNameIn, string unitIn, int quantityIn, double priceIn)
{  setItemName(itemNameIn);
   setUnit(unitIn);
   setQuantity(quantityIn);
   setPrice(priceIn);
}
Exemple #20
0
void NewBook::resetQuantity()
{
    setQuantity(tr(""));
}
void InventorySlotButton::addToQuantity( int inDelta ) {
    setQuantity( getQuantity() + inDelta );
    }
void ResourceContainerImplementation::setUseCount(uint32 newQuantity, bool notifyClient) {
	setQuantity(newQuantity, notifyClient);
}
 bool FFactorGroundFloorConstruction_Impl::setPerimeterExposed(const Quantity& perimeterExposed) {
   return setQuantity(OS_Construction_FfactorGroundFloorFields::PerimeterExposed,perimeterExposed);
 }
 bool FFactorGroundFloorConstruction_Impl::setArea(const Quantity& area) {
   return setQuantity(OS_Construction_FfactorGroundFloorFields::Area,area);
 }
 bool FFactorGroundFloorConstruction_Impl::setFFactor(const Quantity& fFactor) {
   return setQuantity(OS_Construction_FfactorGroundFloorFields::FFactor,fFactor);
 }
Exemple #26
0
//Parameterized Constructor
Garbage::Garbage(int quantity) {
	setCost(8);
	this->setColor("Yellow");
	setQuantity(quantity);
}
/*********************************************************************
** Description: Default constructor
** sets name to "", price to 0.0 and quantity to 0.
*********************************************************************/
Item::Item()
{
	setName("");
	setPrice(0.0);
	setQuantity(0);
}
/*********************************************************************
** Description: Constructor with arguments. Calls appropriate setters.
*********************************************************************/
Item::Item(std::string name, double price, int quantity)
{
	setName(name);
	setPrice(price);
	setQuantity(quantity);
}
Exemple #29
0
int main(int argc, char *argv[]){
    signal(SIGINT,leave);
    signal(SIGSEGV,leave2);
    FILE *input=stdin;
//     FILE *output=stdout;
//     FILE *output2=stdout;
    
//     output2=fopen("iq.txt","w");
//     output=fopen("ob.txt","w");
	  
    int ifinput=0;
    int ifoutput=0;
    int ifhash=0;
    int ifbinary=1;
    int ifselected=0;

    int messagecount=1000;
    int count=0;
    int ifsymbol=0;
    double du=0;
    
    char in[]="-i";
    char symbolname[]="-s";
    char hash[]="-h";
    char binary[]="-b";
    char dasht[]="-t";
    char dashm[]="-m";
    char dashn[]="-n";
    
    int dm=0;

    
   struct lnode *hashmaphead[SIZE];
   struct lnode *hashmaptail[SIZE];

   
    char command;
    unsigned int id;
    char side;

    char symbol[5];
    unsigned int quantity;
    double price;
    

    
    sellhead=NULL;
    selltail=NULL;
    buyhead=NULL;
    buytail=NULL;
    
    for(int i=0;i<SIZE;i++){
	hashmaphead[i]=NULL;
	hashmaptail[i]=NULL;
    }
    
    
    
    
    for (int i=0;i<argc;i++){
      
      if (strcmp(argv[i],in)==0){
	input=fopen(argv[i+1],"r");
	
	
	
      }
      
      if (strcmp(argv[i],symbolname)==0){
	ifsymbol=1;
	strcpy (symbol2,argv[i+1]);
	
      }
      
      if (strcmp(argv[i],dashm)==0){
	M= atoi( (argv[i+1]) );
	
      }
      
      if (strcmp(argv[i],dashn)==0){
	N= atoi( (argv[i+1]) );
	
      }      
      
      if (strcmp(argv[i],dasht)==0){
	ifpred=1;

      }      
      
      
      
      
      
    }
    
    double prevN[N+1];
    double lastFSO[M];
    double lastsignal[M];
    
    t= prevN;
    lastF=lastFSO;


    for(int i=0;i<N+1;i++){
	prevN[i]=0;
    }
    
    for(int i=0;i<M;i++){
	lastF[i]=0;
	lastsignal[i]=0;	
    } 
    


    if (!ifsymbol){
    printf("Please enter -s symbol\n");
    exit(0);
    }
    
    
    
    

    
    init_market(input, symbol2);
    pthread_t thread;
    pthread_create(&thread,NULL,market,NULL);
    
    unsigned int length;
    char* start;
    char* buffer;

    
    while(1){
      

    buffer=get_inputs(&length);
    start=buffer;
    
    if (length<=0) break;
	
      while (1){
      
	
       command=*((char*)buffer);
       buffer++;

	
// 	 if(ifbinary==1){
//    
//       if(fread(&command,sizeof(char),1,input));
//       else break;
// 
//       } 
//       else
//       fscanf(input,"%c",&command);
      			

	if (command=='A'){
	  
	id=*( (unsigned int*)buffer);
	buffer=buffer+sizeof(unsigned int);

	
	side=*((char*)buffer);
        buffer=buffer+sizeof(char);

        strncpy(symbol,buffer,4);

   	symbol[4]='\0';     
	buffer=buffer+4*sizeof(char);
        

        quantity=*((unsigned int*)buffer);
        buffer=buffer+sizeof(unsigned int);
        
	price=*((double*) buffer);
        buffer=buffer+sizeof(double);

// 	if (ifbinary==0){
// 	fscanf(input," %ld %c %s %d %lf\n",&id,&side,symbol,&quantity,&price);
//       
// 	}
// 	else{
// 	fread(&id,sizeof(unsigned int),1,input);
// 		fread(&side,sizeof(char),1,input);
// 			fread(symbol,4*sizeof(char),1,input);
// 			symbol[4]='\0';
// 				fread(&quantity,sizeof(unsigned int),1,input);
// 					fread(&price,sizeof(double),1,input);
// 	  
// 	}
	

	

	if (strncmp(symbol2,symbol,4)==0){
	   	count++;
		globalcount++;
	  	 int index=id%SIZE;
	node=newNode(&hashmaphead[index],&hashmaptail[index], id, side, quantity, price);
	

	
	
	

	  
	if (side=='B'){
	  
	  newSortNode(&buyhead, &buytail, node);

	}
	
	else if (side=='S'){
	  newSortNode(&sellhead, &selltail, node);

	}
	
	}
	}
	
	
	
	else if (command=='X'){
	  
	  
	id=*( (unsigned int*)buffer);
	buffer=buffer+sizeof(unsigned int);
/*	
	side=*((char*)buf);
        buffer=buffer+sizeof(char);*/

        strncpy(symbol,buffer,4);

   	symbol[4]='\0';     
	buffer=buffer+4*sizeof(char);
        
/*
        quantity=*((unsigned int*)buffer);
        buffer=buffer+sizeof(unsigned int);
        
	price=*((double*) buffer);
        buffer=buffer+sizeof(double);
	  */
// 	  if (ifbinary==0){
// 	  fscanf(input," %ld %s\n",&id,symbol);
// 	  }
// 	  else{
// 	    	fread(&id,sizeof(unsigned int),1,input);
// 			fread(symbol,4*sizeof(char),1,input);
// 
// 	  }
// 	  
	  

	
	
	
	if (strncmp(symbol2,symbol,4)==0){
	  	 count++;
		 globalcount++;
	node=hashmaphead[id%SIZE];
	while (node!=NULL ){
		if((node->id)==id){
		  break;
		}
		else
		node=node->next;
	  }

	

	  
 	if (node!=NULL) {
   	if (node->side=='B'){
   	  deleteSortNode(&buyhead, &buytail, node);
    	}
  	
   	else if (node->side=='S'){
   	  deleteSortNode(&sellhead, &selltail, node);
  	}
	}
 	
	
	  
	  deleteNode(&hashmaphead[id%SIZE], &hashmaptail[id%SIZE],node);
	
	}
	  
	}
	
	else if (command=='T'){
	  
	  	id=*( (unsigned int*)buffer);
	buffer=buffer+sizeof(unsigned int);
	
// 	side=*((char*)buf);
//         buffer+=sizeof(char);

        strncpy(symbol,buffer,4);

   	symbol[4]='\0';     
	buffer=buffer+4*sizeof(char);
        

        quantity=*((unsigned int*)buffer);
        buffer=buffer+sizeof(unsigned int);
        
// 	price=*((double*) buffer);
//         buffer=buffer+sizeof(double);
	  
// 	  if (ifbinary==0){
// 	  fscanf(input," %ld %s %d\n",&id,symbol,&quantity  );	
// 	  }
// 	  else{
// 	    	    	fread(&id,sizeof(unsigned int),1,input);
// 			fread(symbol,4*sizeof(char),1,input);
//  			symbol[4]='\0';
// 
// 			fread(&quantity,sizeof(unsigned int),1,input);
//  			
// 			
// 	  }
// 	  
	  

	  
	if (strncmp(symbol2,symbol,4)==0){
	  
	    count++;
	    globalcount++;
	    node=hashmaphead[id%SIZE];
	  while (node!=NULL ){
		if((node->id)==id){
		  break;
		}
		else
		node=node->next;
	  }
	  C=node->price;
	  setQuantity(&node,id,quantity);
	  
	  
	  
	  
	  
	  
	  
	  for (int i=0;i<N;i++){
	    prevN[i]=prevN[i+1];
	
	  }
	  
	  prevN[N]=C;
	  
	  L=10000.0;  
	  for (int i=0;i<N+1;i++){
	    if(L>prevN[i])
	      L=prevN[i];
	  }
	  
	  H=0.0;
	  
	  for (int i=0;i<N+1;i++){
	    if(H<prevN[i])
	      H=prevN[i];
	  }
	  
	  

	  for (int i=0;i<M-1;i++){
	    lastFSO[i]=lastFSO[i+1];
	  }
	  
	  FSO=((C-L)/(H-L))*100;
	  lastFSO[M-1]=FSO;
	  
	  
	  double sum=0;
	  for (int i=0;i<M;i++){
	    sum=sum+lastFSO[i];
	  }
	  
	  SSO=sum/M;
	  
	  for (int i=0;i<M-1;i++){
	    lastsignal[i]=lastsignal[i+1];
	  }
	  lastsignal[M-1]=SSO;
	  
	  
	  sum=0;
	  
	  for (int i=0;i<M;i++){
	    sum=sum+lastsignal[i];
	  }

	  signal_line=sum/M;
	  


	  
	  
	  
	  
	  
	  
	  
	  if(node->quantity==0){
	    
	     	if (node!=NULL) {
		    if (node->side=='B'){
		      deleteSortNode(&buyhead, &buytail, node);
		    }
		    
		    else if (node->side=='S'){
		      deleteSortNode(&sellhead, &selltail, node);
		    }
		    }
		    
		    
		      
		      deleteNode(&hashmaphead[id%SIZE], &hashmaptail[id%SIZE],node);
	    
	  }
	  


	  
	  
	  
	    break;
	  }
	  
	  
	
	}
	
else 	if (command=='C'){
  	id=*( (unsigned int*)buffer);
	buffer=buffer+sizeof(unsigned int);
/*	
	side=*((char*)buf);
        buffer+=sizeof(char);*/

        strncpy(symbol,buffer,4);
   	symbol[4]='\0';     
	buffer=buffer+4*sizeof(char);
        

        quantity=*((unsigned int*)buffer);
        buffer=buffer+sizeof(unsigned int);
        
// 	price=*((double*) buffer);
//         buffer=buffer+sizeof(double);
  
  
  
// 	  if (ifbinary==0){
// 	  fscanf(input," %ld %s %d\n",&id,symbol,&quantity  );	
// 	  }
// 	  else{
// 	    	    	fread(&id,sizeof(unsigned int),1,input);
// 			fread(symbol,4*sizeof(char),1,input);
//  			symbol[4]='\0';
// 			fread(&quantity,sizeof(unsigned int),1,input);
// 			
// 			
// 	  }
	  

	  
	  
	  if (strncmp(symbol2,symbol,4)==0){
	  
	    count++;
	    globalcount++;
	    node=hashmaphead[id%SIZE];
	  while (node!=NULL ){
		if((node->id)==id){
		  break;
		}
		else
		node=node->next;
	  }
	  
	  setQuantity(&node,id,quantity);
	  if(node->quantity==0){
	    
	     	if (node!=NULL) {
		    if (node->side=='B'){
		      deleteSortNode(&buyhead, &buytail, node);
		    }
		    
		    else if (node->side=='S'){
		      deleteSortNode(&sellhead, &selltail, node);
		    }
		    }
		    
		    
		      
		      deleteNode(&hashmaphead[id%SIZE], &hashmaptail[id%SIZE],node);
	    
	  }
	  }
	}
	
	else if (command=='R'){
	  	id=*( (unsigned int*)buffer);
	buffer=buffer+sizeof(unsigned int);
	
// 	side=*((char*)buf);
//         buffer+=sizeof(char);

        strncpy(symbol,buffer,4);

   	symbol[4]='\0';     
	buffer=buffer+4*sizeof(char);
        

        quantity=*((unsigned int*)buffer);
        buffer=buffer+sizeof(unsigned int);
        
	price=*((double*) buffer);
        buffer=buffer+sizeof(double);
// 	 if (ifbinary==0){
// 	  fscanf(input," %ld %s %d %lf\n",&id,symbol,&quantity,&price);
// 	  
// 	  }
// 	  else{
// 	    
// 	    	    	fread(&id,sizeof(unsigned int),1,input);
// 			fread(symbol,4*sizeof(char),1,input);
// 			symbol[4]='\0';
// 			fread(&quantity,sizeof(unsigned int),1,input);
// 			fread(&price,sizeof(double),1,input);
// 			
// 
// 	  }
// 	  

	  
	  
	  
	  
	if (strncmp(symbol2,symbol,4)==0){
		 count++;
		 globalcount++;
	  
	node=hashmaphead[id%SIZE];
	while (node!=NULL ){
		if((node->id)==id){
		  break;
		}
		else
		node=node->next;
	  }

	side=node->side;

	
	  
	//delete  

		  
		if (node!=NULL) {
		if (node->side=='B'){
		  deleteSortNode(&buyhead, &buytail, node);
		}

		else if (node->side=='S'){
		  deleteSortNode(&sellhead, &selltail, node);
		}
		}
		
		
	  
	deleteNode(&hashmaphead[id%SIZE], &hashmaptail[id%SIZE],node);
	
	
	
	//add
	int index=id%SIZE;
	node=newNode(&hashmaphead[index],&hashmaptail[index], id, side, quantity, price);

	

	  
	if (side=='B'){
	  newSortNode(&buyhead, &buytail, node);

	}
	
	else if (side=='S'){
	  newSortNode(&sellhead, &selltail, node);
	  
	}
	
	}
	    
	    
	    
	    
	  
	}
	
	


//  	if(count>=messagecount){
// 	  count=0;
// // 	   
// 	  double temp=du;
// 	  double temp1=du;
// 	    if(sellhead!=NULL){
// 	      temp=sellhead->price;
// 
// 	      
// 	    }
// 	    
// 	    if(buytail!=NULL){
// 	      temp1=buytail->price;
// 	    }
// 
// 	    
// 	      
// 	      
//  	    fprintf(output2,"%lf %lf\n",temp,temp1);
// 
// 	
//  	}

//       }
      
      
    }
    
    }
      
      fclose(input);
      

      
      
//      for(int i=0;i<SIZE;i++){
//       node=hashmaphead[i];
//       	while (node!=NULL ){
// 	    fprintf(output,"%d %c %d %lf\n",node->id,node->side,node->quantity,node->price);
// 	    node=node->next;
// 	
//       }
//       }
      

      
      
      
      


    return 0;
  
  
}
Exemple #30
0
//------------------------------------------------------------------------------
// setSlotQuantity() -- sets the number of tick marks
//------------------------------------------------------------------------------
bool DialTickMarks::setSlotQuantity(const base::Number* const newQ)
{
    bool ok = true;
    if (newQ != nullptr) ok = setQuantity(newQ->getInt());
    return ok;
}