Sophie

Sophie

distrib > Mandriva > 2007.0 > i586 > by-pkgid > ad1ba1135a9c9eeffc2e538163e00373 > files > 780

libCommonC++2_1.4-devel-1.4.1-1mdv2007.0.i586.rpm

\section{ost::TTYStream Class Reference}
\label{classost_1_1_t_t_y_stream}\index{ost::TTYStream@{ost::TTYStream}}
TTY streams are used to represent serial connections that are fully \char`\"{}streamable\char`\"{} objects using C++ stream classes and friends.streamable tty serial I/O class.  


{\tt \#include $<$serial.h$>$}

Inheritance diagram for ost::TTYStream::\begin{figure}[H]
\begin{center}
\leavevmode
\includegraphics[height=3cm]{classost_1_1_t_t_y_stream}
\end{center}
\end{figure}
\subsection*{Public Member Functions}
\begin{CompactItemize}
\item 
{\bf TTYStream} (const char $\ast$filename, {\bf timeout\_\-t} to=0)
\begin{CompactList}\small\item\em Create and open a tty serial port. \item\end{CompactList}\item 
virtual {\bf $\sim$TTYStream} ()
\begin{CompactList}\small\item\em End the tty stream and cleanup. \item\end{CompactList}\item 
void {\bf set\-Timeout} ({\bf timeout\_\-t} to)
\begin{CompactList}\small\item\em Set the timeout control. \item\end{CompactList}\item 
void {\bf interactive} (bool flag)
\begin{CompactList}\small\item\em Set tty mode to buffered or \char`\"{}interactive\char`\"{}. \item\end{CompactList}\item 
int {\bf sync} (void)
\begin{CompactList}\small\item\em Flushes the stream input and out buffers, writes pending output. \item\end{CompactList}\item 
bool {\bf is\-Pending} ({\bf Pending} pend, {\bf timeout\_\-t} {\bf timeout}=TIMEOUT\_\-INF)
\begin{CompactList}\small\item\em Get the status of pending operations. \item\end{CompactList}\end{CompactItemize}
\subsection*{Protected Member Functions}
\begin{CompactItemize}
\item 
{\bf TTYStream} ()
\begin{CompactList}\small\item\em This constructor is used to derive \char`\"{}ttystream\char`\"{}, a more C++ style version of the {\bf TTYStream}{\rm (p.\,\pageref{classost_1_1_t_t_y_stream})} class. \item\end{CompactList}\item 
void {\bf allocate} (void)
\begin{CompactList}\small\item\em Used to allocate the buffer space needed for iostream operations. \item\end{CompactList}\item 
void {\bf end\-Stream} (void)
\begin{CompactList}\small\item\em Used to terminate the buffer space and clean up the tty connection. \item\end{CompactList}\item 
int {\bf underflow} (void)
\begin{CompactList}\small\item\em This streambuf method is used to load the input buffer through the established tty serial port. \item\end{CompactList}\item 
int {\bf uflow} (void)
\begin{CompactList}\small\item\em This streambuf method is used for doing unbuffered reads through the establish tty serial port when in interactive mode. \item\end{CompactList}\item 
int {\bf overflow} (int ch)
\begin{CompactList}\small\item\em This streambuf method is used to write the output buffer through the established tty port. \item\end{CompactList}\end{CompactItemize}
\subsection*{Protected Attributes}
\begin{CompactItemize}
\item 
char $\ast$ {\bf gbuf}
\item 
char $\ast$ {\bf pbuf}
\item 
{\bf timeout\_\-t} {\bf timeout}
\end{CompactItemize}
\subsection*{Friends}
\begin{CompactItemize}
\item 
{\bf TTYStream} \& {\bf crlf} ({\bf TTYStream} \&)
\item 
{\bf TTYStream} \& {\bf lfcr} ({\bf TTYStream} \&)
\end{CompactItemize}


\subsection{Detailed Description}
TTY streams are used to represent serial connections that are fully \char`\"{}streamable\char`\"{} objects using C++ stream classes and friends.streamable tty serial I/O class. 

The first application relevant serial I/O class is the {\bf TTYStream}{\rm (p.\,\pageref{classost_1_1_t_t_y_stream})} class. {\bf TTYStream}{\rm (p.\,\pageref{classost_1_1_t_t_y_stream})} offers a linearly buffered \char`\"{}streaming\char`\"{} I/O session with the serial device. Furthermore, traditional C++ \char`\"{}stream\char`\"{} operators ($<$$<$ and $>$$>$) may be used with the serial device. A more \char`\"{}true\char`\"{} to ANSI C++ library format \char`\"{}ttystream\char`\"{} is also available, and this supports an \char`\"{}open\char`\"{} method in which one can pass initial serial device parameters immediately following the device name in a single string, as in \char`\"{}/dev/tty3a:9600,7,e,1\char`\"{}, as an example.

The {\bf TTYSession}{\rm (p.\,\pageref{classost_1_1_t_t_y_session})} aggragates a {\bf TTYStream}{\rm (p.\,\pageref{classost_1_1_t_t_y_stream})} and a Common C++ {\bf Thread}{\rm (p.\,\pageref{classost_1_1_thread})} which is assumed to be the execution context that will be used to perform actual I/O operations. This class is very anagolous to {\bf TCPSession}{\rm (p.\,\pageref{classost_1_1_t_c_p_session})}.

\begin{Desc}
\item[Author:]David Sugar $<${\tt dyfet@ostel.com}$>$ \end{Desc}




\subsection{Constructor \& Destructor Documentation}
\index{ost::TTYStream@{ost::TTYStream}!TTYStream@{TTYStream}}
\index{TTYStream@{TTYStream}!ost::TTYStream@{ost::TTYStream}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}ost::TTYStream::TTYStream ()\hspace{0.3cm}{\tt  [protected]}}\label{classost_1_1_t_t_y_stream_a2709f21498713e4091ba1cc6471bf35}


