shared (istream &stream_, const std::size_t buff_size_,
     const std::size_t increment_) :
     _ref_count (0),
     _increment (increment_),
     _stream (stream_)
 {
     _buffer.resize (buff_size_);
     _stream.read (&_buffer.front (), _buffer.size ());
     _len = static_cast<std::size_t>(_stream.gcount ());
 }
        bool reload_buffer ()
        {
            const std::size_t lowest_ = lowest ();
            std::size_t read_ = 0;

            if (lowest_ == 0)
            {
                // Resize buffer
                const std::size_t old_size_ = _buffer.size ();
                const std::size_t new_size_ = old_size_ + _increment;

                _buffer.resize (new_size_);
                _stream.read (&_buffer.front () + old_size_, _increment);
                read_ = static_cast<std::size_t>(_stream.gcount ());

                if (read_)
                {
                    read_ += old_size_;
                    _len = read_;
                }
            }
            else
            {
                // Some systems have memcpy in namespace std
                using namespace std;
                const size_t start_ = _buffer.size () - lowest_;
                const size_t len_ = _buffer.size () - start_;

                memcpy (&_buffer.front (), &_buffer[lowest_], start_ *
                    sizeof (char_type));
                _stream.read (&_buffer.front () + start_, len_);
                read_ = static_cast<size_t>(_stream.gcount ());
                subtract (lowest_);

                if (read_)
                {
                    read_ += start_;
                    _len = read_;
                }
                else
                {
                    _len = highest ();
                }
            }

            return read_ != 0;
        }
Exemplo n.º 3
0
void CStackViewBar::SetCallStack(char_vector& vecCallStack)
{
	m_vecCallStack = vecCallStack;

	const char* pCurIn = vecCallStack.empty() ? "" : &vecCallStack[0];
	int CurLen = strlen(pCurIn);
	m_List.ResetContent();

	while (CurLen > 0)
	{
		//pCurIn is in the form "pathfile,line, func(funcp1, funcp2, ..)"
		
		CString CurStr = pCurIn;
		FormatStackEntry(CurStr);
		m_List.AddString(CurStr);
		
		pCurIn += CurLen + 1;
		CurLen = strlen(pCurIn);
	}
}
Exemplo n.º 4
0
 std::size_t memory_requirement(void) const
 {
     return input_specs.size()  * (sizeof(Wire*) + sizeof(float*)) +
            output_specs.size() * (sizeof(Wire*) + sizeof(float*)) +
            output_specs.size() * sizeof(Wire);
 }