Esempio n. 1
0
void Datastore::test()
{
    printMessage(ENTRY_SIZE_MESSAGE);
    Serial.println(DATASTORE_LOG_ENTRY_SIZE);
    printMessage(MAX_ENTRIES_MESSAGE);
    Serial.println(DATASTORE_MAX_ENTRIES, DEC);
    printMessage(ERASING_MESSAGE);
    erase();
    printMessage(DONE_MESSAGE);
    printMessage(WRITING_MESSAGE);
    testWrite(1000);
    Serial.print("f1 ");
    testWrite(1000);
    Serial.print("f2 ");
    testWrite(2000);
    Serial.print("f3 ");
    printMessage(DONE_MESSAGE);
    printMessage(DATASTORE_SETUP_MESSAGE);
    setup();
    printMessage(DONE_MESSAGE);
    printMessage(NUM_FILES_MESSAGE);
    Serial.println(getNumberOfFiles(), DEC);
    printMessage(NUM_ENTRIES_MESSAGE);
    Serial.println(getNumberOfEntries(), DEC);
    printMessage(WRITING_MESSAGE);
    testWrite(1000);
    Serial.print("f1 ");
    testWrite(1000);
    Serial.print("f2 ");
    testWrite(2000);
    Serial.print("f3 ");
    printMessage(DONE_MESSAGE);
    printMessage(DATASTORE_SETUP_MESSAGE);
    setup();
    printMessage(DONE_MESSAGE);
    printMessage(NUM_FILES_MESSAGE);
    Serial.println(getNumberOfFiles(), DEC);
    printMessage(NUM_ENTRIES_MESSAGE);
    Serial.println(getNumberOfEntries(), DEC);

    printMessage(ERASING_MESSAGE);
    erase();
    printMessage(DONE_MESSAGE);

    printMessage(TEST_PASS_MESSAGE);

}
Path ofxPocoDirectoryLister::getPath(long l)
{
    Path tempPath = Path();

    if(l < getNumberOfFiles())
    {
        tempPath = currentFiles[l];
    }

    return tempPath;
}
Esempio n. 3
0
/*
 * void typeOfMaterial
 *inputs : set , indication of the type of material for the validation set, set to glass
 *when material is of training type and will be set randomly between glass and plastic.
 *
 *Sets the type of Material and number of metarial elements present
 *for the validation and test sets.
 *If the type is a training set, the material will be set randomly.And if the material is
 *a validation will be set to either plastic or glass. Depending on the previous set value.
 *a
 *
 * */
void typeOfMaterial(set* src, material mat){
	int material = 0;
	if (src->type == training){
		// srand ( time(NULL) ); only use when testing program
		 material = rand()%2;
		// printf("%d",material);
		 mat = (material ==0) ? glass :plastic;
		// printf("%d",material);// test for right param
		 src->material = mat; //  set type of material and folder to look for.
		 src->dir = imgDir[mat];
	}
	if (src->type == validation){
		src->material = mat;
		src->dir = imgDir[mat+2];// sets dir to validation index of material
	}
	src->NumOfElements = getNumberOfFiles(src->dir); //  sets number of images in folder

}