This constructor is used to derive \char`\"{}ttystream\char`\"{}, a more C++ style version of the {\bf TTYStream}{\rm (p.\,\pageref{classost_1_1_t_t_y_stream})} class. 

\index{ost::TTYStream@{ost::TTYStream}!TTYStream@{TTYStream}}
\index{TTYStream@{TTYStream}!ost::TTYStream@{ost::TTYStream}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}ost::TTYStream::TTYStream (const char $\ast$ {\em filename}, {\bf timeout\_\-t} {\em to} = {\tt 0})}\label{classost_1_1_t_t_y_stream_8c9d3397e3250ede75a659103594befb}


Create and open a tty serial port. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em filename}]char name of device to open. \item[{\em to}]default timeout. \end{description}
\end{Desc}
\index{ost::TTYStream@{ost::TTYStream}!~TTYStream@{$\sim$TTYStream}}
\index{~TTYStream@{$\sim$TTYStream}!ost::TTYStream@{ost::TTYStream}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}virtual ost::TTYStream::$\sim$TTYStream ()\hspace{0.3cm}{\tt  [virtual]}}\label{classost_1_1_t_t_y_stream_f7367a91c7adc42f3d6d16f524e71aff}


End the tty stream and cleanup. 



\subsection{Member Function Documentation}
\index{ost::TTYStream@{ost::TTYStream}!allocate@{allocate}}
\index{allocate@{allocate}!ost::TTYStream@{ost::TTYStream}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void ost::TTYStream::allocate (void)\hspace{0.3cm}{\tt  [protected]}}\label{classost_1_1_t_t_y_stream_83d30e56a2c603427ecf72cc113310ab}


Used to allocate the buffer space needed for iostream operations. 

This is based on MAX\_\-INPUT. \index{ost::TTYStream@{ost::TTYStream}!endStream@{endStream}}
\index{endStream@{endStream}!ost::TTYStream@{ost::TTYStream}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void ost::TTYStream::end\-Stream (void)\hspace{0.3cm}{\tt  [protected]}}\label{classost_1_1_t_t_y_stream_e8071fe31f6009c8c5f5018d8a285fda}


Used to terminate the buffer space and clean up the tty connection. 

This function is called by the destructor. \index{ost::TTYStream@{ost::TTYStream}!interactive@{interactive}}
\index{interactive@{interactive}!ost::TTYStream@{ost::TTYStream}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void ost::TTYStream::interactive (bool {\em flag})}\label{classost_1_1_t_t_y_stream_056469a50ef74e0885998f6254eef8e7}


Set tty mode to buffered or \char`\"{}interactive\char`\"{}. 

When interactive, all streamed I/O is directly sent to the serial port immediately.

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em flag}]bool set to true to make interactive. \end{description}
\end{Desc}
\index{ost::TTYStream@{ost::TTYStream}!isPending@{isPending}}
\index{isPending@{isPending}!ost::TTYStream@{ost::TTYStream}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}bool ost::TTYStream::is\-Pending ({\bf Pending} {\em pend}, {\bf timeout\_\-t} {\em timeout} = {\tt TIMEOUT\_\-INF})}\label{classost_1_1_t_t_y_stream_59694c06c96e9febb3b88cbd4984f4bf}


Get the status of pending operations. 

This can be used to examine if input or output is waiting, or if an error has occured on the serial device. If read buffer contains data then input is ready and if write buffer contains data it is first flushed then checked.

