00001
00025 #ifndef __NEW_SIM_TEXT_BUFFER_H__
00026 #define __NEW_SIM_TEXT_BUFFER_H__
00027
00028
00029 #ifndef __NEW_SIM_LOG_H__
00030 #include "new_sim_log.h"
00031 #endif
00032
00033 extern "C" {
00034 #include "SaHpi.h"
00035 }
00036
00037
00044 class NewSimulatorTextBuffer {
00045
00046 protected:
00047 int BinaryToAscii( char *buffer, unsigned int len ) const;
00048 int BcdPlusToAscii( char *buffer, unsigned int len ) const;
00049 int Ascii6ToAscii( char *buffer, unsigned int len ) const;
00050 int LanguageToAscii( char *buffer, unsigned int len ) const;
00051
00052 int AsciiToBcdPlus ( const char *input );
00053 int AsciiToAscii6 ( const char *input );
00054 int AsciiToLanguage( const char *input );
00055
00057 SaHpiTextBufferT m_buffer;
00058
00059 public:
00060 NewSimulatorTextBuffer();
00061 NewSimulatorTextBuffer( const char *string, SaHpiTextTypeT type,
00062 SaHpiLanguageT l = SAHPI_LANG_ENGLISH );
00063 NewSimulatorTextBuffer( const SaHpiTextBufferT &buf );
00064
00065 void Clear();
00066
00068 operator SaHpiTextBufferT () const { return m_buffer; }
00070 SaHpiUint8T DataLength() const { return m_buffer.DataLength; }
00071
00072 SaHpiTextTypeT CheckAscii( const char *s );
00073
00074
00075 bool SetAscii( const char *string, SaHpiTextTypeT type,
00076 SaHpiLanguageT l = SAHPI_LANG_ENGLISH );
00077
00078
00079 bool SetData( SaHpiTextBufferT data );
00080
00081
00082 int GetAscii( char *buffer, unsigned int len ) const;
00083
00084 bool operator==( const NewSimulatorTextBuffer &tb ) const;
00085 bool operator!=( const NewSimulatorTextBuffer &tb ) const;
00086 };
00087
00088
00089 NewSimulatorLog &operator<<( NewSimulatorLog &dump, const NewSimulatorTextBuffer &tb );
00090
00091
00092 #endif