void LiquidCrystalFast::begin(uint8_t cols, uint8_t lines, uint8_t dotsize)
{
	numcols=_numcols=cols;    //there is an implied lack of trust; the private version can't be munged up by the user.
	numlines=_numlines=lines;
	row_offsets[2] = cols + row_offsets[0];  //should autoadjust for 16/20 or whatever columns now
	row_offsets[3] = cols + row_offsets[1];
	begin2( cols,  lines,  dotsize, _enable_pin);
	
	if (_en2 != 255) {                      //if we were called with a 2nd enable line i.e. 4x40 LCD
		row_offsets[2] = 0;
		row_offsets[3] = 0x40;             //each line gets its own little 40 char section of DDRAM--would be fine if there were a 4x32, I suppose
		_chip = 2;
		begin2( cols,  lines,  dotsize,_en2);//initialize the second HD44780 chip
	}
}
Esempio n. 2
0
  void SlabJob::endHandlerImpl() 
  {
    openstudio::path outpath = outdir();

    openstudio::path epobjects(outpath / openstudio::toPath("SLABSurfaceTemps.TXT"));

    openstudio::path outfile = outpath / openstudio::toPath("slabmerged.idf");

    LOG(Debug, "Copying file: " <<  openstudio::toString(m_expandedidf->fullPath) << " to " << openstudio::toString(outfile));
    boost::filesystem::remove(outfile);
    boost::filesystem::copy_file(m_expandedidf->fullPath, outfile, boost::filesystem::copy_option::overwrite_if_exists);


    std::fstream f(openstudio::toString(epobjects).c_str(), std::fstream::in|std::fstream::binary);
    f << std::noskipws;
    std::istream_iterator<unsigned char> begin(f);
    std::istream_iterator<unsigned char> end;

    std::fstream f2(openstudio::toString(outfile).c_str(),
        std::fstream::out|std::fstream::app|std::fstream::binary);
    std::ostream_iterator<char> begin2(f2);

    LOG(Debug, "Appending file: " <<  openstudio::toString(epobjects) << " to " << openstudio::toString(outfile));
    std::copy(begin, end, begin2);
  }
Esempio n. 3
0
bool CompareFiles(const std::string& filename1, const std::string& filename2)
{
    std::ifstream file1(filename1);
    std::ifstream file2(filename2);
    
    std::istreambuf_iterator<char> begin1(file1);
    std::istreambuf_iterator<char> begin2(file2);
    
    std::istreambuf_iterator<char> end;
    
    return range_equal(begin1, end, begin2, end);
}
Esempio n. 4
0
bool equal_streams(std::istream& s1, std::istream& s2)
{
    typedef std::istreambuf_iterator<char, std::char_traits<char> > iterator;
    iterator begin1(s1.rdbuf());
    iterator begin2(s2.rdbuf());
    iterator end;
    
    for(; begin1 != end && begin2 != end; ++begin1, ++begin2)
        if(*begin1 != *begin2)
            return false;
            
    return begin1 == end && begin2 == end;
}
Esempio n. 5
0
bool endsWith(const string& str1, const string& str2) {
	if (str1.length() < str2.length()) {
		return false;
	}
	string::const_iterator it1(str1.end());
	string::const_iterator begin1(str1.begin());
	string::const_iterator it2(str2.end());
	string::const_iterator begin2(str2.begin());
	while (it1 != begin1 && it2 != begin2) {
		if (*it1 != *it2) {
			return false;
		}
		--it1;
		--it2;
	}
	return true;
}
Esempio n. 6
0
  void BasementJob::endHandlerImpl() 
  {
    openstudio::path epobjects(outdir() / openstudio::toPath("EPObjects.TXT"));

    openstudio::path outfile = outdir() / openstudio::toPath("basementmerged.idf");

    boost::filesystem::remove(outfile);
    boost::filesystem::copy_file(m_expandedidf->fullPath, outfile, boost::filesystem::copy_option::overwrite_if_exists);


    std::fstream f(openstudio::toString(epobjects).c_str(), std::fstream::in|std::fstream::binary);
    f << std::noskipws;
    std::istream_iterator<unsigned char> begin(f);
    std::istream_iterator<unsigned char> end;

    std::fstream f2(openstudio::toString(outfile).c_str(),
        std::fstream::out|std::fstream::app|std::fstream::binary);
    std::ostream_iterator<char> begin2(f2);

    std::copy(begin, end, begin2);
  }