mirror of
				https://github.com/davidgiven/fluxengine.git
				synced 2025-10-24 11:11:02 -07:00 
			
		
		
		
	which is now honoured. Fix a bunch of bugs in some of the flux sources and sinks. The converter now actually works, maybe.
		
			
				
	
	
		
			68 lines
		
	
	
		
			1.8 KiB
		
	
	
	
		
			C++
		
	
	
	
	
	
			
		
		
	
	
			68 lines
		
	
	
		
			1.8 KiB
		
	
	
	
		
			C++
		
	
	
	
	
	
| #ifndef FLUXSINK_H
 | |
| #define FLUXSINK_H
 | |
| 
 | |
| #include "lib/config/flags.h"
 | |
| #include "lib/data/locations.h"
 | |
| #include <ostream>
 | |
| 
 | |
| class Fluxmap;
 | |
| class FluxSinkProto;
 | |
| class HardwareFluxSinkProto;
 | |
| class AuFluxSinkProto;
 | |
| class A2RFluxSinkProto;
 | |
| class VcdFluxSinkProto;
 | |
| class ScpFluxSinkProto;
 | |
| class Fl2FluxSinkProto;
 | |
| class Config;
 | |
| 
 | |
| class FluxSink
 | |
| {
 | |
| public:
 | |
|     virtual ~FluxSink() {}
 | |
| 
 | |
|     static std::unique_ptr<FluxSink> createHardwareFluxSink(
 | |
|         const HardwareFluxSinkProto& config);
 | |
|     static std::unique_ptr<FluxSink> createAuFluxSink(
 | |
|         const AuFluxSinkProto& config);
 | |
|     static std::unique_ptr<FluxSink> createA2RFluxSink(
 | |
|         const A2RFluxSinkProto& config);
 | |
|     static std::unique_ptr<FluxSink> createVcdFluxSink(
 | |
|         const VcdFluxSinkProto& config);
 | |
|     static std::unique_ptr<FluxSink> createScpFluxSink(
 | |
|         const ScpFluxSinkProto& config);
 | |
|     static std::unique_ptr<FluxSink> createFl2FluxSink(
 | |
|         const Fl2FluxSinkProto& config);
 | |
| 
 | |
|     static std::unique_ptr<FluxSink> createFl2FluxSink(
 | |
|         const std::string& filename);
 | |
| 
 | |
|     static std::unique_ptr<FluxSink> create(Config& config);
 | |
|     static std::unique_ptr<FluxSink> create(const FluxSinkProto& config);
 | |
| 
 | |
| public:
 | |
|     /* Writes a fluxmap to a track and side. */
 | |
| 
 | |
|     virtual void writeFlux(int track, int side, const Fluxmap& fluxmap) = 0;
 | |
|     void writeFlux(const CylinderHead& location, const Fluxmap& fluxmap)
 | |
|     {
 | |
|         writeFlux(location.cylinder, location.head, fluxmap);
 | |
|     }
 | |
| 
 | |
|     /* Returns whether this is writing to real hardware or not. */
 | |
| 
 | |
|     virtual bool isHardware() const
 | |
|     {
 | |
|         return false;
 | |
|     }
 | |
| 
 | |
|     virtual operator std::string() const = 0;
 | |
| };
 | |
| 
 | |
| inline std::ostream& operator<<(std::ostream& stream, FluxSink& flushSink)
 | |
| {
 | |
|     stream << (std::string)flushSink;
 | |
|     return stream;
 | |
| }
 | |
| 
 | |
| #endif
 |