Logo Search packages:      
Sourcecode: libserial version File versions  Download package

LibSerial::SerialStream::SerialStream ( const std::string  filename,
std::ios_base::openmode  mode = std::ios::in|std::ios::out 
) [explicit]

This constructor takes a filename and an openmode to construct a SerialStream object. This results in a call to basic_fstream::open(s,mode). This is the only way to contruct an object of this class. We have to enforce this instead of providing a default constructor because we want to get a file descriptor whenever the basic_fstream::open() function is called. However, this function is not made virtual in the STL hence it is probably not very safe to overload it. We may decide to overload it later but the users of this class will have to make sure that this class is not used as an fstream class. The SerialStream will be in the "open" state (same state as after calling the Open() method) after calling this constructor.

If the constructor has problems opening the serial port or getting the file-descriptor for the port, it will set the failbit for the stream. So, one must make sure that the stream is in a good state before using it for any further I/O operations.

filename The filename of the serial port.
mode The openmode for the serial port file.

Generated by  Doxygen 1.6.0   Back to index