Beispiel #1
0
void SSLWorld::glinit()
{
    g->loadTexture(new QImage(":/grass.png"));

    // Loading Robot textures for each robot
    for (int i = 0; i < ROBOT_COUNT; i++)
        g->loadTexture(createBlob('b', i, &robots[i]->img));

    for (int i = 0; i < ROBOT_COUNT; i++)
        g->loadTexture(createBlob('y', i, &robots[ROBOT_COUNT + i]->img));

    // Creating number textures
    for (int i=0; i<ROBOT_COUNT;i++)
        g->loadTexture(createNumber(i,15,193,225,255));

    for (int i=0; i<ROBOT_COUNT;i++)
        g->loadTexture(createNumber(i,0xff,0xff,0,255));

    // Loading sky textures
    // XXX: for some reason they are loaded twice otherwise the wheel texture is wrong
    for (int i=0; i<6; i++) {
        g->loadTexture(new QImage(QString(":/sky/neg_%1").arg(i%3==0?'x':i%3==1?'y':'z')+QString(".png")));
        g->loadTexture(new QImage(QString(":/sky/pos_%1").arg(i%3==0?'x':i%3==1?'y':'z')+QString(".png")));
    }

    // The wheel texture
    g->loadTexture(new QImage(":/wheel.png"));

    // Init at last
    p->glinit();
}
void StokesOnlyPipeline::init()
{
    // Create modules
    rfiClipper = (RFI_Clipper *) createModule("RFI_Clipper");
    stokesIntegrator = (StokesIntegrator *) createModule("StokesIntegrator");

    // Create local datablobs
    _intStokes = (SpectrumDataSetStokes*) createBlob("SpectrumDataSetStokes");
    _weightedIntStokes = (WeightedSpectrumDataSet*) createBlob("WeightedSpectrumDataSet");

    // Request remote data
    requestRemoteData("LofarTimeStream1");
}
// Initialises the pipeline, creating required modules and data blobs, and requesting remote data.
void K7UdpPipeline::init()
{
    ConfigNode c = config(QString("K7UdpPipeline"));
    _totalIterations = c.getOption("totalIterations", "value", "0").toInt();
    std::cout << "K7UdpPipeline::init(): " << _totalIterations << " iterations of the pipeline" << std::endl;

    // Create the pipeline modules and any local data blobs.
    _rfiClipper = (RFI_Clipper *) createModule("RFI_Clipper");
    _stokesIntegrator = (StokesIntegrator *) createModule("StokesIntegrator");
    _intStokes = (SpectrumDataSetStokes *) createBlob("SpectrumDataSetStokes");
    _weightedIntStokes = (WeightedSpectrumDataSet*) createBlob("WeightedSpectrumDataSet");
    // Request remote data.
    requestRemoteData("SpectrumDataSetStokes");
}
/**
 * @details
 * Initialises the pipeline.
 *
 * This method is run once on construction of the pipeline.
 */
