\hypertarget{pnmCodec_8hpp}{}\section{pnm\+Codec.\+hpp File Reference}
\label{pnmCodec_8hpp}\index{pnm\+Codec.\+hpp@{pnm\+Codec.\+hpp}}


This file contains a P\+N\+M codec.  


{\ttfamily \#include $<$S\+P\+L/config.\+hpp$>$}\\*
{\ttfamily \#include $<$iostream$>$}\\*
{\ttfamily \#include $<$sstream$>$}\\*
{\ttfamily \#include $<$cassert$>$}\\*
{\ttfamily \#include $<$cstdlib$>$}\\*
\subsection*{Classes}
\begin{DoxyCompactItemize}
\item 
struct \hyperlink{structSPL_1_1PnmHeader}{S\+P\+L\+::\+Pnm\+Header}
\begin{DoxyCompactList}\small\item\em The header information for P\+N\+M data. \end{DoxyCompactList}\end{DoxyCompactItemize}
\subsection*{Enumerations}
\begin{DoxyCompactItemize}
\item 
enum {\bfseries Pnm\+Magic} 
\begin{DoxyCompactList}\small\item\em The signature values that can appear at the start of the header. \end{DoxyCompactList}\item 
enum {\bfseries Pnm\+Type} 
\begin{DoxyCompactList}\small\item\em The type of the P\+N\+M data. \end{DoxyCompactList}\item 
enum {\bfseries Pnm\+Fmt} 
\begin{DoxyCompactList}\small\item\em The format of the P\+N\+M data (i.\+e., binary or text). \end{DoxyCompactList}\end{DoxyCompactItemize}
\subsection*{Functions}
\begin{DoxyCompactItemize}
\item 
Pnm\+Type {\bfseries S\+P\+L\+::pnm\+Get\+Type} (Pnm\+Magic magic)
\begin{DoxyCompactList}\small\item\em Determine the type (i.\+e., P\+G\+M or P\+P\+M) from the magic number. \end{DoxyCompactList}\item 
Pnm\+Fmt {\bfseries S\+P\+L\+::pnm\+Get\+Fmt} (Pnm\+Magic magic)
\begin{DoxyCompactList}\small\item\em Determine the format (i.\+e., text or binary) from magic number. \end{DoxyCompactList}\item 
int {\bfseries S\+P\+L\+::pnm\+Max\+Val\+To\+Prec} (int max\+Val)
\begin{DoxyCompactList}\small\item\em Determine the precision from the maximum value. \end{DoxyCompactList}\item 
int {\bfseries S\+P\+L\+::pnm\+Get\+Num\+Comps} (Pnm\+Type type)
\begin{DoxyCompactList}\small\item\em Get the number of components from the P\+N\+M type. \end{DoxyCompactList}\item 
long {\bfseries S\+P\+L\+::pnm\+Ones} (int n)
\begin{DoxyCompactList}\small\item\em Get an integer whose representation in binary consists of the specified number of ones. \end{DoxyCompactList}\item 
int {\bfseries S\+P\+L\+::pnm\+Get\+Header} (std\+::istream \&in, Pnm\+Header \&header)
\begin{DoxyCompactList}\small\item\em Read a P\+N\+M header from the specified stream. \end{DoxyCompactList}\item 
int {\bfseries S\+P\+L\+::pnm\+Put\+Header} (std\+::ostream \&out, Pnm\+Header \&header)
\begin{DoxyCompactList}\small\item\em Write a P\+N\+M header to the specified stream. \end{DoxyCompactList}\item 
int {\bfseries S\+P\+L\+::pnm\+Get\+Char} (std\+::istream \&in)
\begin{DoxyCompactList}\small\item\em Read a character from the specified stream. \end{DoxyCompactList}\item 
int {\bfseries S\+P\+L\+::pnm\+Get\+Txt\+Bit} (std\+::istream \&in)
\begin{DoxyCompactList}\small\item\em Read a bit from the specified stream. \end{DoxyCompactList}\item 
long {\bfseries S\+P\+L\+::pnm\+Get\+Txt\+Int} (std\+::istream \&in, bool sgnd, int \&status)
\begin{DoxyCompactList}\small\item\em Read an integer from the specified stream. \end{DoxyCompactList}\item 
long {\bfseries S\+P\+L\+::pnm\+Get\+Bin\+Int} (std\+::istream \&in, int word\+Size, bool sgnd, int \&status)
\begin{DoxyCompactList}\small\item\em Read an integer from the specified stream. \end{DoxyCompactList}\item 
int {\bfseries S\+P\+L\+::pnm\+Put\+Bin\+Int} (std\+::ostream \&out, int word\+Size, bool sgnd, long val)
\begin{DoxyCompactList}\small\item\em Write an integer from the specified stream. \end{DoxyCompactList}\item 
{\footnotesize template$<$class Get\+Data $>$ }\\int {\bfseries S\+P\+L\+::pnm\+Encode} (std\+::ostream \&out\+Stream, int width, int height, int num\+Comps, int max\+Val, bool sgnd, Get\+Data \&get\+Data, bool binary\+Format)
\begin{DoxyCompactList}\small\item\em Write data encoded in the P\+N\+M format to the specified stream. \end{DoxyCompactList}\item 
{\footnotesize template$<$class Get\+Data $>$ }\\int {\bfseries S\+P\+L\+::put\+Data} (std\+::ostream \&out, Pnm\+Header \&header, Get\+Data \&get\+Data)
\begin{DoxyCompactList}\small\item\em Write the actual image data to a stream. \end{DoxyCompactList}\item 
{\footnotesize template$<$class Initialize $>$ }\\int {\bfseries S\+P\+L\+::pnm\+Decode} (std\+::istream \&in\+Stream, Initialize \&initialize)
\begin{DoxyCompactList}\small\item\em Read data encoded in the P\+N\+M format from the specified stream. \end{DoxyCompactList}\item 
{\footnotesize template$<$class Put\+Data $>$ }\\int {\bfseries S\+P\+L\+::get\+Data} (std\+::istream \&in, Pnm\+Header \&header, Put\+Data \&put\+Data)
\begin{DoxyCompactList}\small\item\em Read the actual image data from the specified stream. \end{DoxyCompactList}\end{DoxyCompactItemize}
\subsection*{Variables}
\begin{DoxyCompactItemize}
\item 
const int {\bfseries S\+P\+L\+::pnm\+Max\+Line\+Len} = 80
\begin{DoxyCompactList}\small\item\em The maximum line length to be produced when encoding in text format. \end{DoxyCompactList}\end{DoxyCompactItemize}


\subsection{Detailed Description}
This file contains a P\+N\+M codec. 

