当前位置: 首页>>代码示例>>C++>>正文


C++ DataList::push_back方法代码示例

本文整理汇总了C++中DataList::push_back方法的典型用法代码示例。如果您正苦于以下问题:C++ DataList::push_back方法的具体用法?C++ DataList::push_back怎么用?C++ DataList::push_back使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在DataList的用法示例。


在下文中一共展示了DataList::push_back方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: CreateEventTestData

DataList* CreateEventTestData() {
	DataList* dataList = new DataList();

	NamedEventDataList* systemEventData = CreateSystemEventData();
	NamedEventDataList* runEventData = CreateRunEventData();
	NamedEventDataList* productionEventData = CreateProductionEventData();
	NamedEventDataList* agentEventData = CreateAgentEventData();
	NamedEventDataList* printEventData = CreatePrintEventData();
	NamedEventDataList* xmlEventData = CreateXMLEventData();
	NamedEventDataList* updateEventData = CreateUpdateEventData();
	NamedEventDataList* stringEventData = CreateStringEventData();

	dataList->push_back(systemEventData);
	dataList->push_back(runEventData);
	dataList->push_back(productionEventData);
	dataList->push_back(agentEventData);
	dataList->push_back(printEventData);
	dataList->push_back(xmlEventData);
	dataList->push_back(updateEventData);
	dataList->push_back(stringEventData);

	return dataList;
}
开发者ID:IvanLogvinov,项目名称:soar,代码行数:23,代码来源:TestSMLEvents.cpp

示例2: getData

void getData()
{
    // fstream fs ("..//input/iccad2015_input.case2" ,fstream::in);
   fstream fs ("..//input/test.txt" ,fstream::in);
//    fstream fs ("test.txt" ,fstream::in);
    string line;

    while(getline(fs,line))
    {
        int a = line[0];
        string num;
        num.clear();
        Data d;
        d.clear();
        if((a>=48 && a<=57) || a == 45)
        {
            for(int i=0; i< line.size(); i++)
            {
                if(((int)line[i]>=48 && (int)line[i]<=57 && i < line.size()-1) || (int)line[i]==45  )
                {
                    num.push_back(line[i]);
                }else if((int)line[i] == 44 )
                {
                    d.push_back(num);
                    num.clear();
                }else if(i == line.size()-1)
                {
                    num.push_back(line[i]);
                    d.push_back(num);
                    num.clear();
                    list.push_back(d);
                    d.clear();
                }
            }
        }
        else if(a==65)
        {
            for(int i=0;i<line.size();i++)
            {
                if(line[i]>=48 && line[i]<=57)
                {
                    alpha.push_back(line[i]);
                }
            }
        }
        else if(a==66)
        {
            for(int i=0;i<line.size();i++)
            {
                if(line[i]>=48 && line[i]<=57)
                {
                    beta.push_back(line[i]);
                }
            }
        }
        else if(a==79)
        {
            for(int i=0;i<line.size();i++)
            {
                if(line[i]>=48 && line[i]<=57)
                {
                    omega.push_back(line[i]);
                }
            }
        }
    }
}
开发者ID:cftang0827,项目名称:AlgoFinalProject,代码行数:67,代码来源:getpart.cpp