void TimingPipeline::init()
{
    // Create modules
    ppfChanneliser = (PPFChanneliser *) createModule("PPFChanneliser");
    stokesGenerator = (StokesGenerator *) createModule("StokesGenerator");
    rfiClipper = (RFI_Clipper *) createModule("RFI_Clipper");
    stokesIntegrator = (StokesIntegrator *) createModule("StokesIntegrator");
    weightedIntStokes = (WeightedSpectrumDataSet*) createBlob("WeightedSpectrumDataSet");

    // Create local datablobs
    spectra = (SpectrumDataSetC32*) createBlob("SpectrumDataSetC32");
    stokes = (SpectrumDataSetStokes*) createBlob("SpectrumDataSetStokes");
    intStokes = (SpectrumDataSetStokes*) createBlob("SpectrumDataSetStokes");
    weightedIntStokes = (WeightedSpectrumDataSet*) createBlob("WeightedSpectrumDataSet");

    // Request remote data
    requestRemoteData("LofarTimeStream1");
}
// Initialises the pipeline, creating required modules and data blobs,
// and requesting remote data.
void SignalProcessingPipeline::init()
{
    // Create the pipeline modules and any local data blobs.
    amplifier = (SignalAmplifier*) createModule("SignalAmplifier");
    outputData = (SignalData*) createBlob("SignalData");

    // Request remote data.
    requestRemoteData("SignalData");
}
void SSLWorld::glinit()
{
    g->loadTexture(new QImage(":/Graphics/grass001.bmp"));
    g->loadTexture(createBlob('b',0,&robots[0]->img));
    g->loadTexture(createBlob('b',1,&robots[1]->img));
    g->loadTexture(createBlob('b',2,&robots[2]->img));
    g->loadTexture(createBlob('b',3,&robots[3]->img));
    g->loadTexture(createBlob('b',4,&robots[4]->img));
    g->loadTexture(createBlob('y',0,&robots[5]->img));
    g->loadTexture(createBlob('y',1,&robots[6]->img));
    g->loadTexture(createBlob('y',2,&robots[7]->img));
    g->loadTexture(createBlob('y',3,&robots[8]->img));
    g->loadTexture(createBlob('y',4,&robots[9]->img));
    g->loadTexture(createNumber(0,15,193,225,255));
    g->loadTexture(createNumber(1,15,193,225,255));
    g->loadTexture(createNumber(2,15,193,225,255));
    g->loadTexture(createNumber(3,15,193,225,255));
    g->loadTexture(createNumber(4,15,193,225,255));
    g->loadTexture(createNumber(0,0xff,0xff,0,255));
    g->loadTexture(createNumber(1,0xff,0xff,0,255));
    g->loadTexture(createNumber(2,0xff,0xff,0,255));
    g->loadTexture(createNumber(3,0xff,0xff,0,255));
    g->loadTexture(createNumber(4,0xff,0xff,0,255));
    g->loadTexture(createNumber(0,15,193,225,100));
    g->loadTexture(createNumber(1,15,193,225,100));
    g->loadTexture(createNumber(2,15,193,225,100));
    g->loadTexture(createNumber(3,15,193,225,100));
    g->loadTexture(createNumber(4,15,193,225,100));
    g->loadTexture(createNumber(0,0xff,0xff,0,100));
    g->loadTexture(createNumber(1,0xff,0xff,0,100));
    g->loadTexture(createNumber(2,0xff,0xff,0,100));
    g->loadTexture(createNumber(3,0xff,0xff,0,100));
    g->loadTexture(createNumber(4,0xff,0xff,0,100));
    g->loadTexture(new QImage("../Graphics/sky/neg_x.bmp"));
    g->loadTexture(new QImage("../Graphics/sky/pos_x.bmp"));
    g->loadTexture(new QImage("../Graphics/sky/neg_y.bmp"));
    g->loadTexture(new QImage("../Graphics/sky/pos_y.bmp"));
    g->loadTexture(new QImage("../Graphics/sky/neg_z.bmp"));
    g->loadTexture(new QImage("../Graphics/sky/pos_z.bmp"));
    g->loadTexture(new QImage("../Graphics/Wheel.png"));
    //pos_y neg_x neg_y pos_x pos_z neg_z
    p->glinit();
}
void ofxEtherPEG::update()
{
	const unsigned char *ethernetPacket;
	const Packet *p;
	struct pcap_pkthdr header;
	
	ethernetPacket = pcap_next( pcap_session, &header );
	if( ethernetPacket ) {
		if( *(unsigned short *)(ethernetPacket+12) == EndianU16_NtoB(0x0800) ) { // ETHERTYPE_IP
			// skip ethernet header: 6 byte source, 6 byte dest, 2 byte type
			p = (Packet *)( ethernetPacket + 6 + 6 + 2 );
		}
		else if( *(unsigned short *)(ethernetPacket+12) == EndianU16_NtoB(0x8864) ) { // ETHERTYPE_???
			// skip ethernet header: 6 byte source, 6 byte dest, 2 byte type,
			// plus 8 bytes I don't know much about, but often seemed to be
			// 11 00 07 fb 05 b0 00 21.  something about promiscuous mode?
			p = (Packet *)( ethernetPacket + 6 + 6 + 2 + 8 );
		}
		else {
			// some other kind of packet -- no concern of ours
			return;
		}
#if 0
		if (p->protocol != 6)
			printf("p->protocol != 6\n");
		else if ((p->versionAndIHL & 0x0F) != 5)
			printf("(p->versionAndIHL & 0x0F) != 5\n");
		else if ((p->totalLength < 40) && !(p->moreFlagsAndJunk & kFINBit))
			printf("(p->totalLength < 40) && !(p->moreFlagsAndJunk & kFINBit)\n");
#endif
		if ((p->protocol == 6) && ((p->versionAndIHL & 0x0F) == 5)) 
		{
			if ((p->totalLength > 40) || (p->moreFlagsAndJunk & kFINBit)) {
				createBlob(ConsumePacket( p ));
			}
			else createBlob( 0 ); // yellow
		}
		else createBlob( 0 ); // yellow
	}
}
/**
 * @details
 * Initialises the pipeline.
 *
 * This method is run once on construction of the pipeline.
 */
