/* * * This file and its contents are the property of The MathWorks, Inc. * * This file contains confidential proprietary information. * The reproduction, distribution, utilization or the communication * of this file or any part thereof is strictly prohibited. * Offenders will be held liable for the payment of damages. * * Copyright 1999-2012 The MathWorks, Inc. * */ #ifndef PST_STL_ISTREAM #define PST_STL_ISTREAM #include #include #include namespace std { #ifdef PST_VISUAL #pragma pack(push, 8) /* push default value */ #endif template class basic_istream : virtual public basic_ios { public: // typedef __ps_typename traits::off_type streamsize; // Not Defined in this class in Norm // typedef charT char_type; typedef __ps_typename traits::int_type int_type; typedef __ps_typename traits::pos_type pos_type; typedef __ps_typename traits::off_type off_type; typedef traits traits_type; typedef basic_istream& (*__imanip)(basic_istream &); typedef basic_ios& (*__manip)(basic_ios &); typedef ios_base& (*__iosmanip)(ios_base &); /// Constructor/destructor //// __ps_explicit basic_istream (basic_streambuf *); #ifdef PST_VISUAL basic_istream(basic_streambuf *, __ps_bool) {} /* _Uninitialized is declared in xstddef which is always included by polyspace_std_decl.h */ basic_istream(_Uninitialized) {} #endif basic_istream() {} ~basic_istream(); #ifdef PST_VISUAL __ps_bool ipfx(__ps_bool noskip = __ps_false) { volatile __ps_bool random = false; return random; } void isfx() { } #endif /// Formatted input /// basic_istream& operator >> (__imanip); basic_istream& operator >> (__manip); basic_istream& operator >> (__iosmanip); #ifdef _BOOL basic_istream& operator >> (__ps_bool&); #endif /* _BOOL */ basic_istream& operator >> (short&); basic_istream& operator >> (unsigned short&); basic_istream& operator >> (int &); basic_istream& operator >> (unsigned int&); basic_istream& operator >> (long &); basic_istream& operator >> (unsigned long&); basic_istream& operator >> (long long&); basic_istream& operator >> (unsigned long long&); basic_istream& operator >> (float&); basic_istream& operator >> (double&); basic_istream& operator >> (long double&); basic_istream& operator >> (void *&); basic_istream& operator >> (basic_streambuf *); // PST specific : requirements on basic_istream& operator >> (__pst_smanip_typ) { return *this ; } ; /// Unformatted input /// streamsize gcount() const; int_type get(); basic_istream &get(char_type &); basic_istream &get(char_type *, streamsize); basic_istream &get(char_type *, streamsize, char_type); basic_istream &get(basic_streambuf &); basic_istream &get(basic_streambuf &, char_type); basic_istream &getline(char_type *, streamsize); basic_istream &getline(char_type *, streamsize, char_type); #ifdef PST_STL_PERMISSIVE_STUB basic_istream &getline(unsigned char * s, streamsize n) { volatile streamsize rand_size = 0; streamsize size = rand_size; assert((size >= 0) && (size < n)); volatile unsigned char value = 0; for (streamsize i = 0; i < size; i++) s[i] = value; s[size] = charT() ; return (*this); } basic_istream &getline(signed char * s, streamsize n) { volatile streamsize rand_size = 0; streamsize size = rand_size; assert((size >= 0) && (size < n)); volatile signed char value = 0; for (streamsize i = 0; i < size; i++) s[i] = value; s[size] = charT() ; return (*this); } #endif /* PST_STL_PERMISSIVE_STUB */ basic_istream &ignore(streamsize = 1, int_type = traits::eof()); int_type peek(); basic_istream &read (char_type *, streamsize); streamsize readsome(char_type *, streamsize); basic_istream &putback(char_type c); basic_istream &unget(); int sync(); pos_type tellg(); basic_istream &seekg(pos_type); basic_istream &seekg(off_type, ios_base::seekdir); }; /// Constructor/destructor //// /* __ps_explicit basic_istream (basic_streambuf *) This constructor create the in stream. */ template < class charT, class traits > basic_istream::basic_istream(basic_streambuf *) {} /* ~basic_istream () This destructor destroy the in stream. */ template < class charT, class traits > basic_istream::~basic_istream() {} /// Formatted input /// /* basic_istream& operator >> (__imanip); Comment : Call the function of __imanip type and returns the in stream. */ template < class charT, class traits > basic_istream& basic_istream::operator >> (__imanip func) { return ((*func)(*this)); } /* basic_istream& operator >> (__manip); Comment : Call the function of __manip type and returns the in stream. */ template < class charT, class traits > basic_istream& basic_istream::operator >> (__manip func) { return (*this); } /* basic_istream& operator >> (__iosmanip); Comment : Call the function of __iosmanip type and returns the in stream. */ template < class charT, class traits > basic_istream& basic_istream::operator >> (__iosmanip func) { return (*this); } #ifdef _BOOL /* basic_istream& operator >> (__ps_bool&); Comment : Get a __ps_bool from the in stream. */ template < class charT, class traits > basic_istream& basic_istream::operator >> (__ps_bool &b) { volatile __ps_bool Number = false; b = Number; return (*this); } #endif /* _BOOL */ /* basic_istream& operator >> (short&); Comment : Get an integer(short) from the in stream. */ template < class charT, class traits > basic_istream& basic_istream::operator >> (short &n) { volatile short Number = 0; n = Number; return (*this); } /* basic_istream& operator >> (short&); Comment : Get an integer(unsigned and short) from the in stream. */ template < class charT, class traits > basic_istream& basic_istream::operator >> (unsigned short &n) { volatile unsigned short Number = 0U; n = Number; return (*this); } /* basic_istream& operator >> (int&); Comment : Get an integer from the in stream. */ template < class charT, class traits > basic_istream& basic_istream::operator >> (int &n) { volatile int Number = 0; n = Number; return (*this); } /* basic_istream& operator >> (unsigned int&); Comment : Get an integer(unsigned) from the in stream. */ template < class charT, class traits > basic_istream& basic_istream::operator >> (unsigned int &n) { volatile unsigned int Number = 0U; n = Number; return (*this); } /* basic_istream& operator >> (long&); Comment : Get an integer(long) from the in stream. */ template < class charT, class traits > basic_istream& basic_istream::operator >> (long &n) { volatile unsigned int Number = 0U; n = Number; return (*this); } /* basic_istream& operator >> (unsigned long&); Comment : Get an integer(unsigned long) from the in stream. */ template < class charT, class traits > basic_istream& basic_istream::operator >> (unsigned long &n) { volatile unsigned long Number = 0UL ; n = Number; return (*this); } template < class charT, class traits > basic_istream& basic_istream::operator >> (long long &n) { volatile long long Number = 0LL; n = Number; return (*this); } template < class charT, class traits > basic_istream& basic_istream::operator >> (unsigned long long &n) { volatile unsigned long long Number = 0ULL; n = Number; return (*this); } /* basic_istream& operator >> (float&); Comment : Get an real(simple precision) from the in stream. */ template < class charT, class traits > basic_istream& basic_istream::operator >> (float &n) { volatile float Number = 0.0F; n = Number; return (*this); } /* basic_istream& operator >> (double&); Comment : Get an real(double precision) from the in stream. */ template < class charT, class traits > basic_istream& basic_istream::operator >> (double &n) { volatile double Number = 0.0; n = Number; return (*this); } /* basic_istream& operator >> (long double&); Comment : Get an real(double precision and long) from the in stream. */ template < class charT, class traits > basic_istream& basic_istream::operator >> (long double &n) { volatile long double Number = 0.0; n = Number; return (*this); } /* basic_istream& operator >> (void *&); Comment : Get an address from the in stream. */ template < class charT, class traits > basic_istream& basic_istream::operator >> (void *&p) { char *str; volatile unsigned int size = 0U; str = new char[size]; p = (void *)str; return (*this); } /* basic_istream& operator >> (basic_streambuf *); Comment : Get an streambuf from the in stream. */ template < class charT, class traits > basic_istream& basic_istream::operator >> (basic_streambuf *sb) { return (*this); } /* streamsize gcount() const; Comment : return the number of character extracted by the last unformatted input member function called for the object. */ template < class charT, class traits > streamsize basic_istream::gcount () const { volatile streamsize n = 0; return (n); } /* int_type get(); Comment : return size of the stream. */ template basic_istream::int_type basic_istream::get() { volatile int Random = 0; volatile char c = 0; return (((Random) ? c : traits::eof())); } /* basic_istream &get(char_type &c); Comment : Get a character in the stream and return the stream. */ template basic_istream &basic_istream::get(char_type &c) { volatile char_type cret = (char_type)0; c = cret; return (*this); } /* basic_istream &get(char_type *s, streamsize n); Comment : Get characters in the stream and return the stream. */ template basic_istream &basic_istream::get(char_type *s, streamsize n) { streamsize i; volatile streamsize rand_size = 0; streamsize size = rand_size; assert((size >= 0) && (size < n)); // max = n-1 char stored volatile char_type value = (char_type)0; for (i = 0; i < size; i++) s[i] = value; s[size] = charT() ; return (*this); } /* basic_istream &get(char_type *s, streamsize n, char_type delim); Comment : Get characters in the stream and return the stream. */ template basic_istream &basic_istream::get(char_type *s, streamsize n, char_type delim) { streamsize i; volatile streamsize rand_size = 0; streamsize size = rand_size; assert((size >= 0) && (size < n)); // max = n-1 char stored volatile char_type value = (char_type)0; for (i = 0; i < size; i++) s[i] = value; s[size] = charT() ; return (*this); } /* basic_istream &get(basic_streambuf &); Comment : Get characters in the stream and return the stream. */ template basic_istream &basic_istream::get(basic_streambuf &sb) { return (*this); } /* basic_istream &get(basic_streambuf &, char_type); Comment : Get characters in the stream and return the stream. */ template basic_istream &basic_istream::get(basic_streambuf &sb, char_type delim) { return (*this); } /* basic_istream &getline(char_type *, streamsize); Comment : Get characters in the stream and return the stream. */ template basic_istream &basic_istream::getline(char_type *s, streamsize n) { streamsize i; volatile streamsize size = 0; volatile char_type value = (char_type)0; assert((size >= 0) && (size < n)); // max = n-1 char stored for (i = 0; i < size; i++) s[i] = value; s[size] = charT() ; return (*this); } /* basic_istream &getline(char_type *, streamsize, char_type); Comment : Get characters in the stream and return the stream. */ template basic_istream &basic_istream::getline(char_type *s, streamsize n, char_type delim) { streamsize i; volatile streamsize size = 0; volatile char_type value = (char_type)0; assert((size >= 0) && (size < n)); // max = n-1 char stored for (i = 0; i < size; i++) s[i] = value; s[size] = charT() ; return (*this); } /* basic_istream &ignore(streamsize = 1, int_type = traits::eof()); Comment : ignore n (first arg) characters in the stream and return the stream. */ template basic_istream &basic_istream::ignore(streamsize str, int_type it) { return (*this); } /* int_type peek() Comment : traits::eof() is good() is __ps_false. Otherwise, returns a character from the buffer. */ template basic_istream::int_type basic_istream::peek() { volatile int Random = 0; volatile char c = 0; if (Random) return (traits::eof()); else return c; } /* basic_istream &read(char_type *, streamsize) Comment : */ template basic_istream &basic_istream::read(char_type *s, streamsize n) { int i; volatile char_type value = (char_type)0; for (i = 0; i < n; i++) s[i] = value; return (*this); } /* streamsize readsome(char_type *, streamsize) Comment : In certain conditions, extracts characters and stores them into successive locations of an array whose first element is designated by s. */ template streamsize basic_istream::readsome(char_type *s, streamsize n) { int i; volatile int Random = 0; volatile int size = 0; volatile char_type value = (char_type)0; assert(size < n); if (Random) { for (i = 0; i < n; i++) s[i] = value; return (size); } return (0); } /* basic_istream &putback(char_type) Comment : return the stream. */ template basic_istream &basic_istream::putback(char_type c) { return (*this); } /* basic_istream &unget() Comment : return the stream. */ template basic_istream &basic_istream::unget() { return (*this); } /* int sync() Comment : return the -1 if the buffer is a null pointer 0 otherwise. */ template int basic_istream::sync() { volatile int Random = 0; if (Random) return -1; else return 0; } /* pos_type tellg() Comment : return the pos_type of the pointer in the buffer. */ template basic_istream::pos_type basic_istream::tellg() { pos_type ret=pos_type(); return (ret); } /* basic_istream &seekg(pos_type) Comment : return the stream. */ template basic_istream &basic_istream::seekg(pos_type pos) { return (*this); } /* basic_istream &seekg(off_type, ios_base::seekdir) Comment : return the stream. */ template basic_istream &basic_istream::seekg(off_type of, ios_base::seekdir dir) { return (*this); } /* template basic_istream& operator >> (basic_istream &, charT &); Comment : get a charT in the stream(first arg) and stock it in the second args. */ template basic_istream & operator >> (basic_istream &is, charT &c) { volatile charT ret = '\0'; c = ret; return (is); } /* template basic_istream& operator >> (basic_istream &, unsigned char &); Comment : get a char (unsigned ) in the stream(first arg) and stock it in the second args. */ template basic_istream & operator >> (basic_istream &is, unsigned char &c) { volatile unsigned char ret = 0; c = ret; return (is); } /* template basic_istream& operator >> (basic_istream &, signed char &); Comment : get a char (signed) in the stream(first arg) and stock it in the second args. */ template basic_istream & operator >> (basic_istream &is, signed char &c) { volatile signed char ret = 0; c = ret; return (is); } /* template basic_istream& operator >> (basic_istream &, charT *); Comment : get a string of charT in the stream(first arg) and stock it in the second args. */ template basic_istream & operator >> (basic_istream &is, charT *str) { volatile charT ret = '\0'; volatile int size = 0; int i; for (i = 0; i < size; i++) str[i] = ret; return (is); } /* template basic_istream& operator >> (basic_istream &, unsigned char *); Comment : get a string of char (unsigned) in the stream(first arg) and stock it in the second args. */ template basic_istream & operator >> (basic_istream &is, unsigned char *str) { volatile unsigned char ret = 0; volatile int size = 0; int i; for (i = 0; i < size; i++) str[i] = ret; return (is); } /* template basic_istream& operator >> (basic_istream &, signed char *); Comment : get a string of char (signed) in the stream(first arg) and stock it in the second args. */ template basic_istream & operator >> (basic_istream &is, signed char *str) { volatile signed char ret = 0; volatile int size = 0; int i; for (i = 0; i < size; i++) str[i] = ret; return (is); } template basic_istream &ws(basic_istream &is) {return is;} #ifdef PST_VISUAL #pragma pack(pop) /* pop back to previous value */ #endif } #ifdef __PST_IMPLICIT_USING_STD /* Implicitly include a using directive for the STD namespace when this preprocessing flag is TRUE. */ using namespace std; #endif /* ifdef __PST_IMPLICIT_USING_STD */ #endif /* PST_STL_ISTREAM */