示例3: Write

    void ScrDB::Write(TARGETING::TargetHandle_t i_ptargetHandle,
                      BitString & bs,
                      uint64_t registerId)
    {
        PRDF_TRAC( "ScrDB::Write() huid: %X, addr: %016X, data: %08X %08X",
                    getHuid(i_ptargetHandle), registerId,
                    bs.getFieldJustify(0,32), bs.getFieldJustify(32,32) );

        unsigned int dataWordSize = bs.getBitLen()/32;
        //    PRDF_TRAC("dataWordSize1: %d", dataWordSize);
        dataWordSize += (bs.getBitLen() % 32) ? 1 : 0;
        //    PRDF_TRAC("dataWordSize2: %d", dataWordSize);
        DataList data;

        // parse all data given
        data.push_back(bs.getFieldJustify(0,32));
        data.push_back(bs.getFieldJustify(32,32));
        //    PRDF_TRAC("parse all data given");
        // look for expected data
        DataList expectedData;
        if(eChipset.find(i_ptargetHandle) != eChipset.end())
        {
            PRDF_TRAC("found target");
            PreScrMap escrmap = eChipset[i_ptargetHandle];
            if(escrmap.find(registerId) != escrmap.end()) // we have expected data value
            {
                PRDF_TRAC("found scom reg");
                SimScrDataSet eValues = escrmap[registerId];
                expectedData = eValues.GetData(); // get next set of values
                escrmap[registerId] = eValues;
                eChipset[i_ptargetHandle] = escrmap;
            }
        }
        if(expectedData.size() > 0)
        {
            if((expectedData[0] != data[0]) || (expectedData[1] != data[1]))
            {
                PRDF_ERR("Verify SC register: %p", i_ptargetHandle);
                PRDF_ERR(" Address: 0x%016X", registerId);
                PRDF_ERR("SCR write Actual  : %08X %08X", data[0], data[1]);
                PRDF_ERR("SCR write Expected: %08X %08X", expectedData[0], expectedData[1]);
            }
            else
            {
                PRDF_TRAC("Verify SC register: %p", i_ptargetHandle);
                PRDF_TRAC(" Address: 0x%016X", registerId);
                PRDF_TRAC("SCR write Actual: %08X %08X", data[0], data[1]);
            }
        }

        //    PRDF_TRAC("get a copy");
        // get a copy of the scrMap for this chip - if one does not exist it will be created
        ScrMap scrMap = chipset[i_ptargetHandle];

        //    PRDF_TRAC("update register value");
        // update register value
        scrMap[registerId] = data; // copy the supplied value to the register

        //    PRDF_TRAC("update the master");
        chipset[i_ptargetHandle] = scrMap; // scrMap is only a copy so must update the master

        //PRDF_EXIT( "ScrDB::Write()" );

    }
开发者ID:open-power,项目名称:hostboot,代码行数:64,代码来源:prdfsimScrDB.C

示例4: main

