1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101
|
This is my entire code:
#include <iostream>
#include <algorithm>
#include <string>
#include <iomanip>
#include <limits>
#include <stdio.h>
#include <sstream>
#include <vector>
using namespace std;
using std::stringstream;
string extract(string pMemx);//
unsigned long toMByte(int phyMemz, string valz);//
string commentIgnore( string& input);//
unsigned long toByte(int phyMemx, string valx);//
string pMem, comment, sGen, val,input,id,size,inits,incs;
int gen, phyMem, i=0, oBrckt=0, cBrckt=0, gBrckt=0, v1 =0, v2 =0, sizeint;
unsigned long pmemSize =0;
//int pmemSize =0;
char t[10], m[256],init[10],inc[10];
struct rootset {
unsigned long totSize;
unsigned long *rStrtPtr;
unsigned long *rEndPtr;
vector<unsigned long> physicalM;
struct generations {
unsigned long gtotSize;
const char *genStrtPtr;
const char *genEndPtr;
int numOfGen;
string genName;
struct object {
unsigned long objSize;
const char *objStrtPtr;
const char *objEndPtr;
string id;
char markBit;
char objPtr;
};
struct freeList {
unsigned long freeSpace;
int flNumb;
};
};
};
int main()
{
cin >> pmemSize>>gen;
/*Assign the Physical memory allocated by user */
vector<rootset> pRootSet;
pRootSet.push_back(rootset());
pRootSet[0].totSize = pmemSize;
pRootSet[0].physicalM.reserve(pmemSize);
for (int s=0; s<pmemSize; ++s)
pRootSet[0].physicalM.push_back(s);
pRootSet[0].rStrtPtr = &*(pRootSet[0].physicalM.begin());
pRootSet[0].rEndPtr = &*(pRootSet[0].physicalM.end());
vector<unsigned long>::iterator it;
for(it = pRootSet[0].physicalM.begin(); it!= pRootSet[0].physicalM.end(); ++it)
cout <<"Printing it: " <<(*it)<<endl;
/* Create the generations and their names -> gen*/
vector <rootset::generations> generation;
for( i=0; i<gen; i++) {
stringstream out;
out << i;
string s = out.str();
generation.push_back(rootset::generations());
rootset::generations.push_back(pmemSize/gen);
generation[i].genName = "generation" + s;
generation[i].gtotSize = pmemSize/gen;
cout<<"gen size: "<<generation[i].gtotSize<<endl;
}
}
|