void EmbraceBFPipeline::init()
{
    ConfigNode c = config( QString("EmbracePipeline") );
    _totalIterations= c.getOption("totalIterations", "value", "10000").toInt();    
    std::cout << _totalIterations << std::endl;
// Create modules
    // Create modules
    ppfChanneliser = (PPFChanneliser *) createModule("PPFChanneliser");
    embracePowerGenerator = (EmbracePowerGenerator *) createModule("EmbracePowerGenerator");
    rfiClipper = (RFI_Clipper *) createModule("RFI_Clipper");
    stokesIntegrator = (StokesIntegrator *) createModule("StokesIntegrator");

    // Create local datablobs
    spectra = (SpectrumDataSetC32*) createBlob("SpectrumDataSetC32");
    stokes = (SpectrumDataSetStokes*) createBlob("SpectrumDataSetStokes");
    intStokes = (SpectrumDataSetStokes*) createBlob("SpectrumDataSetStokes");
    weightedIntStokes = (WeightedSpectrumDataSet*) createBlob("WeightedSpectrumDataSet");

    // Request remote data
    requestRemoteData(_streamIdentifier);

}
Beispiel #9
0
int main(int argc, const char * argv[])
{
	printVersion();
	// check number of arguments and if all arguments can be read
	if (argc < 3 || !readArguments(argc, argv))
	{
		printUsage();
		return -1;
	}
	// check if the input path exist
	if (!FS_NAMESPACE::exists(inFilePath))
	{
		std::cout << "Error: Invalid input file/directory \"" << inFilePath.string() << "\"!" << std::endl;
		return -2;
	}
	if (createBinary)
	{
		// check if argument 2 is a file
		if (FS_NAMESPACE::is_directory(outFilePath))
		{
			std::cout << "Error: Output must be a file if -b is used!" << std::endl;
			return -2;
		}
	}
	else if (appendFile)
	{
		// check if argument 2 is a file
		if (FS_NAMESPACE::is_directory(outFilePath))
		{
			std::cout << "Error: Output must be a file if -a is used!" << std::endl;
			return -2;
		}
	}
	else if (FS_NAMESPACE::is_directory(inFilePath) != FS_NAMESPACE::is_directory(outFilePath))
	{
		// check if output directory exists
		if (FS_NAMESPACE::is_directory(outFilePath) && !FS_NAMESPACE::exists(outFilePath))
		{
			std::cout << "Error: Invalid output directory \"" << outFilePath.string() << "\"!" << std::endl;
			return -2;
		}
		// check if arguments 1 and 2 are both files or both directories
		std::cout << "Error: Input and output file must be both either a file or a directory!" << std::endl;
		return -2;
	}
	if (appendFile)
	{
		// append file a to b
		if (!appendAtoB(outFilePath, inFilePath))
		{
			std::cout << "Error: Failed to append data to executable!" << std::endl;
			return -3;
		}
	}
	else
	{
		// build list of files to process
		std::vector<FileData> fileList;
		if (FS_NAMESPACE::is_directory(inFilePath) && FS_NAMESPACE::is_directory(inFilePath))
		{
			// both files are directories, build file ist
			fileList = getFileDataFrom(inFilePath, outFilePath, inFilePath, useRecursion);
			if (fileList.empty())
			{
				std::cout << "Error: No files to convert!" << std::endl;
				return -3;
			}
		}
		else
		{
			// just add single input/output file
			FileData temp;
			temp.inPath = inFilePath;
			temp.outPath = outFilePath;
			temp.internalName = inFilePath.filename().string(); // remove all, but the file name and extension
			if (beVerbose)
			{
				std::cout << "Found input file " << inFilePath << std::endl;
				std::cout << "Internal name will be \"" << temp.internalName << "\"" << std::endl;
				std::cout << "Output path is " << temp.outPath << std::endl;
			}
			// get file size
			try
			{
				temp.size = static_cast<uint64_t>(FS_NAMESPACE::file_size(inFilePath));
				if (beVerbose)
				{
					std::cout << "Size is " << temp.size << " bytes." << std::endl;
				}
			}
			catch (...)
			{
				std::cout << "Error: Failed to get size of " << inFilePath << "!" << std::endl;
				temp.size = 0;
			}
			fileList.push_back(temp);
		}

		// does the user want an binary file?
		if (createBinary)
		{
			// yes. build it.
			if (!createBlob(fileList, outFilePath))
			{
				std::cout << "Error: Failed to convert to binary file!" << std::endl;
				return -4;
			}
		}
		else
		{
			// no. convert files to .c/.cpp. loop through list, converting files
			for (auto fdIt = fileList.begin(); fdIt != fileList.cend(); ++fdIt)
			{
				if (!convertFile(*fdIt, commonHeaderFilePath))
				{
					std::cout << "Error: Failed to convert all files. Aborting!" << std::endl;
					return -4;
				}
			}
			// do we need to write a header file?
			if (!commonHeaderFilePath.empty())
			{
				if (!createCommonHeader(fileList, commonHeaderFilePath, !utilitiesFilePath.empty(), useC))
				{
					return -5;
				}
				// do we need to create utilities?
				if (!utilitiesFilePath.empty())
				{
					if (!createUtilities(fileList, utilitiesFilePath, commonHeaderFilePath, useC, combineResults))
					{
						return -6;
					}
				}
			}
		}
	} // if (!appendFile) {
	// profit!!!
	std::cout << "res2h succeeded." << std::endl;
	return 0;
}