int main(int argc, char* argv[])
{
	
	int capacity;
	int NumOfFood;
    fstream fin(argv[1]);
    fstream fout;
    fout.open(argv[2],ios::out);
    fin>>capacity;
    fin>>NumOfFood;
    int x;
	int y;
	int weight;
	
	

	DataList FoodInfo;
	vector<int>aa(4,0);
	FoodInfo.push_back(aa);
	while(fin>>x>>y>>weight)
	{
		Data temp(3);
		temp[0] = x;
		temp[1] = y;
		temp[2] = weight;
		FoodInfo.push_back(temp);
	}
	//test
	cout<<capacity<<endl;
	cout<<NumOfFood<<endl;
	//cout<<x<<" "<<y<<" "<<weight<<endl;
	
	for(int i=0;i<FoodInfo.size();i++)
	{
		for(int j=0;j<3;j++)
		{
			cout<<FoodInfo[i][j]<<" ";
		}
		cout<<endl;
	}
	//cout<<"capacity="<<capacity<<endl;
	//cout<<"size:"<<FoodInfo.size()<<endl;
	int *minimalDist = new int[FoodInfo.size()];
	//int* position = new int[FoodInfo.size()];
	vector<int> position;
	
	ShortestPath(FoodInfo.size()-1,capacity,FoodInfo,minimalDist,position);
	for(int i=1;i<=NumOfFood;i++)
	{
		cout<<minimalDist[i]<<endl;
	}
	cout<<"postition"<<endl;
	for(int i=position.size()-1;i>=0;i--)
		{
			cout<<position[i]<<endl;
		}
	//cout<<FoodInfo.size()-1<<endl;
	
	
	cout<<"GREEDY!"<<endl;
	
	int distance = 0;
	Data position1;
	Greedy(FoodInfo,FoodInfo.size()-1,capacity,position1,distance);
	
	for(int i=0;i<position1.size();i++)
	{
		cout<<position1[i]<<endl;
	}
	
	cout<<"distance"<<distance<<endl;
	
	
	
	
	
	
	
	cout<<"end"<<endl;
	
	/*
	cout<<CapacityCheck(0 , 3 , capacity ,FoodInfo);
	cout<<CapacityCheck(1 , 3 , capacity ,FoodInfo);
	cout<<CapacityCheck(2 , 3 , capacity ,FoodInfo);
	cout<<CapacityCheck(3 , 3 , capacity ,FoodInfo);
	
	cout<<endl;
	cout<<dist2origin(0, FoodInfo)<<endl;
	cout<<dist2origin(1, FoodInfo)<<endl;
	cout<<dist2origin(2, FoodInfo)<<endl;
	cout<<dist2origin(3, FoodInfo)<<endl;
	
	cout<<endl;
	
	//cout<<dist(0, 0, FoodInfo)<<endl;
	//c//out<<dist(0, 1, FoodInfo)<<endl;
	//cout<<dist(1, 2, FoodInfo)<<endl;
	
	//cout<<"asd"<<dist(0, 1, FoodInfo)+dist(1, 2, FoodInfo)+dist(2, 3, FoodInfo)<<endl;
	
//.........这里部分代码省略.........
开发者ID:cftang0827,项目名称:Algo,代码行数:101,代码来源:temp.cpp

示例5: ProcPacket

bool Network::ProcPacket()
{
	if( _client == NULL )
	{
		return FALSE;
	}

	Sleep(30);

	Packet* p;
	p = _client->Receive();

	if (p==0)
		return FALSE;

	RakNet::BitStream inStream( p->data, p->length, false );

	unsigned char packetIdentifier;
	inStream.Read( packetIdentifier );

	switch (packetIdentifier)
	{
	case S2CH_LOGIN_RES:
		{
			// 패킷 읽기
			int isSuccessAuth;
			inStream.Read( isSuccessAuth );

			int isHost;
			inStream.Read( isHost );

			int userNo;
			inStream.Read( userNo );
			
			// 데이터 저장
			Network::GetInstance()._isSuccessAuth = isSuccessAuth;
			Network::GetInstance()._isHost = isHost;
			_myUserNo = userNo;
		}
		break;

	case S2H_GET_USERINFO_LIST_RES:
		{
			// 기존 데이터 초기화
			_userList.clear();

			// 패킷 읽기
			int count = 0;
			inStream.Read( count );

			for( int num = 0; num < count; num++ )
			{
				UserInfo userInfo;
				inStream.Read( userInfo._userNo );
				inStream.Read( userInfo._userName );
				inStream.Read( userInfo._age );
				inStream.Read( userInfo._sex );
				inStream.Read( userInfo._tall );
				inStream.Read( userInfo._weight );
				inStream.Read( userInfo._blood );
				inStream.Read( userInfo._tel );
				inStream.Read( userInfo._pic );
				_userList.push_back( userInfo );
			}

			// 데이터 갱신
			return TRUE;
		}
		break;
	case S2CH_GET_USERDATA_LIST_RES:
		{
			// 기존 데이터 초기화
			_userDataList.clear();

			// 패킷 읽기
			int count = 0;
			inStream.Read( count );

			for( int num = 0; num < count; num++ )
			{
				UserData userData;
				inStream.Read( userData._year );
				inStream.Read( userData._month );
				inStream.Read( userData._day );
				inStream.Read( userData._hour );
				inStream.Read( userData._min );
				inStream.Read( userData._value );
				inStream.Read( userData._temp );
				_userDataList.push_back( userData );
			}

			// 데이터 갱신
			return TRUE;
		}
		break;
	case S2H_CLIENT_DATA_RES:
		{
			// 패킷 읽기
			int userNo = 0;
			inStream.Read( userNo );
//.........这里部分代码省略.........
开发者ID:markisme,项目名称:healthcare,代码行数:101,代码来源:Network.cpp


注:本文中的DataList::push_back方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。