本文整理汇总了C++中readArray函数的典型用法代码示例。如果您正苦于以下问题:C++ readArray函数的具体用法?C++ readArray怎么用?C++ readArray使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了readArray函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: IpxAddress
IpxAddress PacketReader::readIpxAddress() {
IpxAddress temp = IpxAddress();
readArray(temp.network, 4);
readArray(temp.node, 6);
readArray(temp.socket, 2);
return temp;
}
开发者ID:Loucher,项目名称:Komunikacne-siete-2,代码行数:7,代码来源:PacketReader.cpp
示例2: readArray
asynStatus isisdaeDriver::readInt32Array(asynUser *pasynUser, epicsInt32 *value, size_t nElements, size_t *nIn)
{
asynStatus stat = readArray(pasynUser, "readInt32Array", value, nElements, nIn);
callParamCallbacks(); // this flushes P_ErrMsgs
doCallbacksInt32Array(value, *nIn, pasynUser->reason, 0);
return stat;
}
开发者ID:ISISComputingGroup,项目名称:EPICS-isisdae,代码行数:7,代码来源:isisdaeDriver.cpp
示例3: readStringArray
inline StringArray readStringArray(std::istream& istrm)
{
BinarySerialization::verifySignature(istrm, BINSIG_STRARRAY);
StringArray stra;
readArray(istrm, stra);
return stra;
}
开发者ID:kkaempf,项目名称:openwbem,代码行数:7,代码来源:OW_BinarySerialization.hpp
示例4: getSA
/* get the SA of text
* if filename is given search if the SA is already computed
*/
unsigned int* getSA(unsigned char const* text, int length, const char* filename){
char filename_temp[] = "stdin";
char filename_sa[1024];
unsigned int* sa;
if(filename == NULL)
filename = filename_temp;
/*filename = basename(filename);*/ /*not sure about this*/
snprintf(filename_sa,1024,"%s.sa",filename);
/* checks if we already computed the SA*/
if(access(filename_sa, R_OK)!=0 || strcmp(filename,"stdin") == 0 || strcmp(filename, "stdin.rev") == 0){
sa = new unsigned int[length];
unsigned int err = divsufsort(text, (saidx_t*)sa, (saidx_t)length);
if(err){
fprintf(stderr, "ERROR: SA: constructing the SA\n");
}
err = saveArray((unsigned char*)sa, length * sizeof(unsigned int), filename_sa);
if(err != 0){
fprintf(stderr,"ERROR: SA: saving the SA\n");
}
}else{
unsigned int salen;
sa = (unsigned int*)readArray(filename_sa, &salen, sizeof(unsigned int));
}
return sa;
}
开发者ID:bojifengyu,项目名称:uiHRDC,代码行数:28,代码来源:utils.cpp
示例5: readArray
QList<segment_command_64> MACHFile::getSegmentsList64()
{
QList<load_command_offset> list=getLoadCommands_offset();
unsigned int nOffset=0;
QList<segment_command_64> listResult;
segment_command_64 record;
for(int i=0; i<list.count(); i++)
{
if(list.at(i).cmd==LC_SEGMENT_64)
{
nOffset=list.at(i).offset;
record.cmd=readDword(nOffset+offsetof(segment_command_64,cmd),isReverse());
record.cmdsize=readDword(nOffset+offsetof(segment_command_64,cmdsize),isReverse());
readArray(nOffset+offsetof(segment_command_64,segname),record.segname,16);
record.vmaddr=readQword(nOffset+offsetof(segment_command_64,vmaddr),isReverse());
record.vmsize=readQword(nOffset+offsetof(segment_command_64,vmsize),isReverse());
record.fileoff=readQword(nOffset+offsetof(segment_command_64,fileoff),isReverse());
record.filesize=readQword(nOffset+offsetof(segment_command_64,filesize),isReverse());
record.maxprot=readDword(nOffset+offsetof(segment_command_64,maxprot),isReverse());
record.initprot=readDword(nOffset+offsetof(segment_command_64,initprot),isReverse());
record.nsects=readDword(nOffset+offsetof(segment_command_64,nsects),isReverse());
record.flags=readDword(nOffset+offsetof(segment_command_64,flags),isReverse());
listResult.append(record);
}
}
return listResult;
}
开发者ID:BackTrackCRoot,项目名称:DIE-engine,代码行数:34,代码来源:machfile.cpp
示例6: ReadError
void SF2Reader::readList(SimpleArray<T, E>& a, const chunkHeader& h) {
size_t n = h.chunkSize;
if(n%sizeof(T)!=0)
throw ReadError("list "+std::string(h.chunkId, 4)+" not a multiple of record size");
Assert(n/sizeof(T)>=E);
a.resize(n/sizeof(T)-E);
readArray(a.begin(), a.size()+E);
}
开发者ID:ArchRobison,项目名称:Wacoder,代码行数:8,代码来源:SF2Reader.cpp
示例7: main
int main(void) {
int list[MAX_SIZE], size;
size = readArray(list);
printArray(list, size);
printf("Sum = %d\n", sumArray(list, size));
return 0;
}
开发者ID:InduminiAyomi,项目名称:CO222_Labs,代码行数:10,代码来源:SumArray.c
示例8: main
int main(int argc, char * argv[])
{
int howMany;
double localSum, finalSum;
double * masterArray;
double t1, t2;
/* MPI Initialization */
int numProc = -1;
int id = -1;
MPI_Init(&argc, &argv);
MPI_Comm_size(MPI_COMM_WORLD, &numProc);
MPI_Comm_rank(MPI_COMM_WORLD, &id);
if (argc != 2) {
fprintf(stderr, "\n*** Usage: arraySum <inputFile>\n\n");
exit(1);
}
t1 = MPI_Wtime();
/* Master */
if (id == 0) {
// Read the array into memory
readArray(argv[1], &masterArray, &howMany);
if (debug) {
printf("Master has read the array of size %d\n\n", howMany);
}
// Wait until the array has been read before we do anything
MPI_Bcast(&howMany, 1, MPI_DOUBLE, 0, MPI_COMM_WORLD);
}
/* Worker */
else {
// Need our workers to be patient
MPI_Bcast(&howMany, 1, MPI_DOUBLE, 0, MPI_COMM_WORLD);
}
finalSum = parallelSumArray(masterArray, howMany, id, numProc);
t2 = MPI_Wtime();
if (id == 0) {
printf("\nThe sum of the values in the input file '%s' is %g\n",
argv[1], finalSum);
printf("It took '%g' seconds to compute \n", t2 - t1);
}
MPI_Finalize();
return 0;
}
开发者ID:tjdevries,项目名称:cs_374_project,代码行数:55,代码来源:mpiArraySum.c
示例9: setupArrays
/**
Loads initial configuration at process 0 and sends it to other processes
*/
void setupArrays(const char* configFile, ARRAY2D arrays[2], int* pUpper, int* pLower) {
int lengthWidth[2] = {0};
int size, rank;
// get the size process group and the rank of this process
MPI_Comm_size(MPI_COMM_WORLD, &size);
MPI_Comm_rank(MPI_COMM_WORLD, &rank);
// load initial configuration at process 0
if(rank == 0) {
arrays[0] = readArray(configFile);
arrays[1] = newArray(arrays[0].length, arrays[0].width);
// check the size and number of processes - we currently only support even decompositions
if(arrays[0].length % size != 0) {
// TODO: used MPI_Scatterv and MPI_Gatherv to support uneven decompositions
printf("This program does not support uneven decompositions. The number of rows (%d) \n"
"should be divisible by the number of processes (%d)\n", arrays[0].length, size);
MPI_Abort(MPI_COMM_WORLD, -1);
}
lengthWidth[0] = arrays[0].length;
lengthWidth[1] = arrays[0].width;
}
// broadcast the size of the array to everyone
MPI_Bcast(lengthWidth, 2, MPI_INT, 0, MPI_COMM_WORLD);
// non root nodes must allocate buffer space
if(rank != 0) {
arrays[0] = newArray(lengthWidth[0], lengthWidth[1]);
arrays[1] = newArray(lengthWidth[0], lengthWidth[1]);
}
// calculate bounds
*pLower = rowsLowerBound(arrays[0].length, size, rank);
*pUpper = rowsUpperBound(arrays[0].length, size, rank);
// if running on more than one process
if(size > 1) {
// TODO: requires an even size decomposition
// send configuration to each process
/*MPI_Scatter(
arrays[0].data, (*pUpper-*pLower)*arrays[0].width, MPI_CHAR,
ARRAY2D_PTR(arrays[0],*pLower,0), (*pUpper-*pLower)*arrays[0].width, MPI_CHAR,
0, MPI_COMM_WORLD);*/
// each process needs not only its own chunk, but also the row above and
// below it, so the simple MPI_Scatter call is insufficient
// Broadcasting the entire config is an inefficient solution, but it's
// also simple
MPI_Bcast(arrays[0].data, arrays[0].length*arrays[0].width, MPI_CHAR, 0, MPI_COMM_WORLD);
}
}
开发者ID:danielcranford,项目名称:cs420,代码行数:56,代码来源:mpi_life.c
示例10: pop
void ScummEngine_v71he::o71_getCharIndexInString() {
int array, end, len, pos, value;
value = pop();
end = pop();
pos = pop();
array = pop();
if (end >= 0) {
len = resStrLen(getStringAddress(array));
if (len < end)
end = len;
} else {
end = 0;
}
if (pos < 0)
pos = 0;
writeVar(0, array);
if (end > pos) {
while (end >= pos) {
if (readArray(0, 0, pos) == value) {
push(pos);
return;
}
pos++;
}
} else {
while (end <= pos) {
if (readArray(0, 0, pos) == value) {
push(pos);
return;
}
pos--;
}
}
push(-1);
}
开发者ID:AReim1982,项目名称:scummvm,代码行数:40,代码来源:script_v71he.cpp
示例11: load_representation
int load_representation (void **representation, char *basename){
char basenametext[2048]; sprintf(basenametext,"%s.%s",basename,"lztext");
char fn_doclen[2048];
snprintf(fn_doclen,2048,"%s.doclen",basenametext);
lzdoc* repr = (lzdoc*)malloc(sizeof(lzdoc));
unsigned int* doc_len = (unsigned int*)readArray(fn_doclen,(int*)(&(repr->docs)),sizeof(unsigned int));
repr->doc_array = new DeltaCodes(doc_len,repr->docs, DELTA_SAMPLING);
free(doc_len);
repr->extractor = new ExtractorEnd2(basenametext, DELTA_SAMPLING);
*representation = repr;
return 0;
}
开发者ID:bojifengyu,项目名称:uiHRDC,代码行数:13,代码来源:compressor.cpp
示例12: main
int main() {
std::vector<int> data = readArray();
printArray("Input", data);
//ISort* sortAlgorithm = new InsertionSort();
ISort* sortAlgorithm = new Quicksort();
sortAlgorithm->sort(data);
printArray("Output with " + sortAlgorithm->name(), data);
delete sortAlgorithm;
return 0;
}
开发者ID:Phybbit,项目名称:training,代码行数:13,代码来源:main.cpp
示例13: read
void SF2Reader::readPdtaList() {
chunkHeader pdtaList;
read(pdtaList);
char pdtaHeader[4];
readArray(pdtaHeader,4);
size_t n = pdtaList.chunkSize-4;
Assert(sizeof(SF2Bank::Rec_bag)==4);
Assert(sizeof(SF2Bank::Rec_gen)==4);
Assert(sizeof(SF2Bank::Rec_mod)==10);
while(n>0) {
if( n<sizeof(chunkHeader) )
throw ReadError("pdta-list corrupted");
chunkHeader item;
read(item);
switch(item.id()) {
case ChunkId::phdr:
readList(myBank->phdr,item);
break;
case ChunkId::pbag:
readList(myBank->p.bag,item);
break;
case ChunkId::pmod:
readList(myBank->p.mod,item);
break;
case ChunkId::pgen:
readList(myBank->p.gen,item);
break;
case ChunkId::inst:
readList(myBank->inst,item);
break;
case ChunkId::ibag:
readList(myBank->i.bag,item);
break;
case ChunkId::imod:
readList(myBank->i.mod,item);
break;
case ChunkId::igen:
readList(myBank->i.gen,item);
break;
case ChunkId::shdr:
readList(myBank->shdr,item);
break;
default:
Assert(0);
skip(item.chunkSize);
break;
}
n -= 8 + item.chunkSize;
}
}
开发者ID:ArchRobison,项目名称:Wacoder,代码行数:50,代码来源:SF2Reader.cpp
示例14: skipCommentTokens
bool
Reader::readValue()
{
Token token;
skipCommentTokens( token );
bool successful = true;
if ( collectComments_ && !commentsBefore_.empty() )
{
currentValue().setComment( commentsBefore_, commentBefore );
commentsBefore_ = "";
}
switch ( token.type_ )
{
case tokenObjectBegin:
successful = readObject( token );
break;
case tokenArrayBegin:
successful = readArray( token );
break;
case tokenNumber:
successful = decodeNumber( token );
break;
case tokenString:
successful = decodeString( token );
break;
case tokenTrue:
currentValue() = true;
break;
case tokenFalse:
currentValue() = false;
break;
case tokenNull:
currentValue() = Value();
break;
default:
return addError( "Syntax error: value, object or array expected.", token );
}
if ( collectComments_ )
{
lastValueEnd_ = current_;
lastValue_ = ¤tValue();
}
return successful;
}
开发者ID:herryRiver,项目名称:sdl_core_v3.6_wince,代码行数:49,代码来源:json_reader.cpp
示例15: main
int main ( int argc, char * argv[] ) {
int size = 0;
scanf("%d", &size);
int * myReturn = readArray( size );
int i;
printf( "myReturn begin: %p\n", myReturn );
for ( i = 0; i < size; i++ ) {
printf( " element %d = %d\n", i , *myReturn );
myReturn ++;
}
printf( "myReturn end: %p\n", myReturn );
printf( "myReturn reset: %p\n", myReturn - size );
return EXIT_SUCCESS;
}
开发者ID:FionaCLin,项目名称:Language-Framework-Learning,代码行数:15,代码来源:tut1.c
示例16: switch
Value* Parser::readValue()
{
Tokenizer::TokenType tok = tokenizer->nextToken();
switch (tok)
{
case Tokenizer::TokenNumber:
return new Value(tokenizer->getNumberValue());
case Tokenizer::TokenString:
return new Value(tokenizer->getStringValue());
case Tokenizer::TokenName:
if (tokenizer->getNameValue() == "false")
return new Value(false);
else if (tokenizer->getNameValue() == "true")
return new Value(true);
else
{
tokenizer->pushBack();
return NULL;
}
case Tokenizer::TokenBeginArray:
tokenizer->pushBack();
{
Array* array = readArray();
if (array == NULL)
return NULL;
else
return new Value(array);
}
case Tokenizer::TokenBeginGroup:
tokenizer->pushBack();
{
Hash* hash = readHash();
if (hash == NULL)
return NULL;
else
return new Value(hash);
}
default:
tokenizer->pushBack();
return NULL;
}
}
开发者ID:jpcoles,项目名称:ZM,代码行数:47,代码来源:parser.cpp
示例17: main
int main(void)
{
int data[10];
int repCount;
//call readArray, save in data
readArray(data);
//call findNonRepeat, sets repCount returned value (index or -1)
repCount = findNonRepeat(data);
//if repCount is withing the number of indexs
if (repCount >= 0 && repCount <=9) {
printf("\nFirst non-repeating element: %d\n", data[repCount]); //repCount = index
} else if (repCount == -1)
printf("\nThere is no non-reapeating element\n"); //repCount = -1
return 0;
}
开发者ID:evanlaia,项目名称:cs1713,代码行数:19,代码来源:arrayRepeat.c
示例18: loadString
bool
CJson::
loadString(const std::string &lines, ValueP &value)
{
std::vector<std::string> strs;
CStrParse parse(lines);
parse.skipSpace();
if (parse.isChar('{')) { // object
Object *obj;
if (! readObject(parse, obj))
return false;
value = ValueP(obj);
}
else if (parse.isChar('[')) { // array
Array *array;
if (! readArray(parse, array))
return false;
value = ValueP(array);
}
else {
ValueP value1;
if (! readValue(parse, value1))
return false;
value = value1;
}
parse.skipSpace();
if (! parse.eof())
return false;
return true;
}
开发者ID:colinw7,项目名称:CJson,代码行数:42,代码来源:CJson.cpp
示例19: readString
void JsonSchema::readValues(cJSON *childProperties, PropertiesPtr property ,
const std::string &attType)
{
if (attType == "string")
{
readString(childProperties, property);
}
else if (attType == "integer")
{
readInteger(childProperties, property);
}
else if (attType == "array")
{
readArray(childProperties, property);
}
else if (attType == "number")
{
readDouble(childProperties, property);
}
}
开发者ID:TianyouLi,项目名称:iotivity,代码行数:20,代码来源:JsonSchema.cpp
示例20: switch
Value* Parser::readValue() {
Tokenizer::TokenType tok = tokenizer->nextToken();
switch (tok) {
case Tokenizer::TokenInteger:
return new Value(tokenizer->getIntegerValue());
case Tokenizer::TokenFloat:
return new Value(tokenizer->getFloatValue());
case Tokenizer::TokenString:
return new Value(tokenizer->getStringValue());
case Tokenizer::TokenBeginArray:
tokenizer->pushBack();
{
Array* array = readArray();
if (array == NULL) {
return NULL;
}
else {
return new Value(array);
}
}
case Tokenizer::TokenBeginGroup:
tokenizer->pushBack();
{
Hash* hash = readHash();
if (hash == NULL) {
return NULL;
}
else {
return new Value(hash);
}
}
default:
tokenizer->pushBack();
return NULL;
}
}
开发者ID:dicta,项目名称:ray,代码行数:41,代码来源:Parser.cpp
注:本文中的readArray函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论