torc-master
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
torc::bitstream::Factory Class Reference

Helper class for bitstreams. More...

#include <Factory.hpp>

Static Public Member Functions

static BitstreamSharedPtr newBitstreamPtr (const boost::filesystem::path &inPath)
 
static BitstreamSharedPtr newBitstreamPtr (const char *inFileName)
 

Friends

class torc::bitstream::bitstream::FactoryUnitTest
 

Detailed Description

Helper class for bitstreams.

Definition at line 34 of file bitstream/Factory.hpp.

Member Function Documentation

static BitstreamSharedPtr torc::bitstream::Factory::newBitstreamPtr ( const boost::filesystem::path &  inPath)
inlinestatic

Definition at line 37 of file bitstream/Factory.hpp.

37  {
38  return newBitstreamPtr(inPath.string().c_str());
39  }
static BitstreamSharedPtr newBitstreamPtr(const boost::filesystem::path &inPath)

+ Here is the caller graph for this function:

BitstreamSharedPtr torc::bitstream::Factory::newBitstreamPtr ( const char *  inFileName)
static

Definition at line 37 of file bitstream/Factory.cpp.

37  {
38  // open the file as a stream
39  BitstreamSharedPtr bitstreamPtr;
40  std::fstream fileStream(inFileName, std::ios::binary | std::ios::in);
41  if(!fileStream.good()) return bitstreamPtr;
42 
43  // read the header and determine the device family
44  Bitstream bitstream;
45  bitstream.readHeader(fileStream);
46  DeviceDesignator designator(bitstream.getDeviceName());
47 
48  // instantiate the appropriate bitstream
49  switch(designator.getFamily()) {
51  bitstreamPtr = BitstreamSharedPtr(new Virtex()); break;
53  bitstreamPtr = BitstreamSharedPtr(new VirtexE()); break;
55  bitstreamPtr = BitstreamSharedPtr(new Virtex2()); break;
57  bitstreamPtr = BitstreamSharedPtr(new Virtex2P()); break;
59  bitstreamPtr = BitstreamSharedPtr(new Virtex4()); break;
61  bitstreamPtr = BitstreamSharedPtr(new Virtex5()); break;
63  bitstreamPtr = BitstreamSharedPtr(new Virtex6()); break;
68  bitstreamPtr = BitstreamSharedPtr(new Virtex7()); break;
70  bitstreamPtr = BitstreamSharedPtr(new Spartan3E()); break;
72  bitstreamPtr = BitstreamSharedPtr(new Spartan6()); break;
73  default:
74  return bitstreamPtr;
75  }
76 
77  // rewind the stream
78  fileStream.seekg(0, std::ios::beg);
79  bitstreamPtr->read(fileStream);
80 
81  // return the newly created bitstream
82  return bitstreamPtr;
83  }
torc::common::DeviceDesignator DeviceDesignator
boost::shared_ptr< Bitstream > BitstreamSharedPtr

+ Here is the call graph for this function:

Friends And Related Function Documentation

friend class torc::bitstream::bitstream::FactoryUnitTest
friend

Definition at line 35 of file bitstream/Factory.hpp.


The documentation for this class was generated from the following files: