Build the static device information for the specified family.
44 std::ofstream outputStream(outputPath.string().c_str(), std::ios::out | std::ios::binary);
45 if(!outputStream.is_open()) {
46 std::cerr <<
"Output static device information file could not be opened: "
47 << outputPath.string() << std::endl;
53 /
"torc" /
"bitstream" /
"build" / inTemplateName;
54 std::ifstream templateStream(templatePath.string().c_str(),
55 std::ios::in | std::ios::binary | std::ios::ate);
56 if(!templateStream.is_open()) {
57 std::cerr <<
"Input static device information template could not be opened: "
58 << outputPath.string() << std::endl;
63 std::ifstream::pos_type size = templateStream.tellg();
64 templateString.resize(size);
66 templateStream.seekg(0, std::ios::beg);
67 templateStream.read(const_cast<char*>(templateString.data()), size);
69 templateStream.close();
72 std::stringstream allDeviceInfo;
73 torc::common::DeviceVector::const_iterator dp = inDeviceNames.begin();
74 torc::common::DeviceVector::const_iterator de = inDeviceNames.end();
77 if(device.empty())
break;
78 inBitstream.setDevice(device);
79 inBitstream.initializeDeviceInfo(device);
80 inBitstream.writeDeviceInfo(allDeviceInfo, device);
81 if(dp < de) allDeviceInfo << std::endl;
85 typedef std::map<std::string, std::string> SubstitutionMap;
86 SubstitutionMap substitutions;
87 substitutions[
"%%ARCHITECTURE%%"] = inFamilyName;
88 substitutions[
"%%DEVICES%%"] = allDeviceInfo.str();
89 substitutions[
"%%GENERATED%%"] = __FILE__;
92 SubstitutionMap::iterator p = substitutions.begin();
93 SubstitutionMap::iterator e = substitutions.end();
96 boost::regex re(p->first);
97 std::stringstream stringStream;
98 std::ostream_iterator<char, char> stringIterator(stringStream);
100 boost::regex_replace(stringIterator, templateString.begin(), templateString.end(), re,
101 p->second, boost::match_default);
103 templateString = stringStream.str();
108 outputStream << templateString;
109 outputStream.close();
boost::filesystem::path path
static const boost::filesystem::path & getWorkingPath(void)
Returns the absolute path to the working directory.