本文整理汇总了C++中Sequence::getSize方法的典型用法代码示例。如果您正苦于以下问题:C++ Sequence::getSize方法的具体用法?C++ Sequence::getSize怎么用?C++ Sequence::getSize使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Sequence
的用法示例。
在下文中一共展示了Sequence::getSize方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
bool Sequence<TYPE>::isEqual(Sequence<TYPE> &s){
Node *aux1 = list.next;
Node *aux2 = s.list.next;
if(getSize()!= s.getSize())
return false;
for (int i = 0; i < getSize(); i++){
if (aux1->data != aux2->data)
return false;
aux1 = aux1->next;
aux2 = aux2->next;
}
return true;
}
示例2: main
int main(int argc, char **argv) {
if(argc!=5) {
cout << "usage: " << argv[0] << " <text> <offsets> <queries> <seq>" << endl;
cout << " seq=1: Wavelet Tree Noptrs RG5" << endl;
cout << " seq=2: Wavelet Tree Noptrs RG10" << endl;
cout << " seq=3: Wavelet Tree Noptrs RG20" << endl;
cout << " seq=4: Wavelet Tree Noptrs RRR16" << endl;
cout << " seq=5: Wavelet Tree Noptrs RRR32" << endl;
cout << " seq=6: Wavelet Tree Noptrs RRR64" << endl;
cout << " seq=7: GMR B=RG20 X=RG20 PS=16" << endl;
return 0;
}
uint seq = transform(string(argv[4]));
ifstream input_seq(argv[1]);
Array * A = new Array(input_seq);
input_seq.close();
SequenceBuilder * sb,*sb1,*sb2,*sb3;
Sequence * S;
switch(seq) {
case 1:
S = new WaveletTreeNoptrs(*A, new BitSequenceBuilderRG(5),new MapperNone());
break;
case 2:
S = new WaveletTreeNoptrs(*A, new BitSequenceBuilderRG(10),new MapperNone());
break;
case 3:
S = new WaveletTreeNoptrs(*A, new BitSequenceBuilderRG(20),new MapperNone());
break;
case 4:
S = new WaveletTreeNoptrs(*A, new BitSequenceBuilderRRR(16),new MapperNone());
break;
case 5:
S = new WaveletTreeNoptrs(*A, new BitSequenceBuilderRRR(32),new MapperNone());
break;
case 6:
S = new WaveletTreeNoptrs(*A, new BitSequenceBuilderRRR(64),new MapperNone());
break;
case 7:
sb = new SequenceBuilderGMRChunk(new BitSequenceBuilderRG(20),new PermutationBuilderMRRR(16, new BitSequenceBuilderRG(20)));
S = new SequenceGMR(*A, 2*A->getMax(), new BitSequenceBuilderRG(20), sb);
break;
case 8:
sb1 = new SequenceBuilderWaveletTree(new BitSequenceBuilderRG(20), new MapperNone());
sb2 = new SequenceBuilderGMRChunk(new BitSequenceBuilderRG(20),new PermutationBuilderMRRR(16, new BitSequenceBuilderRG(20)));
sb3 = new SequenceBuilderGMR(new BitSequenceBuilderRG(20),sb2);
S = new SequenceAlphPart(*A, 10, sb1, sb3);
break;
}
cout << "Sequence size: " << S->getSize() << endl;
ifstream input_offs(argv[2]);
uint of;
vector<uint> offsets;
while((input_offs>>of)) offsets.push_back(of);
offsets.push_back(S->getLength());
input_offs.close();
cout << "Structure size: " << S->getSize()+offsets.size()*sizeof(uint) << endl;
cout << "No of documents: " << offsets.size() << endl;
cout << "No of words: " << A->getMax() << endl;
ifstream input(argv[3]);
vector<vector<uint> > queries;
uint qs;
while((input >> qs)) {
vector<uint> query;
for(uint i=0; i<qs; i++) {
uint tmp;
input >> tmp;
query.push_back(tmp);
}
queries.push_back(query);
}
input.close();
#define ERROUT 0
uint acc = 0;
start_timing();
vector<uint> aux;
for(uint i=0; i<queries.size(); i++) {
aux.clear();
intersect2(queries[i],S,offsets,aux);
#if ERROUT
for(uint j=0; j<aux.size(); j++) {
cerr << " " << aux[j];
acc += aux[j];
}
cerr << endl;
#else
acc += aux.size();
#endif
}
double t=get_timing();
cout << "acc: " << acc << endl;
cout << "Total time: " << t << " ms" << endl;
//.........这里部分代码省略.........
示例3: outputSeq
bool AlpDMD::outputSeq(Sequence seq, int mode){
if (verbose) cout << "AlpDMD::outputSeq: Placing a single frame on the device" << endl;
ALP_ID sequenceID;
AlpDevHalt(deviceID);
// This variable needs to be bigger as we have more than one image.
UCHAR *transmitImages = NULL;
transmitImages = new UCHAR[(1920*1080)*seq.getSize()];
if (verbose) cout << "AlpDMD::outputSeq: Getting Pixels" << endl;
for (int n=0; n<seq.getSize(); n++){ // For each image
for (int x=0; x<1920; x++){
for (int y=0; y<1080; y++){ // Use n to place the data in the correct place.
if (seq.frames[n].getPix(x,y) == 1){
FillMemory( transmitImages+x+(y*1920)+(n*(1920*1080)), 1, 0x00);
} else {
FillMemory( transmitImages+x+(y*1920)+(n*(1920*1080)), 1, 0x80);
}
}
}
}
if (verbose) cout << "AlpDMD::outputSeq: Defaulting Trigger Mode." << endl;
state = AlpDevControl(deviceID, ALP_TRIGGER_POLARITY, ALP_DEFAULT);
if (ALP_OK != state){
cout << "AlpDMD::outputSeq: Error 8 - Device Rejected Trigger mode reversion. " << state << endl;
return 1;
}
state = AlpProjControl(deviceID, ALP_PROJ_MODE, ALP_DEFAULT);
if (ALP_OK != state){
cout << "AlpDMD::outputSeq: Error 9 - Projection Rejected Trigger mode reversion. " << state << endl;
return 1;
}
if (verbose) cout << "AlpDMD::outputSeq: Allocating Sequence" << endl;
// Sequence consists of more than one image, remember to allocate the correct size.
state = AlpSeqAlloc(deviceID, 1, seq.getSize(), &sequenceID);
if (ALP_OK != state){
cout << "AlpDMD::outputSeq: Error 1 - Unable to Allocate Sequence. " << state << endl;
return 1;
}
currentSeq = sequenceID;
if (verbose) cout << "AlpDMD::outputSeq: Sending to Device" << endl;
state = AlpSeqPut(deviceID, sequenceID, 0, seq.getSize(), transmitImages); // As above
if (ALP_OK != state){
cout << "AlpDMD::outputSeq: Error 2 - Unable to Transmit Sequence. " << state << endl;
return 1;
}
if (verbose) cout << "AlpDMD::outputSeq: Freeing Memory" << endl;
free(transmitImages);
if (verbose) cout << "AlpDMD::outputSeq: Changing Device to Uninterrupted Mode" << endl;
state = AlpSeqControl(deviceID, sequenceID, ALP_BIN_MODE, ALP_BIN_UNINTERRUPTED);
if (ALP_OK != state){
cout << "AlpDMD::outputSeq: Error 3 - Unable to Request Uninterrupted mode. " << state << endl;
return 1;
}
if (verbose) cout << "AlpDMD::outputSeq: Setting up timings" << endl;
state = AlpSeqTiming(deviceID, sequenceID, ALP_DEFAULT, pictureTime, ALP_DEFAULT, ALP_DEFAULT, ALP_DEFAULT);
if (ALP_OK != state){
cout << "AlpDMD::outputSeq: Error 4 - Unable to Set to the desired timing settings."
<< "See \"help timings\" for details. " << state << endl;
return 1;
}
switch(mode){
case 2: // Hardware Trigger Mode
if (verbose) cout << "AlpDMD::outputSeq: Requesting Trigger Mode." << endl;
state = AlpDevControl(deviceID, ALP_VD_EDGE, ALP_DEFAULT);
if (ALP_OK != state){
cout << "AlpDMD::outputSeq: Error 5 - Device Rejected Trigger mode change. " << state << endl;
return 1;
}
state = AlpProjControl(deviceID, ALP_PROJ_MODE, ALP_SLAVE_VD);
if (ALP_OK != state){
cout << "AlpDMD::outputSeq: Error 6 - Projection Rejected Trigger mode change. " << state << endl;
return 1;
}
//.........这里部分代码省略.........
示例4: getSize
int getSize(){
return seq.getSize();
}