\begin{Desc}
\item[Returns:]true if ready, false if timeout. \end{Desc}
\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em pend}]ready check to perform. \item[{\em timeout}]in milliseconds. \end{description}
\end{Desc}
\index{ost::TTYStream@{ost::TTYStream}!overflow@{overflow}}
\index{overflow@{overflow}!ost::TTYStream@{ost::TTYStream}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}int ost::TTYStream::overflow (int {\em ch})\hspace{0.3cm}{\tt  [protected]}}\label{classost_1_1_t_t_y_stream_c2534503380bf14d8fcee942461b396b}


This streambuf method is used to write the output buffer through the established tty port. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em ch}]char to push through. \end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]char pushed through. \end{Desc}
\index{ost::TTYStream@{ost::TTYStream}!setTimeout@{setTimeout}}
\index{setTimeout@{setTimeout}!ost::TTYStream@{ost::TTYStream}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void ost::TTYStream::set\-Timeout ({\bf timeout\_\-t} {\em to})\hspace{0.3cm}{\tt  [inline]}}\label{classost_1_1_t_t_y_stream_10ec50ecf62fb6c5cda903389d96d127}


Set the timeout control. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em to}]timeout to use. \end{description}
\end{Desc}
\index{ost::TTYStream@{ost::TTYStream}!sync@{sync}}
\index{sync@{sync}!ost::TTYStream@{ost::TTYStream}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}int ost::TTYStream::sync (void)}\label{classost_1_1_t_t_y_stream_fd30bd70e73b573c1fd83a90bec64e27}


Flushes the stream input and out buffers, writes pending output. 

\begin{Desc}
\item[Returns:]0 on success. \end{Desc}
\index{ost::TTYStream@{ost::TTYStream}!uflow@{uflow}}
\index{uflow@{uflow}!ost::TTYStream@{ost::TTYStream}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}int ost::TTYStream::uflow (void)\hspace{0.3cm}{\tt  [protected]}}\label{classost_1_1_t_t_y_stream_5bb4dfdd526e44bf5873113191f6c198}


This streambuf method is used for doing unbuffered reads through the establish tty serial port when in interactive mode. 

Also this method will handle proper use of buffers if not in interative mode.

\begin{Desc}
\item[Returns:]char from tty serial port, EOF also possible. \end{Desc}
\index{ost::TTYStream@{ost::TTYStream}!underflow@{underflow}}
\index{underflow@{underflow}!ost::TTYStream@{ost::TTYStream}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}int ost::TTYStream::underflow (void)\hspace{0.3cm}{\tt  [protected]}}\label{classost_1_1_t_t_y_stream_bb3276c12566b4dc4776efd3e1bee296}


This streambuf method is used to load the input buffer through the established tty serial port. 

\begin{Desc}
\item[Returns:]char from get buffer, EOF also possible. \end{Desc}


\subsection{Friends And Related Function Documentation}
\index{ost::TTYStream@{ost::TTYStream}!crlf@{crlf}}
\index{crlf@{crlf}!ost::TTYStream@{ost::TTYStream}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf TTYStream}\& crlf ({\bf TTYStream} \&)\hspace{0.3cm}{\tt  [friend]}}\label{classost_1_1_t_t_y_stream_b6365240297776a647b61ce829e3f0b7}


\index{ost::TTYStream@{ost::TTYStream}!lfcr@{lfcr}}
\index{lfcr@{lfcr}!ost::TTYStream@{ost::TTYStream}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf TTYStream}\& lfcr ({\bf TTYStream} \&)\hspace{0.3cm}{\tt  [friend]}}\label{classost_1_1_t_t_y_stream_975a537898714a55453793eaa2237c0d}




\subsection{Member Data Documentation}
\index{ost::TTYStream@{ost::TTYStream}!gbuf@{gbuf}}
\index{gbuf@{gbuf}!ost::TTYStream@{ost::TTYStream}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}char$\ast$ {\bf ost::TTYStream::gbuf}\hspace{0.3cm}{\tt  [protected]}}\label{classost_1_1_t_t_y_stream_092b288b0699829784c318bceeb66b46}


\index{ost::TTYStream@{ost::TTYStream}!pbuf@{pbuf}}
\index{pbuf@{pbuf}!ost::TTYStream@{ost::TTYStream}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}char $\ast$ {\bf ost::TTYStream::pbuf}\hspace{0.3cm}{\tt  [protected]}}\label{classost_1_1_t_t_y_stream_05574ac3124042f6fd7d7126b7d2dbde}


\index{ost::TTYStream@{ost::TTYStream}!timeout@{timeout}}
\index{timeout@{timeout}!ost::TTYStream@{ost::TTYStream}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf timeout\_\-t} {\bf ost::TTYStream::timeout}\hspace{0.3cm}{\tt  [protected]}}\label{classost_1_1_t_t_y_stream_da518ac8768e0e9336267f6f91846eb2}




The documentation for this class was generated from the following file:\begin{CompactItemize}
\item 
{\bf serial.h}\end{CompactItemize}